use of org.kuali.rice.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.
the class AccountingDocumentGeneratorBase method buildDocumentNoteAttachment.
protected Note buildDocumentNoteAttachment(T document, AccountingXmlDocumentBackupLink backupLink) {
if (LOG.isDebugEnabled()) {
LOG.debug("buildDocumentNoteAttachment: " + backupLink);
}
Person systemUser = personService.getPersonByPrincipalName(KFSConstants.SYSTEM_USER);
Note note = emptyNoteGenerator.get();
note.setAuthorUniversalIdentifier(systemUser.getPrincipalId());
note.setNotePostedTimestampToCurrent();
addAttachmentToNote(document, backupLink, note);
note.setNoteText(backupLink.getDescription());
return note;
}
use of org.kuali.rice.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImpl method retrieveAdvanceDepositDocumentsToRoute.
/**
* Returns a list of all initiated but not yet routed advance deposit documents, using the WorkflowDocumentService.
*
* @return a list of advance deposit documents to route
*/
protected List<String> retrieveAdvanceDepositDocumentsToRoute(String statusCode) throws WorkflowException, RemoteException {
List<String> documentIds = new ArrayList<String>();
List<DocumentStatus> routeStatuses = new ArrayList<DocumentStatus>();
routeStatuses.add(DocumentStatus.fromCode(statusCode));
Person systemUser = getPersonService().getPersonByPrincipalName(KFSConstants.SYSTEM_USER);
String principalName = systemUser.getPrincipalName();
DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(KFSConstants.FinancialDocumentTypeCodes.ADVANCE_DEPOSIT);
criteria.setDocumentStatuses(routeStatuses);
criteria.setInitiatorPrincipalName(principalName);
DocumentSearchResults results = getWorkflowDocumentService().documentSearch(systemUser.getPrincipalId(), criteria.build());
for (DocumentSearchResult resultRow : results.getSearchResults()) {
Document document = resultRow.getDocument();
if (ObjectUtils.isNotNull(document)) {
documentIds.add(document.getDocumentId());
}
}
return documentIds;
}
use of org.kuali.rice.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.
the class CuPurchaseOrderAmendmentDocument method isSeparationOfDutiesReviewRequired.
protected boolean isSeparationOfDutiesReviewRequired() {
try {
Set<Person> priorApprovers = getAllPriorApprovers();
// then no need for separation of duties
if (priorApprovers.size() > 0) {
return false;
}
} catch (WorkflowException we) {
LOG.error("Exception while attempting to retrieve all prior approvers from workflow: " + we);
}
ParameterService parameterService = SpringContext.getBean(ParameterService.class);
KualiDecimal maxAllowedAmount = new KualiDecimal(parameterService.getParameterValueAsString(RequisitionDocument.class, PurapParameterConstants.SEPARATION_OF_DUTIES_DOLLAR_AMOUNT));
// if app param amount is greater than or equal to documentTotalAmount... no need for separation of duties
KualiDecimal totalAmount = getFinancialSystemDocumentHeader().getFinancialDocumentTotalAmount();
if (ObjectUtils.isNotNull(maxAllowedAmount) && ObjectUtils.isNotNull(totalAmount) && (maxAllowedAmount.compareTo(totalAmount) >= 0)) {
return false;
} else {
return true;
}
}
use of org.kuali.rice.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.
the class CuRequisitionDocument method initiateDocument.
/**
* Overridden to unmask name and phone number. This will be able to be removed once this fix is in the base code.
*/
@Override
public void initiateDocument() throws WorkflowException {
super.initiateDocument();
Person currentUser = GlobalVariables.getUserSession().getPerson();
this.setDeliveryToName(currentUser.getNameUnmasked());
this.setDeliveryToPhoneNumber(SpringContext.getBean(PhoneNumberService.class).formatNumberIfPossible(currentUser.getPhoneNumberUnmasked()));
this.setRequestorPersonName(currentUser.getNameUnmasked());
this.setRequestorPersonPhoneNumber(SpringContext.getBean(PhoneNumberService.class).formatNumberIfPossible(currentUser.getPhoneNumberUnmasked()));
}
use of org.kuali.rice.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.
the class IWantDocumentFeedServiceImpl method populateIWantDocDeliverToSection.
/**
* Populates the Deliver To section of the I Want document.
*
* @param batchIWantDocument
* @param iWantDocument
*
* @return true if no errors occur, false otherwise
*/
protected boolean populateIWantDocDeliverToSection(BatchIWantDocument batchIWantDocument, IWantDocument iWantDocument) {
boolean noErrors = true;
if (batchIWantDocument.isSameAsInitiator()) {
iWantDocument.setSameAsInitiator(true);
iWantDocument.setDeliverToNetID(iWantDocument.getInitiatorNetID());
iWantDocument.setDeliverToName(iWantDocument.getInitiatorName());
iWantDocument.setDeliverToEmailAddress(iWantDocument.getInitiatorEmailAddress());
iWantDocument.setDeliverToPhoneNumber(iWantDocument.getInitiatorPhoneNumber());
iWantDocument.setDeliverToAddress(iWantDocument.getInitiatorAddress());
} else {
if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToNetID())) {
iWantDocument.setDeliverToNetID(batchIWantDocument.getDeliverToNetID());
Person deliverToPerson = personService.getPersonByPrincipalName(batchIWantDocument.getDeliverToNetID());
if (ObjectUtils.isNull(deliverToPerson)) {
LOG.error("Deliver to net ID is not valid: " + deliverToPerson);
noErrors = false;
} else {
String deliverToName = deliverToPerson.getNameUnmasked();
String deliverToPhoneNumber = deliverToPerson.getPhoneNumberUnmasked();
String deliverToEmailAddress = deliverToPerson.getEmailAddressUnmasked();
String address = iWantDocumentService.getPersonCampusAddress(batchIWantDocument.getDeliverToNetID());
iWantDocument.setDeliverToName(deliverToName);
if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToEmailAddress())) {
iWantDocument.setDeliverToEmailAddress(batchIWantDocument.getDeliverToEmailAddress());
} else {
iWantDocument.setDeliverToEmailAddress(deliverToEmailAddress);
}
if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToPhoneNumber())) {
iWantDocument.setDeliverToPhoneNumber(batchIWantDocument.getDeliverToPhoneNumber());
} else {
iWantDocument.setDeliverToPhoneNumber(deliverToPhoneNumber);
}
if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToAddress())) {
iWantDocument.setDeliverToAddress(batchIWantDocument.getDeliverToAddress());
} else
iWantDocument.setDeliverToAddress(address);
}
} else {
if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToEmailAddress())) {
iWantDocument.setDeliverToEmailAddress(batchIWantDocument.getDeliverToEmailAddress());
}
if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToPhoneNumber())) {
iWantDocument.setDeliverToPhoneNumber(batchIWantDocument.getDeliverToPhoneNumber());
}
if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToAddress())) {
iWantDocument.setDeliverToAddress(batchIWantDocument.getDeliverToAddress());
}
}
}
return noErrors;
}
Aggregations