use of org.kuali.kfs.kew.actiontaken.ActionTaken in project cu-kfs by CU-CommunityApps.
the class CuDistributionOfIncomeAndExpenseDocument method doRouteStatusChange.
/**
* Overridden to interact with the Legacy Travel service
* @see https://jira.cornell.edu/browse/KFSPTS-2715
*/
@Override
public void doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) {
// If the DI is Cancelled or Disapproved, we need to reopen the trip in the Legacy Travel service.
if (getDocumentHeader().getWorkflowDocument().isCanceled() || getDocumentHeader().getWorkflowDocument().isDisapproved()) {
boolean tripReOpened = false;
boolean isTravelDoc = false;
List<ActionTaken> actionsTaken = this.getDocumentHeader().getWorkflowDocument().getActionsTaken();
String disapprovalReason = "";
if (actionsTaken.size() > 0) {
String annotation = actionsTaken.get(actionsTaken.size() - 1).getAnnotation();
if (StringUtils.isNotEmpty(annotation)) {
disapprovalReason = annotation.substring("Disapproval reason - ".length());
}
}
try {
CULegacyTravelService cuLegacyTravelService = SpringContext.getBean(CULegacyTravelService.class);
isTravelDoc = cuLegacyTravelService.isCULegacyTravelIntegrationInterfaceAssociatedWithTrip(this);
if (isTravelDoc) {
// This means the DI is a Travel DI
tripReOpened = cuLegacyTravelService.reopenLegacyTrip(this.getDocumentNumber(), disapprovalReason);
LOG.info("Trip successfully reopened : " + tripReOpened);
} else {
LOG.info("DI is not a travel DI");
}
} catch (Exception ex) {
LOG.error("Exception occurred while trying to cancel a trip.", ex);
}
}
super.doRouteStatusChange(statusChangeEvent);
}
use of org.kuali.kfs.kew.actiontaken.ActionTaken in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method isCampusReviewRequired.
protected boolean isCampusReviewRequired() {
List<ActionTaken> actions = RouteContext.getCurrentRouteContext().getDocument().getActionsTaken();
List<String> people = new ArrayList<String>();
for (ActionTaken atv : actions) {
if (!people.contains(atv.getPrincipalId())) {
people.add(atv.getPrincipalId());
}
}
if (people.size() < 2) {
return true;
}
List<AccountingLine> theList = (List<AccountingLine>) this.sourceAccountingLines;
for (AccountingLine alb : theList) {
ParameterEvaluator objectCodes = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator("KFS-FP", "DisbursementVoucher", OBJECT_CODES_REQUIRING_CAMPUS_REVIEW, alb.getFinancialObjectCode());
if (objectCodes.evaluationSucceeds()) {
LOG.info("Object Code " + alb.getFinancialObjectCode() + " requires this document to undergo Campus review.");
return true;
}
}
ParameterEvaluator paymentReasons = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator("KFS-FP", "DisbursementVoucher", PAYMENT_REASONS_REQUIRING_CAMPUS_REVIEW, this.dvPayeeDetail.getDisbVchrPaymentReasonCode());
if (paymentReasons.evaluationSucceeds()) {
return true;
}
String dollarThreshold = getParameterService().getParameterValueAsString("KFS-FP", "DisbursementVoucher", DOLLAR_THRESHOLD_REQUIRING_CAMPUS_REVIEW);
KualiDecimal dollarThresholdDecimal = new KualiDecimal(dollarThreshold);
if (this.disbVchrCheckTotalAmount.isGreaterEqual(dollarThresholdDecimal)) {
return true;
}
return false;
}
use of org.kuali.kfs.kew.actiontaken.ActionTaken in project cu-kfs by CU-CommunityApps.
the class CuAutoDisapproveDocumentsServiceImpl method buildSuccessMessage.
private String buildSuccessMessage(Document document) throws Exception {
StringBuilder headerBuilder = new StringBuilder();
headerBuilder.append(document.getDocumentNumber());
headerBuilder.append(TAB);
headerBuilder.append(document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
headerBuilder.append(TAB);
headerBuilder.append(document.getDocumentHeader().getDocumentDescription());
headerBuilder.append(TAB);
headerBuilder.append(getPersonService().getPerson(document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId()).getPrincipalName());
headerBuilder.append(TAB);
headerBuilder.append(getPersonService().getPerson(document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId()).getName());
headerBuilder.append(TAB);
headerBuilder.append(document.getDocumentHeader().getWorkflowDocument().getDateCreated());
headerBuilder.append(TAB);
ConfigurationService k = KRADServiceLocator.getKualiConfigurationService();
StringBuilder routeBuilder = new StringBuilder();
String url = k.getPropertyValueAsString("workflow.url");
routeBuilder.append(url);
routeBuilder.append("/RouteLog.do?routeHeaderId=");
routeBuilder.append(document.getDocumentNumber());
routeBuilder.append(TAB);
headerBuilder.append(routeBuilder);
List<ActionTaken> actions;
// try {
// actions = KEWServiceLocator.getActionTakenService().findByDocumentId(document.getDocumentHeader().getWorkflowDocument().getDocumentId());
actions = KEWServiceLocator.getActionTakenService().findByDocumentIdIgnoreCurrentInd(document.getDocumentNumber());
ActionTaken max = null;
for (ActionTaken at : actions) {
if (ObjectUtils.isNull(max)) {
max = at;
} else if (at.getActionDate().compareTo(max.getActionDate()) > 0) {
max = at;
}
}
headerBuilder.append(getPersonService().getPerson(max.getPrincipalId()).getPrincipalName());
headerBuilder.append(TAB);
headerBuilder.append(getPersonService().getPerson(max.getPrincipalId()).getName());
headerBuilder.append(TAB);
headerBuilder.append(max.getActionDate());
headerBuilder.append(TAB);
headerBuilder.append(max.getActionTakenLabel());
headerBuilder.append(TAB);
// } catch (WorkflowException e) {
// e.printStackTrace();
// }
String headerString = headerBuilder.toString();
StringBuilder builder = new StringBuilder();
if (document instanceof AccountingDocumentBase) {
for (Object o : ((AccountingDocumentBase) document).getSourceAccountingLines()) {
SourceAccountingLine sal = (SourceAccountingLine) o;
builder.append(headerString);
builder.append(sal.getChartOfAccountsCode());
builder.append(TAB);
builder.append(sal.getAccountNumber());
builder.append(TAB);
builder.append(sal.getAmount());
builder.append(TAB);
builder.append(sal.getAccount().getOrganizationCode());
builder.append(TAB);
builder.append(KFSConstants.NEWLINE);
}
for (Object o : ((AccountingDocumentBase) document).getTargetAccountingLines()) {
TargetAccountingLine tal = (TargetAccountingLine) o;
builder.append(headerString);
builder.append(tal.getChartOfAccountsCode());
builder.append(TAB);
builder.append(tal.getAccountNumber());
builder.append(TAB);
builder.append(tal.getAmount());
builder.append(TAB);
builder.append(tal.getAccount().getOrganizationCode());
builder.append(TAB);
builder.append(KFSConstants.NEWLINE);
}
}
return builder.toString();
}
use of org.kuali.kfs.kew.actiontaken.ActionTaken in project cu-kfs by CU-CommunityApps.
the class ExcludeInitiatorAndSubmitterSeparationOfDutiesRoleTypeService method getSubmitter.
private String getSubmitter(String documentId) {
String submitterPrincipalId = null;
String principalId = workflowDocumentService.getRoutedByPrincipalIdByDocumentId(documentId);
List<ActionTaken> actionTakenDTOs = workflowDocumentService.getActionsTaken(documentId);
for (ActionTaken actionTaken : actionTakenDTOs) {
if (StringUtils.equals(principalId, actionTaken.getPrincipalId())) {
submitterPrincipalId = principalId;
}
}
return submitterPrincipalId;
}
use of org.kuali.kfs.kew.actiontaken.ActionTaken in project cu-kfs by CU-CommunityApps.
the class ActionTakenDAOOjbImpl method findByActionTakenId.
public ActionTaken findByActionTakenId(String actionTakenId) {
LOG.debug("finding Action Taken by actionTakenId " + actionTakenId);
Criteria criteria = new Criteria();
criteria.addEqualTo("actionTakenId", actionTakenId);
criteria.addEqualTo("currentIndicator", Boolean.TRUE);
return (ActionTaken) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(ActionTaken.class, criteria));
}
Aggregations