Пример #1
0
 private static ActionRequestValue convertActionRequest(
     ActionRequest actionRequest,
     ActionRequestValue parentActionRequestBo,
     RouteNodeInstanceLoader routeNodeInstanceLoader) {
   if (actionRequest == null) {
     return null;
   }
   ActionRequestValue actionRequestBo = new ActionRequestFactory().createBlankActionRequest();
   populateActionRequest(actionRequestBo, actionRequest, routeNodeInstanceLoader);
   if (parentActionRequestBo != null) {
     actionRequestBo.setParentActionRequest(parentActionRequestBo);
   }
   if (actionRequest.getChildRequests() != null) {
     for (ActionRequest childRequest : actionRequest.getChildRequests()) {
       actionRequestBo
           .getChildrenRequests()
           .add(
               ActionRequestValue.convertActionRequest(
                   childRequest, actionRequestBo, routeNodeInstanceLoader));
     }
   }
   return actionRequestBo;
 }
Пример #2
0
  /** 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()));
    }
  }