Search in sources :

Example 1 with Entity

use of org.kuali.kfs.kim.impl.identity.entity.Entity in project cu-kfs by CU-CommunityApps.

the class CuPayeeACHAccountMaintainableImpl method refresh.

@Override
public void refresh(String refreshCaller, Map fieldValues, MaintenanceDocument document) {
    super.refresh(refreshCaller, fieldValues, document);
    if (StringUtils.isNotEmpty(refreshCaller) && refreshCaller.equalsIgnoreCase("achPayeeLookupable")) {
        PayeeACHAccount payeeAchAccount = (PayeeACHAccount) document.getNewMaintainableObject().getBusinessObject();
        String payeeIdNumber = payeeAchAccount.getPayeeIdNumber();
        String payeeIdentifierTypeCode = payeeAchAccount.getPayeeIdentifierTypeCode();
        if (StringUtils.isNotEmpty(payeeAchAccount.getPayeeIdNumber())) {
            // for Employee, retrieve from Person table by employee ID
            if (StringUtils.equalsIgnoreCase(payeeIdentifierTypeCode, PayeeIdTypeCodes.EMPLOYEE)) {
                Person person = SpringContext.getBean(PersonService.class).getPersonByEmployeeId(payeeIdNumber);
                if (ObjectUtils.isNotNull(person)) {
                    payeeAchAccount.setPayeeEmailAddress(person.getEmailAddress());
                }
            } else // for Entity, retrieve from Entity table by entity ID then from Person table
            if (StringUtils.equalsIgnoreCase(payeeIdentifierTypeCode, PayeeIdTypeCodes.ENTITY)) {
                if (ObjectUtils.isNotNull(payeeIdNumber)) {
                    Entity entity = KimApiServiceLocator.getIdentityService().getEntity(payeeIdNumber);
                    if (ObjectUtils.isNotNull(entity)) {
                        List<Principal> principals = entity.getPrincipals();
                        if (principals.size() > 0 && ObjectUtils.isNotNull(principals.get(0))) {
                            String principalId = principals.get(0).getPrincipalId();
                            Person person = SpringContext.getBean(PersonService.class).getPerson(principalId);
                            if (ObjectUtils.isNotNull(person)) {
                                payeeAchAccount.setPayeeEmailAddress(person.getEmailAddress());
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : Entity(org.kuali.kfs.kim.impl.identity.entity.Entity) PayeeACHAccount(org.kuali.kfs.pdp.businessobject.PayeeACHAccount) PersonService(org.kuali.kfs.kim.api.identity.PersonService) List(java.util.List) Person(org.kuali.kfs.kim.api.identity.Person)

Example 2 with Entity

use of org.kuali.kfs.kim.impl.identity.entity.Entity in project cu-kfs by CU-CommunityApps.

the class DisbursementVoucherAction method loadDocument.

/**
 * @see org.kuali.kfs.sys.web.struts.KualiAccountingDocumentActionBase#loadDocument(org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)
 */
@Override
protected void loadDocument(KualiDocumentFormBase kualiDocumentFormBase) throws WorkflowException {
    super.loadDocument(kualiDocumentFormBase);
    DisbursementVoucherForm dvForm = (DisbursementVoucherForm) kualiDocumentFormBase;
    DisbursementVoucherDocument dvDoc = (DisbursementVoucherDocument) dvForm.getDocument();
    // do not execute the further refreshing logic if a payee is not selected
    String payeeIdNumber = dvDoc.getDvPayeeDetail().getDisbVchrPayeeIdNumber();
    // ==== CU Customization: Updated condition to prevent errors when opening no-payee, non-SAVED DV docs that are at the initial AdHoc node. ====
    if ((payeeIdNumber != null && !payeeIdNumber.isEmpty()) || (!dvDoc.getDocumentHeader().getWorkflowDocument().checkStatus(DocumentStatus.SAVED) && !dvDoc.getDocumentHeader().getWorkflowDocument().getCurrentNodeNames().contains(DV_ADHOC_NODE))) {
        Entity entity = KimApiServiceLocator.getIdentityService().getEntityByEmployeeId(payeeIdNumber);
        // KFSMI-8935: When an employee is inactive, the Payment Type field on DV documents should display the message "Is this payee an employee" = No
        if (entity != null && entity.isActive()) {
            dvDoc.getDvPayeeDetail().setDisbVchrPayeeEmployeeCode(true);
        } else {
            dvDoc.getDvPayeeDetail().setDisbVchrPayeeEmployeeCode(false);
        }
    }
    if (dvDoc.getDocumentHeader().getWorkflowDocument().checkStatus(DocumentStatus.SAVED) || dvDoc.getDocumentHeader().getWorkflowDocument().checkStatus(DocumentStatus.ENROUTE)) {
        checkForDuplicatePayments(dvDoc);
    }
}
Also used : Entity(org.kuali.kfs.kim.impl.identity.entity.Entity) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 3 with Entity

use of org.kuali.kfs.kim.impl.identity.entity.Entity in project cu-kfs by CU-CommunityApps.

the class DisbursementVoucherDocument method getNonDefaultAddress.

/**
 * Finds the address for the given employee, matching the type in the
 * KFS-FP / Disbursement Voucher/ DEFAULT_EMPLOYEE_ADDRESS_TYPE parameter, to use as the address for the employee
 *
 * @param employee the employee to find a non-default address for
 * @return the non-default address, or null if not found
 */
protected EntityAddress getNonDefaultAddress(Person employee) {
    final String addressType = getParameterService().getParameterValueAsString(DisbursementVoucherDocument.class, FPParameterConstants.DEFAULT_EMPLOYEE_ADDRESS_TYPE);
    final Entity entity = getIdentityService().getEntityByPrincipalId(employee.getPrincipalId());
    if (entity != null) {
        final EntityTypeContactInfo entityEntityType = getPersonEntityEntityType(entity);
        if (entityEntityType != null) {
            final List<EntityAddress> addresses = entityEntityType.getAddresses();
            return findAddressByType(addresses, addressType);
        }
    }
    return null;
}
Also used : Entity(org.kuali.kfs.kim.impl.identity.entity.Entity) EntityAddress(org.kuali.kfs.kim.impl.identity.address.EntityAddress) EntityTypeContactInfo(org.kuali.kfs.kim.impl.identity.type.EntityTypeContactInfo)

Example 4 with Entity

use of org.kuali.kfs.kim.impl.identity.entity.Entity in project cu-kfs by CU-CommunityApps.

the class IWantDocumentAction method setCollegeAndDepartmentBasedOnPrimaryDepartment.

/**
 * Sets the College and Department based on the initiator primary department.
 *
 * @param documentForm
 */
private void setCollegeAndDepartmentBasedOnPrimaryDepartment(IWantDocumentForm documentForm) {
    IWantDocumentService iWantDocumentService = SpringContext.getBean(IWantDocumentService.class);
    String primaryDeptOrg = null;
    IWantDocument iWantDocument = null;
    if (documentForm != null && documentForm.getDocument() != null) {
        iWantDocument = (IWantDocument) documentForm.getDocument();
    }
    if (iWantDocument != null && StringUtils.isEmpty(iWantDocument.getCollegeLevelOrganization())) {
        Person currentUser = GlobalVariables.getUserSession().getPerson();
        Entity entityInfo = KimApiServiceLocator.getIdentityService().getEntityByPrincipalId(currentUser.getPrincipalId());
        if (ObjectUtils.isNotNull(entityInfo)) {
            if (ObjectUtils.isNotNull(entityInfo.getEmploymentInformation()) && entityInfo.getEmploymentInformation().size() > 0) {
                EntityEmployment employmentInformation = entityInfo.getEmploymentInformation().get(0);
                String primaryDepartment = employmentInformation.getPrimaryDepartmentCode();
                primaryDeptOrg = primaryDepartment.substring(primaryDepartment.lastIndexOf('-') + 1, primaryDepartment.length());
                String cLevelOrg = iWantDocumentService.getCLevelOrganizationForDLevelOrg(primaryDepartment);
                ((IWantDocument) documentForm.getDocument()).setCollegeLevelOrganization(cLevelOrg);
            }
        }
    }
    if (iWantDocument != null && StringUtils.isNotEmpty(iWantDocument.getCollegeLevelOrganization())) {
        String cLevelOrg = iWantDocument.getCollegeLevelOrganization();
        documentForm.getDeptOrgKeyLabels().clear();
        documentForm.getDeptOrgKeyLabels().add(new ConcreteKeyValue("", "Please Select"));
        List<LevelOrganization> dLevelOrgs = iWantDocumentService.getDLevelOrganizations(cLevelOrg);
        for (LevelOrganization levelOrganization : dLevelOrgs) {
            documentForm.getDeptOrgKeyLabels().add(new ConcreteKeyValue(levelOrganization.getCode(), levelOrganization.getCodeAndDescription()));
        }
        if (primaryDeptOrg != null) {
            iWantDocument.setDepartmentLevelOrganization(primaryDeptOrg);
        }
    }
}
Also used : ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) Entity(org.kuali.kfs.kim.impl.identity.entity.Entity) LevelOrganization(edu.cornell.kfs.module.purap.businessobject.LevelOrganization) EntityEmployment(org.kuali.kfs.kim.impl.identity.employment.EntityEmployment) Person(org.kuali.kfs.kim.api.identity.Person) IWantDocumentService(edu.cornell.kfs.module.purap.document.service.IWantDocumentService) IWantDocument(edu.cornell.kfs.module.purap.document.IWantDocument) PurApFavoriteAccountLineBuilderForIWantDocument(edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)

Example 5 with Entity

use of org.kuali.kfs.kim.impl.identity.entity.Entity in project cu-kfs by CU-CommunityApps.

the class PersonImpl method populateFullEntityInfo.

protected void populateFullEntityInfo() {
    Entity entity = getIdentityService().getEntity(entityId);
    if (entity != null) {
        populateNames(entity);
        populateEntityTypeContactInfo(entity);
        populateAddresses(entity);
        populatePhoneNumbers(entity);
        populateEmailAddresses(entity);
    }
}
Also used : Entity(org.kuali.kfs.kim.impl.identity.entity.Entity)

Aggregations

Entity (org.kuali.kfs.kim.impl.identity.entity.Entity)7 EntityEmployment (org.kuali.kfs.kim.impl.identity.employment.EntityEmployment)3 Person (org.kuali.kfs.kim.api.identity.Person)2 IWantDocUserOptions (edu.cornell.kfs.module.purap.businessobject.IWantDocUserOptions)1 LevelOrganization (edu.cornell.kfs.module.purap.businessobject.LevelOrganization)1 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)1 IWantDocumentService (edu.cornell.kfs.module.purap.document.service.IWantDocumentService)1 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ConcreteKeyValue (org.kuali.kfs.core.api.util.ConcreteKeyValue)1 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)1 PersonService (org.kuali.kfs.kim.api.identity.PersonService)1 EntityAddress (org.kuali.kfs.kim.impl.identity.address.EntityAddress)1 Principal (org.kuali.kfs.kim.impl.identity.principal.Principal)1 EntityTypeContactInfo (org.kuali.kfs.kim.impl.identity.type.EntityTypeContactInfo)1 PayeeACHAccount (org.kuali.kfs.pdp.businessobject.PayeeACHAccount)1 Cacheable (org.springframework.cache.annotation.Cacheable)1