@Override public List<String> buildListForFYI(AwardDocument awardDocument) throws WorkflowException { WorkflowDocument document = awardDocument.getDocumentHeader().getWorkflowDocument(); RoutingReportCriteria reportCriteria = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId()).build(); // gather the IDs for action requests that predate the simulation DocumentRouteHeaderValue routeHeader = KEWServiceLocator.getRouteHeaderService().getRouteHeader(document.getDocumentId()); Set<String> preexistingActionRequestIds = getActionRequestIds(routeHeader); // run the simulation via WorkflowUtility DocumentDetail documentDetail = workflowUtility.executeSimulation(reportCriteria); // fabricate our ActionRequestValueS from the results List<ActionRequestValue> actionRequests = reconstituteActionRequestValues(documentDetail, preexistingActionRequestIds); List<String> actionIds = new ArrayList<String>(); for (ActionRequestValue request : actionRequests) { if (request.isGroupRequest()) { actionIds.addAll( KimApiServiceLocator.getGroupService().getMemberPrincipalIds(request.getGroupId())); } if (request.isUserRequest()) { actionIds.add(request.getPrincipalId()); } } return actionIds; }
/** This method converts everything except for the parent and child requests */ private static void populateActionRequest( ActionRequestValue actionRequestBo, ActionRequest actionRequest, RouteNodeInstanceLoader routeNodeInstanceLoader) { actionRequestBo.setActionRequested(actionRequest.getActionRequested().getCode()); if (!StringUtils.isBlank(actionRequest.getId())) { actionRequestBo.setActionRequestId(actionRequest.getId()); } if (actionRequest.getActionTaken() != null) { // actionRequestBo.setActionTaken(ActionTakenValue.from(actionRequest.getActionTaken())); if (!StringUtils.isBlank(actionRequest.getActionTaken().getId())) { actionRequestBo.setActionTaken( KEWServiceLocator.getActionTakenService() .findByActionTakenId(actionRequest.getActionTaken().getId())); } } actionRequestBo.setAnnotation(actionRequest.getAnnotation()); if (actionRequest.getRequestPolicy() != null) { actionRequestBo.setApprovePolicy(actionRequest.getRequestPolicy().getCode()); } actionRequestBo.setCreateDate(new Timestamp(actionRequest.getDateCreated().getMillis())); actionRequestBo.setCurrentIndicator(actionRequest.isCurrent()); if (actionRequest.getDelegationType() != null) { actionRequestBo.setDelegationType(actionRequest.getDelegationType()); } // actionRequestBo.setDocVersion(actionRequest.?); actionRequestBo.setForceAction(actionRequest.isForceAction()); actionRequestBo.setPriority(actionRequest.getPriority()); actionRequestBo.setRouteLevel(actionRequest.getRouteLevel()); actionRequestBo.setQualifiedRoleName(actionRequest.getQualifiedRoleName()); actionRequestBo.setQualifiedRoleNameLabel(actionRequest.getQualifiedRoleNameLabel()); actionRequestBo.setRecipientTypeCd(actionRequest.getRecipientType().getCode()); actionRequestBo.setResponsibilityDesc(actionRequest.getResponsibilityDescription()); if (!StringUtils.isBlank(actionRequest.getResponsibilityId())) { actionRequestBo.setResponsibilityId(actionRequest.getResponsibilityId()); } actionRequestBo.setRoleName(actionRequest.getRoleName()); String documentId = actionRequest.getDocumentId(); if (documentId != null) { actionRequestBo.setDocumentId(documentId); actionRequestBo.setRouteHeader( KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId)); } actionRequestBo.setStatus(actionRequest.getStatus().getCode()); actionRequestBo.setPrincipalId(actionRequest.getPrincipalId()); actionRequestBo.setGroupId(actionRequest.getGroupId()); if (routeNodeInstanceLoader != null && !StringUtils.isBlank(actionRequest.getRouteNodeInstanceId())) { actionRequestBo.setNodeInstance( routeNodeInstanceLoader.load(actionRequest.getRouteNodeInstanceId())); } }
public String getRouteLevelName() { // this is for backward compatibility of requests which have not been converted if (CompatUtils.isRouteLevelRequest(this)) { int routeLevelInt = getRouteLevel(); if (routeLevelInt == KewApiConstants.EXCEPTION_ROUTE_LEVEL) { return "Exception"; } List<RouteNode> routeLevelNodes = CompatUtils.getRouteLevelCompatibleNodeList( KEWServiceLocator.getRouteHeaderService() .getRouteHeader(documentId) .getDocumentType()); if (!(routeLevelInt < routeLevelNodes.size())) { return "Not Found"; } return ((RouteNode) routeLevelNodes.get(routeLevelInt)).getRouteNodeName(); } else { return (nodeInstance == null ? "Exception" : nodeInstance.getName()); } }
public DocumentRouteHeaderValue getRouteHeader() { if (this.routeHeader == null && this.documentId != null) { this.routeHeader = KEWServiceLocator.getRouteHeaderService().getRouteHeader(this.documentId); } return this.routeHeader; }