EN · DE · RU · FR · ES

#514: SetOfAllLdapObjects.java

projectforge-business/src/main/java/org/projectforge/business/ldap/SetOfAllLdapObjects.java Typ: Java · Rolle: LDAP-Integration · Quelle: projectforge-business/src/main/java/org/projectforge/business/ldap/SetOfAllLdapObjects.java 59 Zeilen · 26 Code · 27 Kommentare · 6 leer
Quellcodedatei unter projectforge-business/src/main/java/org/projectforge/business/ldap/SetOfAllLdapObjects.java mit Java-Code für die LDAP-Integrationsschicht.

Codestruktur

Paket: org.projectforge.business.ldap

Klassen: SetOfAllLdapObjects

Methoden (2): contains

Importe: 3 Pakete

Quellcode (gekürzt)

package org.projectforge.business.ldap;

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

/**
 * Speichert DN und ID (falls vorhanden) in Sets, um später zu erkennen, ob ein Objekt im Set ist oder nicht. Dies wird von
 * {@link LdapDao#createOrUpdate(SetOfAllLdapObjects, LdapObject, Object...)} verwendet.
 * @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-Verlauf

868d6abb7 2025 -> 2026
63081666f Quellcode-Dateiköpfe: 2024 -> 2025.
b6092df09 Copyright 2023 -> 2024
ab45d51fa Copyright 2001-2022 -> 2001-2023.
5f7ef41b8 Copyright 2021 -> 2022