private Entity createEntityFromLdapEntry ( Object parentDO , String propName , LdapEntry ldapEntry , List < String > propNames ) throws WIMException { final String METHODNAME = "createEntityFromLdapEntry" ; String outEntityType = ldapEntry . getType ( ) ; Entity outEntity = null ; // For changed entities, when change type is delete, it is possible that // the type of entity (which maps to the LDAP entry's objectclass is not // available. if ( outEntityType != null ) { if ( outEntityType . equalsIgnoreCase ( SchemaConstants . DO_PERSON ) ) outEntity = new Person ( ) ; else if ( outEntityType . equalsIgnoreCase ( SchemaConstants . DO_PERSON_ACCOUNT ) ) outEntity = new PersonAccount ( ) ; else if ( outEntityType . equalsIgnoreCase ( SchemaConstants . DO_GROUP ) ) outEntity = new Group ( ) ; else outEntity = new Entity ( ) ; } else { outEntity = new Entity ( ) ; } if ( parentDO instanceof Root ) { if ( SchemaConstants . DO_ENTITIES . equalsIgnoreCase ( propName ) ) ( ( Root ) parentDO ) . getEntities ( ) . add ( outEntity ) ; } else if ( parentDO instanceof Entity ) { if ( SchemaConstants . DO_GROUP . equalsIgnoreCase ( propName ) ) { /* * May get back plain entities if objectclass for group entity and * group filters don't match up identically. */ if ( outEntity instanceof Group ) { ( ( Entity ) parentDO ) . getGroups ( ) . add ( ( Group ) outEntity ) ; } else { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , METHODNAME + " Expected group entity. Group will excluded from group membership. Entity is " + outEntity , ldapEntry ) ; } } } else if ( SchemaConstants . DO_MEMBERS . equalsIgnoreCase ( propName ) ) { ( ( Group ) parentDO ) . getMembers ( ) . add ( outEntity ) ; } else if ( SchemaConstants . DO_CHILDREN . equalsIgnoreCase ( propName ) ) { ( ( Entity ) parentDO ) . getChildren ( ) . add ( outEntity ) ; } } IdentifierType outId = new IdentifierType ( ) ; outEntity . setIdentifier ( outId ) ; outId . setUniqueName ( ldapEntry . getUniqueName ( ) ) ; outId . setExternalId ( ldapEntry . getExtId ( ) ) ; outId . setExternalName ( ldapEntry . getDN ( ) ) ; outId . setRepositoryId ( reposId ) ; String changeType = ldapEntry . getChangeType ( ) ; if ( changeType != null ) { outEntity . setChangeType ( changeType ) ; if ( SchemaConstants . CHANGETYPE_DELETE . equals ( changeType ) == false ) { populateEntity ( outEntity , propNames , ldapEntry . getAttributes ( ) ) ; } } else { populateEntity ( outEntity , propNames , ldapEntry . getAttributes ( ) ) ; } return outEntity ; }
Create an Entity object corresponding to the LdapEntry object returned by the LdapConnection object .