Пример #1
0
 public void setPoIdLink(String poDocNumber) {
   String documentTypeName = PurapConstants.PurchaseOrderDocTypes.PURCHASE_ORDER_DOCUMENT;
   DocumentType docType =
       KewApiServiceLocator.getDocumentTypeService().getDocumentTypeByName(documentTypeName);
   String docHandlerUrl = docType.getResolvedDocumentHandlerUrl();
   int endSubString = docHandlerUrl.lastIndexOf("/");
   String serverName = docHandlerUrl.substring(0, endSubString);
   String handler = docHandlerUrl.substring(endSubString + 1, docHandlerUrl.lastIndexOf("?"));
   this.poIdLink =
       serverName
           + "/"
           + KRADConstants.PORTAL_ACTION
           + "?channelTitle="
           + docType.getName()
           + "&channelUrl="
           + handler
           + "?"
           + KRADConstants.DISPATCH_REQUEST_PARAMETER
           + "="
           + KRADConstants.DOC_HANDLER_METHOD
           + "&"
           + KRADConstants.PARAMETER_DOC_ID
           + "="
           + poDocNumber
           + "&"
           + KRADConstants.PARAMETER_COMMAND
           + "="
           + KewApiConstants.DOCSEARCH_COMMAND;
 }
 /**
  * Evaluates a named rule
  *
  * @param name the rule name
  * @return the RuleExpressionResult
  * @throws WorkflowException
  */
 public RuleExpressionResult invokeRule(String name) throws WorkflowException {
   org.kuali.rice.kew.api.rule.Rule rbv =
       KewApiServiceLocator.getRuleService().getRuleByName(name);
   if (rbv == null)
     throw new WorkflowRuntimeException("Could not find rule named \"" + name + "\"");
   Rule r = new RuleImpl(rbv);
   return r.evaluate(r, context);
 }
Пример #3
0
  /** Invoked to rebuild the type attribute bos and attributes value map based on the type id */
  public void rebuildTypeAttributes() {
    this.attributeBos = new ArrayList<PeopleFlowAttributeBo>();
    this.attributeValues = new HashMap<String, String>();

    KewTypeDefinition typeDefinition =
        KewApiServiceLocator.getKewTypeRepositoryService().getTypeById(this.typeId);
    if ((typeDefinition.getAttributes() != null) && !typeDefinition.getAttributes().isEmpty()) {
      List<KewTypeAttribute> typeAttributes =
          new ArrayList<KewTypeAttribute>(typeDefinition.getAttributes());

      List<String> sortAttributes = new ArrayList<String>();
      sortAttributes.add(KEWPropertyConstants.SEQUENCE_NUMBER);
      Collections.sort(typeAttributes, new BeanPropertyComparator(sortAttributes));

      for (KewTypeAttribute typeAttribute : typeAttributes) {
        PeopleFlowAttributeBo attributeBo =
            PeopleFlowAttributeBo.from(typeAttribute.getAttributeDefinition(), null, this, null);
        this.attributeBos.add(attributeBo);
        this.attributeValues.put(typeAttribute.getAttributeDefinition().getName(), "");
      }
    }
  }
Пример #4
0
 protected WorkflowDocumentActionsService getWorkflowDocumentActionsService() {
   if (workflowDocumentActionsService == null) {
     workflowDocumentActionsService = KewApiServiceLocator.getWorkflowDocumentActionsService();
   }
   return workflowDocumentActionsService;
 }
 public DocumentTypeService getDocumentTypeService() {
   if (documentTypeService == null) {
     documentTypeService = KewApiServiceLocator.getDocumentTypeService();
   }
   return documentTypeService;
 }
  public void recordAction() throws InvalidActionTakenException {
    MDC.put("docId", getRouteHeader().getDocumentId());
    updateSearchableAttributesIfPossible();
    LOG.debug(
        "Moving document "
            + getRouteHeader().getDocumentId()
            + " to point: "
            + displayMovePoint(movePoint)
            + ", annotation: "
            + annotation);

    List actionRequests =
        getActionRequestService()
            .findAllValidRequests(
                getPrincipal().getPrincipalId(),
                getDocumentId(),
                KewApiConstants.ACTION_REQUEST_COMPLETE_REQ);
    Collection activeNodes =
        KEWServiceLocator.getRouteNodeService()
            .getActiveNodeInstances(getRouteHeader().getDocumentId());
    String errorMessage = validateActionRules(actionRequests, activeNodes);
    if (!org.apache.commons.lang.StringUtils.isEmpty(errorMessage)) {
      throw new InvalidActionTakenException(errorMessage);
    }

    RouteNodeInstance startNodeInstance = determineStartNode(activeNodes, movePoint);

    LOG.debug("Record the move action");
    Recipient delegator = findDelegatorForActionRequests(actionRequests);
    ActionTakenValue actionTaken = saveActionTaken(delegator);
    getActionRequestService().deactivateRequests(actionTaken, actionRequests);
    notifyActionTaken(actionTaken);

    // TODO this whole bit is a bit hacky at the moment
    if (movePoint.getStepsToMove() > 0) {
      Set<String> targetNodeNames = new HashSet<String>();
      targetNodeNames.add(determineFutureNodeName(startNodeInstance, movePoint));

      final boolean shouldIndex =
          getRouteHeader().getDocumentType().hasSearchableAttributes()
              && RouteContext.getCurrentRouteContext().isSearchIndexingRequestedForContext();
      String applicationId = routeHeader.getDocumentType().getApplicationId();
      DocumentOrchestrationQueue orchestrationQueue =
          KewApiServiceLocator.getDocumentOrchestrationQueue(
              routeHeader.getDocumentId(), applicationId);
      org.kuali.rice.kew.api.document.OrchestrationConfig orchestrationConfig =
          org.kuali.rice.kew.api.document.OrchestrationConfig.create(
              actionTaken.getActionTakenId(), targetNodeNames);
      DocumentProcessingOptions options =
          DocumentProcessingOptions.create(true, shouldIndex, false);
      orchestrationQueue.orchestrateDocument(
          routeHeader.getDocumentId(),
          getPrincipal().getPrincipalId(),
          orchestrationConfig,
          options);
    } else {
      String targetNodeName = determineReturnNodeName(startNodeInstance, movePoint);
      ReturnToPreviousNodeAction returnAction =
          new ReturnToPreviousNodeAction(
              KewApiConstants.ACTION_TAKEN_MOVE_CD,
              getRouteHeader(),
              getPrincipal(),
              annotation,
              targetNodeName,
              false);

      returnAction.recordAction();
    }
  }