summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lookup
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/c2kernel/lookup')
-rw-r--r--src/main/java/com/c2kernel/lookup/LDAPLookup.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/com/c2kernel/lookup/LDAPLookup.java b/src/main/java/com/c2kernel/lookup/LDAPLookup.java
index 72a847d..996ca0e 100644
--- a/src/main/java/com/c2kernel/lookup/LDAPLookup.java
+++ b/src/main/java/com/c2kernel/lookup/LDAPLookup.java
@@ -15,6 +15,8 @@ import com.c2kernel.entity.agent.ActiveEntity;
import com.c2kernel.entity.proxy.EntityProxyManager;
import com.c2kernel.entity.proxy.ProxyMessage;
import com.c2kernel.process.Gateway;
+import com.c2kernel.property.PropertyDescription;
+import com.c2kernel.property.PropertyDescriptionList;
import com.c2kernel.utils.Logger;
import com.c2kernel.utils.Resource;
import com.novell.ldap.LDAPAttributeSet;
@@ -337,6 +339,27 @@ public class LDAPLookup
searchCons.setDereference(LDAPSearchConstraints.DEREF_SEARCHING);
return search(start.getFullDN(),LDAPConnection.SCOPE_SUB,"cristalprop="+LDAPLookupUtils.escapeSearchFilter(val),searchCons);
}
+
+ public LDAPPathSet search(Path start, PropertyDescriptionList props) {
+ StringBuffer query = new StringBuffer();
+ int propCount = 0;
+ for (PropertyDescription propDesc: props.list) {
+ if (propDesc.getIsClassIdentifier()) {
+ String thisProp = LDAPLookupUtils.escapeSearchFilter(propDesc.getName()+(":")+propDesc.getDefaultValue());
+ query.append("(cristalprop=").append(thisProp).append(")");
+ propCount++;
+ }
+ }
+ LDAPSearchConstraints searchCons = new LDAPSearchConstraints();
+ searchCons.setBatchSize(0);
+ searchCons.setDereference(LDAPSearchConstraints.DEREF_SEARCHING);
+ if (propCount == 0)
+ return search(start.getFullDN(),LDAPConnection.SCOPE_SUB,"objectClass=cristalentity",searchCons);
+ else if (propCount == 1)
+ return search(start.getFullDN(),LDAPConnection.SCOPE_SUB,query.toString(),searchCons);
+ else
+ return search(start.getFullDN(),LDAPConnection.SCOPE_SUB,"(&"+query.toString()+")",searchCons);
+ }
public LDAPPathSet searchType(Path start, Path type) {
return null;