Ejemplo n.º 1
0
  private static ActionRequest.Builder createActionRequestBuilder(
      ActionRequestValue actionRequestBo) {
    ActionRequest.Builder builder =
        ActionRequest.Builder.create(
            actionRequestBo.getActionRequestId(),
            ActionRequestType.fromCode(actionRequestBo.getActionRequested()),
            ActionRequestStatus.fromCode(actionRequestBo.getStatus()),
            actionRequestBo.getResponsibilityId(),
            actionRequestBo.getDocumentId(),
            RecipientType.fromCode(actionRequestBo.getRecipientTypeCd()));
    if (actionRequestBo.getActionTaken() != null) {
      builder.setActionTaken(
          ActionTaken.Builder.create(ActionTakenValue.to(actionRequestBo.getActionTaken())));
    }
    builder.setAnnotation(actionRequestBo.getAnnotation());
    builder.setCurrent(actionRequestBo.getCurrentIndicator().booleanValue());
    builder.setDateCreated(new DateTime(actionRequestBo.getCreateDate().getTime()));
    if (actionRequestBo.getDelegationType() != null) {
      builder.setDelegationType(actionRequestBo.getDelegationType());
    }
    builder.setForceAction(actionRequestBo.getForceAction().booleanValue());
    builder.setGroupId(actionRequestBo.getGroupId());
    builder.setNodeName(actionRequestBo.getPotentialNodeName());
    if (actionRequestBo.getParentActionRequestId() != null) {
      builder.setParentActionRequestId(actionRequestBo.getParentActionRequestId());
    }
    builder.setPrincipalId(actionRequestBo.getPrincipalId());
    if (actionRequestBo.getPriority() == null) {
      builder.setPriority(KewApiConstants.ACTION_REQUEST_DEFAULT_PRIORITY);
    } else {
      builder.setPriority(actionRequestBo.getPriority().intValue());
    }
    if (actionRequestBo.getRouteLevel() == null) {
      builder.setRouteLevel(0);
    } else {
      builder.setRouteLevel(actionRequestBo.getRouteLevel().intValue());
    }
    builder.setQualifiedRoleName(actionRequestBo.getQualifiedRoleName());
    builder.setQualifiedRoleNameLabel(actionRequestBo.getQualifiedRoleNameLabel());
    builder.setRequestLabel(actionRequestBo.getRequestLabel());
    if (!StringUtils.isBlank(actionRequestBo.getApprovePolicy())) {
      builder.setRequestPolicy(ActionRequestPolicy.fromCode(actionRequestBo.getApprovePolicy()));
    }
    builder.setResponsibilityDescription(actionRequestBo.getResponsibilityDesc());
    builder.setRoleName(actionRequestBo.getRoleName());
    if (actionRequestBo.getNodeInstance() != null) {
      builder.setRouteNodeInstanceId(actionRequestBo.getNodeInstance().getRouteNodeInstanceId());
    }

    List<ActionRequest.Builder> childRequests = new ArrayList<ActionRequest.Builder>();
    if (actionRequestBo.getChildrenRequests() != null) {
      for (ActionRequestValue childActionRequestBo : actionRequestBo.getChildrenRequests()) {
        childRequests.add(createActionRequestBuilder(childActionRequestBo));
      }
    }
    builder.setChildRequests(childRequests);
    return builder;
  }
Ejemplo n.º 2
0
 public String getRecipientTypeLabel() {
   return RecipientType.fromCode(getRecipientTypeCd()).getLabel();
 }