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());
}
}
}
}
}
}
}
}
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);
}
}
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;
}
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);
}
}
}
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);
}
}
Aggregations