EN · DE · RU · FR · ES

#514: SetOfAllLdapObjects.java

projectforge-business/src/main/java/org/projectforge/business/ldap/SetOfAllLdapObjects.java Type: Java · Role: LDAP Integration · Source: projectforge-business/src/main/java/org/projectforge/business/ldap/SetOfAllLdapObjects.java 59 lines · 26 code · 27 comments · 6 blank
Source code file at projectforge-business/src/main/java/org/projectforge/business/ldap/SetOfAllLdapObjects.java containing Java code for the LDAP Integration layer.

Code Structure

Package: org.projectforge.business.ldap

Classes: SetOfAllLdapObjects

Methods (2): contains

Imports: 3 packages

Source Code (abridged)

package org.projectforge.business.ldap;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * Stores DN and id (if given) in sets to detect either an object is in the set or not in later operations. This is used by
 * {@link LdapDao#createOrUpdate(SetOfAllLdapObjects, LdapObject, Object...)}.
 * @author Kai Reinhard (k.reinhard@micromata.de)
 */
public class SetOfAllLdapObjects
{
  Set<String> setOfDNs = new HashSet<>();

  Set<Serializable> setOfIds = new HashSet<>();

  public void add(final LdapObject< ? > obj)
  {
    setOfDNs.add(obj.getDn());
    if (obj.getId() != null) {
      setOfIds.add(obj.getId());
    }
  }

  public boolean contains(final LdapObject< ? > obj, final String dn)
  {
    if (obj.getId() != null && setOfIds.contains(obj.getId())) {
      return true;
    }
    if (setOfDNs.contains(dn)) {
      return true;
    }
    return false;
  }
}

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
5f7ef41b8 Copyright 2021 -> 2022