Search in sources :

Example 6 with ActionTaken

use of org.kuali.kfs.kew.actiontaken.ActionTaken in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherDocument method doRouteStatusChange.

/**
 * Overridden to interact with the Legacy Travel service
 * @see <a href="https://jira.cornell.edu/browse/KFSPTS-2715">https://jira.cornell.edu/browse/KFSPTS-2715</a>
 */
@Override
public void doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) {
    // If the DV is Canceled 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 = findDissapprovalReason(actionsTaken);
        try {
            CULegacyTravelService cuLegacyTravelService = SpringContext.getBean(CULegacyTravelService.class);
            isTravelDoc = cuLegacyTravelService.isCULegacyTravelIntegrationInterfaceAssociatedWithTrip(this);
            if (isTravelDoc) {
                // This means the DV is a Travel DV
                tripReOpened = cuLegacyTravelService.reopenLegacyTrip(this.getDocumentNumber(), disapprovalReason);
                LOG.info("Trip successfully reopened : " + tripReOpened);
            } else {
                LOG.info("DV is not a travel DV");
            }
        } catch (Exception ex) {
            LOG.error("Exception occurred while trying to cancel a trip.", ex);
        }
    }
    super.doRouteStatusChange(statusChangeEvent);
}
Also used : CULegacyTravelService(edu.cornell.kfs.fp.document.service.CULegacyTravelService) ActionTaken(org.kuali.kfs.kew.actiontaken.ActionTaken) WorkflowException(org.kuali.kfs.kew.api.exception.WorkflowException)

Example 7 with ActionTaken

use of org.kuali.kfs.kew.actiontaken.ActionTaken in project cu-kfs by CU-CommunityApps.

the class CuPurchaseOrderAmendmentDocument method getAllPriorApprovers.

public Set<Person> getAllPriorApprovers() throws WorkflowException {
    PersonService personService = KimApiServiceLocator.getPersonService();
    List<ActionTaken> actionsTaken = this.getFinancialSystemDocumentHeader().getWorkflowDocument().getActionsTaken();
    Set<String> principalIds = new HashSet<String>();
    Set<Person> persons = new HashSet<Person>();
    for (ActionTaken actionTaken : actionsTaken) {
        if (KewApiConstants.ACTION_TAKEN_APPROVED_CD.equals(actionTaken.getActionTaken())) {
            String principalId = actionTaken.getPrincipalId();
            if (!principalIds.contains(principalId)) {
                principalIds.add(principalId);
                persons.add(personService.getPerson(principalId));
            }
        }
    }
    return persons;
}
Also used : PersonService(org.kuali.kfs.kim.api.identity.PersonService) ActionTaken(org.kuali.kfs.kew.actiontaken.ActionTaken) Person(org.kuali.kfs.kim.api.identity.Person) HashSet(java.util.HashSet)

Example 8 with ActionTaken

use of org.kuali.kfs.kew.actiontaken.ActionTaken in project cu-kfs by CU-CommunityApps.

the class ExcludeInitiatorAndSubmitterSeparationOfDutiesRoleTypeService method getApproverOrInitiator.

private String getApproverOrInitiator(String documentId) {
    String approverOrInitiatorPrincipalId = null;
    String principalId = workflowDocumentService.getDocumentInitiatorPrincipalId(documentId);
    List<ActionTaken> actionTakenDTOs = workflowDocumentService.getActionsTaken(documentId);
    for (ActionTaken actionTaken : actionTakenDTOs) {
        if (principalId.equals(actionTaken.getPrincipalId())) {
            approverOrInitiatorPrincipalId = principalId;
        }
    }
    return approverOrInitiatorPrincipalId;
}
Also used : ActionTaken(org.kuali.kfs.kew.actiontaken.ActionTaken)

Example 9 with ActionTaken

use of org.kuali.kfs.kew.actiontaken.ActionTaken in project cu-kfs by CU-CommunityApps.

the class DisbursementVoucherDocument method getAllPriorApprovers.

public Set<Person> getAllPriorApprovers() throws WorkflowException {
    PersonService personService = KimApiServiceLocator.getPersonService();
    List<ActionTaken> actionsTaken = getDocumentHeader().getWorkflowDocument().getActionsTaken();
    Set<String> principalIds = new HashSet<>();
    Set<Person> persons = new HashSet<>();
    for (ActionTaken actionTaken : actionsTaken) {
        if (KewApiConstants.ACTION_TAKEN_APPROVED_CD.equals(actionTaken.getActionTaken())) {
            String principalId = actionTaken.getPrincipalId();
            if (!principalIds.contains(principalId)) {
                principalIds.add(principalId);
                persons.add(personService.getPerson(principalId));
            }
        }
    }
    return persons;
}
Also used : PersonService(org.kuali.kfs.kim.api.identity.PersonService) ActionTaken(org.kuali.kfs.kew.actiontaken.ActionTaken) Person(org.kuali.kfs.kim.api.identity.Person) HashSet(java.util.HashSet)

Example 10 with ActionTaken

use of org.kuali.kfs.kew.actiontaken.ActionTaken in project cu-kfs by CU-CommunityApps.

the class ActionTakenDAOOjbImpl method load.

public ActionTaken load(String id) {
    LOG.debug("Loading Action Taken for the given id " + id);
    Criteria criteria = new Criteria();
    criteria.addEqualTo("actionTakenId", id);
    return (ActionTaken) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(ActionTaken.class, criteria));
}
Also used : QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) QueryByCriteria(org.apache.ojb.broker.query.QueryByCriteria) Criteria(org.apache.ojb.broker.query.Criteria) ActionTaken(org.kuali.kfs.kew.actiontaken.ActionTaken)

Aggregations

ActionTaken (org.kuali.kfs.kew.actiontaken.ActionTaken)12 ArrayList (java.util.ArrayList)3 CULegacyTravelService (edu.cornell.kfs.fp.document.service.CULegacyTravelService)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Criteria (org.apache.ojb.broker.query.Criteria)2 QueryByCriteria (org.apache.ojb.broker.query.QueryByCriteria)2 WorkflowException (org.kuali.kfs.kew.api.exception.WorkflowException)2 Person (org.kuali.kfs.kim.api.identity.Person)2 PersonService (org.kuali.kfs.kim.api.identity.PersonService)2 Timestamp (java.sql.Timestamp)1 ParseException (java.text.ParseException)1 Iterator (java.util.Iterator)1 StringTokenizer (java.util.StringTokenizer)1 ActionMessage (org.apache.struts.action.ActionMessage)1 ActionMessages (org.apache.struts.action.ActionMessages)1 ConfigurationService (org.kuali.kfs.core.api.config.property.ConfigurationService)1 ParameterEvaluator (org.kuali.kfs.core.api.parameter.ParameterEvaluator)1 ParameterEvaluatorService (org.kuali.kfs.core.api.parameter.ParameterEvaluatorService)1 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)1