use of org.kuali.kfs.kim.impl.identity.name.EntityName in project cu-kfs by CU-CommunityApps.
the class TransactionRowBuilder method checkForEntityAndAccountAndOrgExistence.
/**
* Helper method for checking if entity, account, and org objects exist
* for the current tax source row. Certain statistics will be updated
* accordingly if one or more of these objects cannot not be found.
* The initiator's principal name will also be returned, if found.
*
* @param initiatorPrincipalId The document initiator's principal ID; may be blank.
* @param chartCode The chart code; may be blank.
* @param accountNumber The account number; may be blank.
* @param summary The object encapsulating the tax-type-specific summary info.
* @return The initiator's principal name, or null if a principal name could not be found.
*/
String checkForEntityAndAccountAndOrgExistence(String initiatorPrincipalId, String chartCode, String accountNumber, T summary) {
Account account;
EntityName entityName;
Principal principal;
// Check for null entity name info.
entityName = (StringUtils.isNotBlank(initiatorPrincipalId)) ? identityService.getDefaultNamesForPrincipalId(initiatorPrincipalId) : null;
if (entityName == null) {
numNoEntityName++;
}
// Check for null account or null org.
account = (StringUtils.isNotBlank(chartCode) && StringUtils.isNotBlank(accountNumber)) ? accountService.getByPrimaryIdWithCaching(chartCode, accountNumber) : null;
if (account != null) {
if (organizationService.getByPrimaryIdWithCaching(chartCode, account.getOrganizationCode()) == null) {
numNoOrg++;
}
} else {
numNoAccount++;
}
// Return the initiator's principal name, if found.
principal = (StringUtils.isNotBlank(initiatorPrincipalId)) ? identityService.getPrincipal(initiatorPrincipalId) : null;
return (principal != null && entityName != null) ? principal.getPrincipalName() : null;
}
use of org.kuali.kfs.kim.impl.identity.name.EntityName in project cu-kfs by CU-CommunityApps.
the class IdentityServiceImpl method getDefaultNamesForPrincipalId.
@Cacheable(cacheNames = EntityName.CACHE_NAME, key = "'{getDefaultNamesForPrincipalId}-principalId=' + #p0")
@Override
public EntityName getDefaultNamesForPrincipalId(String principalId) {
Map<String, String> criteria = new HashMap<>();
criteria.put(KIMPropertyConstants.Principal.PRINCIPAL_ID, principalId);
Principal principal = businessObjectService.findByPrimaryKey(Principal.class, criteria);
if (null != principal) {
criteria.clear();
criteria.put(KIMPropertyConstants.Entity.ENTITY_ID, principal.getEntityId());
criteria.put("DFLT_IND", "Y");
criteria.put("ACTV_IND", "Y");
EntityName name = businessObjectService.findByPrimaryKey(EntityName.class, criteria);
if (name == null) {
// to make this simple for now, assume if there is no default name that this is a system entity we are
// dealing with here
name = new EntityName();
name.setLastName(principal.getPrincipalName().toUpperCase(Locale.US));
}
return name;
}
return null;
}
use of org.kuali.kfs.kim.impl.identity.name.EntityName in project cu-kfs by CU-CommunityApps.
the class PersonImpl method populateNameInfo.
protected void populateNameInfo(String entityTypeCode, Entity entity, Principal principal) {
if (entity != null) {
EntityName entityName = entity.getDefaultName();
if (entityName != null) {
firstName = unNullify(entityName.getFirstNameUnmasked());
middleName = unNullify(entityName.getMiddleNameUnmasked());
lastName = unNullify(entityName.getLastNameUnmasked());
if (entityTypeCode.equals(KimConstants.EntityTypes.SYSTEM)) {
name = principal.getPrincipalName().toUpperCase(Locale.US);
} else {
name = unNullify(entityName.getCompositeNameUnmasked());
if ("".equals(name)) {
name = lastName + ", " + firstName;
}
}
} else {
firstName = "";
middleName = "";
if (entityTypeCode.equals(KimConstants.EntityTypes.SYSTEM)) {
name = principal.getPrincipalName().toUpperCase(Locale.US);
lastName = principal.getPrincipalName().toUpperCase(Locale.US);
} else {
name = "";
lastName = "";
}
}
}
}
Aggregations