コード例 #1
0
  private List<IssueService.TransitionValidationResult> getSimpleTransitionResults(
      User user, Issue issue, Status to, MultiMap<String, Object, ? extends List> params) {
    List<IssueService.TransitionValidationResult> result =
        new ArrayList<IssueService.TransitionValidationResult>();
    Map<String, Object> simpleParams = getSimpleMap(params);
    Set<Integer> nextStatusActionIds = getNextStatusActionIds(issue, to);
    if (nextStatusActionIds.size() == 0)
      throw new IllegalArgumentException(
          "to status is not valid for issue : " + issue.getKey() + " and status : " + to.getName());
    if (nextStatusActionIds.size() > 1)
      log.warn(
          "found more than one actions for next status transition : "
              + issue.getKey()
              + " and status : "
              + to.getName());
    for (Integer actionId : nextStatusActionIds) {
      IssueInputParameters issueInputParameters = newIssueInputParameters(simpleParams);
      issueInputParameters.setSkipScreenCheck(true);
      log.debug(
          "traveling to status : "
              + to.getName()
              + " with action id : "
              + actionId
              + "; user : "******" ; issueInputParameters : "
              + issueInputParameters
              + " : "
              + to.getId()
              + " and logged in user : "******"validation result status : "
              + transitionValidationResult.getIssue().getStatusObject().getName()
              + " and action id : "
              + transitionValidationResult.getActionId());
      result.add(transitionValidationResult);
    }
    return result;
  }
コード例 #2
0
  protected void doValidation() {
    try {
      // just checking that the issue exists and that the user has permission to see it.
      getIssue();
    } catch (IssuePermissionException ipe) {
      return;
    } catch (IssueNotFoundException infe) {
      return;
    }

    final IssueInputParameters issueInputParameters =
        new IssueInputParametersImpl(ActionContext.getParameters());
    issueInputParameters.setRetainExistingValuesWhenParameterNotProvided(false);
    transitionResult =
        issueService.validateTransition(
            getRemoteUser(), getIssueObject().getId(), action, issueInputParameters);
    setFieldValuesHolder(transitionResult.getFieldValuesHolder());
    if (!transitionResult.isValid()) {
      addErrorCollection(transitionResult.getErrorCollection());
    }
  }