use of org.kuali.kfs.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.
the class PurchasingAccountsPayableDocumentBase method isDocumentStoppedInRouteNode.
// for app doc status
@Override
public boolean isDocumentStoppedInRouteNode(String nodeName) {
WorkflowDocument workflowDocument = this.getFinancialSystemDocumentHeader().getWorkflowDocument();
Set<String> names = workflowDocument.getCurrentNodeNames();
if (CollectionUtils.isNotEmpty(names)) {
List<String> currentRouteLevels = new ArrayList<String>(names);
for (String routeLevel : currentRouteLevels) {
if (routeLevel.contains(nodeName) && workflowDocument.isApprovalRequested()) {
return true;
}
}
}
return false;
}
use of org.kuali.kfs.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.
the class PurchasingCommodityCodeValidation method shouldCheckCommodityCodeIsActive.
/**
* This method analyzes the document status and determines if the commodity codes associated with this item should be verified as active.
* The current implementation only checks that a commodity code is active if the document associated is in either INITIATED or SAVED status.
* For all other statuses the document may be in, the commodity code will not be checked for active status and the method will simply return
* true unconditionally.
*
* @param item
* @return
*/
private boolean shouldCheckCommodityCodeIsActive(PurApItem item) {
if (ObjectUtils.isNotNull(item.getPurapDocument())) {
String docNum = item.getPurapDocument().getDocumentNumber();
PurchasingAccountsPayableDocument purapDoc = item.getPurapDocument();
// Ran into issues with workflow doc not being populated in doc header for some PURAP docs, so needed to add check and retrieval.
FinancialSystemDocumentHeader docHdr = (FinancialSystemDocumentHeader) purapDoc.getDocumentHeader();
WorkflowDocument kwd = null;
kwd = WorkflowDocumentFactory.loadDocument(GlobalVariables.getUserSession().getPrincipalId(), docNum);
docHdr.setWorkflowDocument(kwd);
// Only check for active commodity codes if the doc is in initiated or saved status.
if (ObjectUtils.isNull(kwd)) {
kwd = docHdr.getWorkflowDocument();
}
if (!(kwd.isInitiated() || kwd.isSaved())) {
return false;
}
}
return true;
}
use of org.kuali.kfs.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.
the class PaymentApplicationForm method isFinalOrProcessed.
private boolean isFinalOrProcessed() {
final Collection<WorkflowDocument> workflowDocuments = new LinkedList<>();
final PaymentApplicationDocument appDocument = getPaymentApplicationDocument();
// Include this APP
final WorkflowDocument appWorkflowDocument = extractWorkFlowDocument(appDocument);
workflowDocuments.add(appWorkflowDocument);
if (appDocument.hasCashControlDetail()) {
final CashControlDocument cashControlDocument = appDocument.getCashControlDocument();
// Include this APP's CashControl
final WorkflowDocument ccWorkflowDocument = extractWorkFlowDocument(cashControlDocument);
workflowDocuments.add(ccWorkflowDocument);
// Include any other APPs associated with the CashControl
final List<CashControlDetail> cashControlDetails = cashControlDocument.getCashControlDetails();
for (final CashControlDetail cashControlDetail : cashControlDetails) {
final PaymentApplicationDocument otherAppDocument = cashControlDetail.getReferenceFinancialDocument();
if (otherAppDocument.getDocumentNumber().equals(appDocument.getDocumentNumber())) {
// Do not add this Document again; it was added above
continue;
}
final WorkflowDocument otherAppWorkflowDocument = extractWorkFlowDocument(otherAppDocument);
workflowDocuments.add(otherAppWorkflowDocument);
}
}
return workflowDocuments.stream().allMatch(wfDocument -> wfDocument.isFinal() || wfDocument.isProcessed());
}
use of org.kuali.kfs.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.
the class PaymentApplicationAdjustmentDocument method postProcessingShouldBeDone.
private boolean postProcessingShouldBeDone() {
LOG.debug("postProcessingShouldBeDone(...) - Enter");
final WorkflowDocument workflowDocument = getDocumentHeader().getWorkflowDocument();
final boolean postProcessingShouldBeDone = workflowDocument.isFinal();
LOG.debug("postProcessingShouldBeDone(...) - Exit : postProcessingShouldBeDone={}", postProcessingShouldBeDone);
return postProcessingShouldBeDone;
}
use of org.kuali.kfs.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.
the class CuProcurementCardAccountingLineAuthorizer method determineEditPermissionByFieldName.
@Override
protected boolean determineEditPermissionByFieldName(AccountingDocument accountingDocument, AccountingLine accountingLine, String fieldName, Person currentUser, Set<String> currentNodes) {
WorkflowDocument workflowDocument = accountingDocument.getDocumentHeader().getWorkflowDocument();
List<ActionRequest> actionRequests = workflowDocument.getRootActionRequests();
Set<String> nodeNames = workflowDocument.getCurrentNodeNames();
boolean isAddHocRoute = CollectionUtils.isNotEmpty(nodeNames) && nodeNames.contains(PurapWorkflowConstants.DOC_ADHOC_NODE_NAME);
if (!isAddHocRoute) {
for (ActionRequest actionRequest : actionRequests) {
isAddHocRoute = actionRequest.getActionTaken() == null && StringUtils.startsWith(actionRequest.getAnnotation(), "Ad Hoc Routed by") && StringUtils.equals(actionRequest.getPrincipalId(), currentUser.getPrincipalId());
if (isAddHocRoute) {
return false;
}
}
} else {
return false;
}
// 2. Check that the document is at AccountFullEdit route node
if (accountingDocument.getDocumentHeader() != null && accountingDocument.getDocumentHeader().getWorkflowDocument() != null) {
if (currentNodes != null && currentNodes.contains(RouteLevelNames.ACCOUNT_REVIEW_FULL_EDIT)) {
// can edit the accounting line
if (getDocumentAuthorizer(accountingDocument).canEdit(accountingDocument, currentUser)) {
// any user that can edit the accounting lines will be able to add/change it to any other account
return true;
}
}
}
return super.determineEditPermissionByFieldName(accountingDocument, accountingLine, fieldName, currentUser, currentNodes);
}
Aggregations