Search in sources :

Example 1 with EntityNamePrincipalName

use of org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName 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;
    EntityNamePrincipalName entityName;
    // 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.
    return (entityName != null) ? entityName.getPrincipalName() : null;
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) EntityNamePrincipalName(org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName)

Aggregations

Account (org.kuali.kfs.coa.businessobject.Account)1 EntityNamePrincipalName (org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName)1