Novell JLDAP 라이브러리를 사용하여 Upsert를 실행하려고하는데, 불행히도이 예제를 찾는 데 어려움이 있습니다.Java의 LDAP 디렉토리 Upsert
public EObject put(EObject eObject){
Subject s = (Subject) eObject;
//Query and grab attributes from subject
LDAPAttributes attr = resultsToAttributes(getLDAPConnection().get(s));
//No modification needed - return
if(s.getAttributes().equals(attr)){
return eObject;
} else {
//Keys:
//REPLACE,ADD,DELETE, depending on which attributes are present in the maps, I choose the operation which will be used
Map<String,LDAPAttribute> operationalMap = figureOutWhichAttributesArePresent(c.getAttributes(),attr);
//Add the Modifcations to a modification array
ArrayList<LDAPModification> modList = new ArrayList<LDAPModification>();
for(Entry entry: operationalMap.getEntrySet()){
//Specify whether it is an update, delete, or insert here. (entry.getKey());
modList.add(new LDAPModification(entry.getKey(),entry.getValue());
}
//commit
connection.modify("directorypathhere",modList.toArray(new LDAPModification[modList.size()]));
}
나뿐만 아니라 대상의 속성을 통해 순환 결과 첫 번째 고객에 쿼리 할 필요가 없습니다 선호하는 것 : 현재, 나는해야한다. JNDI 또는 다른 라이브러리가 LDAP에 대해 여러 명령문을 실행하지 않고 업데이트/삽입을 실행할 수 있는지 알고있는 사람 있습니까?
이 스레드를 발견하셨습니까? http://stackoverflow.com/questions/389746/ldap-java-library – n1ckolas
LDAP 프로토콜 자체에 결합 된 업데이트/삽입 개념이 있다고 생각하지 않으므로 라이브러리에서 수행하는 모든 작업은 돼지의 립스틱입니다. – Petesh