code: public String getSecurityName(boolean setAttr) throws Exception {
          String securityName = null;
          if (entity.getIdentifier().isSet(securityNameProp)) {
              securityName = (String) entity.getIdentifier().get(securityNameProp);
          }
  
          // Neither identifier is set.
          if (securityName == null && !entity.getIdentifier().isSet(uniqueIdProp)) {
              throw new WIMApplicationException(WIMMessageKey.REQUIRED_IDENTIFIERS_MISSING, Tr.formatMessage(tc, WIMMessageKey.REQUIRED_IDENTIFIERS_MISSING));
          } else if (securityName == null) {
              String uniqueId = (String) entity.getIdentifier().get(uniqueIdProp);
  
              // Get the securityName.
              securityName = getSecurityNameForEntity(uniqueId);
          }
  
          // Set the attribute in the WIM entity if requested. If it needs a RDN style name, make it.
          if (setAttr) {
              // Construct RDN style from securityName only if its not already a DN
              // securityName = (UniqueNameHelper.isDN(securityName) == null ||
              //                !StringUtil.endsWithIgnoreCase(securityName, "," + baseEntryName)) ? securityName : securityName;
              entity.getIdentifier().set(securityNameProp, securityName);
          }
  
          return securityName;
      }
docs: Returns the securityName of a user or a group.
  
  @param setAttr a boolean indicating whether to actually set the attribute
  in the entity or just perform a lookup.
  @return the user or group's securityName.
  @throws Exception identifier values are missing or the underlying
  registry threw an error.