public LdapEntry getEntityByIdentifier ( String dn , String extId , String uniqueName , List < String > inEntityTypes , List < String > propNames , boolean getMbrshipAttr , boolean getMbrAttr ) throws WIMException { String [ ] attrIds = iLdapConfigMgr . getAttributeNames ( inEntityTypes , propNames , getMbrshipAttr , getMbrAttr ) ; Attributes attrs = null ; if ( dn == null && ! iLdapConfigMgr . needTranslateRDN ( ) ) { dn = iLdapConfigMgr . switchToLdapNode ( uniqueName ) ; } // Changed the order of the if-else ladder. Please check against tWAS code for the original order if ( dn != null ) { attrs = checkAttributesCache ( dn , attrIds ) ; } else if ( extId != null ) { if ( iLdapConfigMgr . isAnyExtIdDN ( ) ) { dn = LdapHelper . getValidDN ( extId ) ; if ( dn != null ) { attrs = checkAttributesCache ( dn , attrIds ) ; } else if ( uniqueName != null ) { attrs = getAttributesByUniqueName ( uniqueName , attrIds , inEntityTypes ) ; dn = LdapHelper . getDNFromAttributes ( attrs ) ; } else { String msg = Tr . formatMessage ( tc , WIMMessageKey . ENTITY_NOT_FOUND , WIMMessageHelper . generateMsgParms ( null ) ) ; throw new EntityNotFoundException ( WIMMessageKey . ENTITY_NOT_FOUND , msg ) ; } } else { attrs = getAttributesByUniqueName ( extId , attrIds , inEntityTypes ) ; dn = LdapHelper . getDNFromAttributes ( attrs ) ; } } else if ( uniqueName != null ) { attrs = getAttributesByUniqueName ( uniqueName , attrIds , inEntityTypes ) ; dn = LdapHelper . getDNFromAttributes ( attrs ) ; } else { String msg = Tr . formatMessage ( tc , WIMMessageKey . ENTITY_NOT_FOUND , WIMMessageHelper . generateMsgParms ( null ) ) ; throw new EntityNotFoundException ( WIMMessageKey . ENTITY_NOT_FOUND , msg ) ; } String entityType = iLdapConfigMgr . getEntityType ( attrs , uniqueName , dn , extId , inEntityTypes ) ; uniqueName = getUniqueName ( dn , entityType , attrs ) ; if ( extId == null ) { extId = iLdapConfigMgr . getExtIdFromAttributes ( dn , entityType , attrs ) ; } LdapEntry ldapEntry = new LdapEntry ( dn , extId , uniqueName , entityType , attrs ) ; return ldapEntry ; }
Get an LDAP entity by an identifier . One of dn extId or uniqueName must be non - null .