コード例 #1
0
  private String getMaxLinks(ConditionDescriptor descriptor) {
    String stringMaxLinks = (String) descriptor.getArgs().get("maxLinks");
    Integer maxLinks;
    try {
      maxLinks = Integer.valueOf(stringMaxLinks);
    } catch (NumberFormatException e) {
      maxLinks = Integer.valueOf(100);
    }

    return maxLinks.toString();
  }
コード例 #2
0
  private Collection<String> getSelectedStatusesIds(ConditionDescriptor descriptor) {
    Collection selectedStatusesIds = new LinkedList();

    String statuses = (String) descriptor.getArgs().get("statuses");
    StringTokenizer st = new StringTokenizer(statuses, ",");

    while (st.hasMoreTokens()) {
      selectedStatusesIds.add(st.nextToken());
    }

    return selectedStatusesIds;
  }
コード例 #3
0
  private Collection<Long> getSelectedLinkTypesIds(ConditionDescriptor descriptor, String param) {
    Collection selectedIssueLinkTypesIds = new LinkedList();

    String issueLinkTypes = (String) descriptor.getArgs().get(param);
    StringTokenizer st = new StringTokenizer(issueLinkTypes, ",");

    while (st.hasMoreTokens()) {
      selectedIssueLinkTypesIds.add(Long.valueOf(st.nextToken()));
    }

    return selectedIssueLinkTypesIds;
  }
  /* (non-Javadoc)
   * @see com.googlecode.jsu.workflow.AbstractWorkflowPluginFactory#getVelocityParamsForView(java.util.Map, com.opensymphony.workflow.loader.AbstractDescriptor)
   */
  protected void getVelocityParamsForView(
      Map<String, Object> velocityParams, AbstractDescriptor descriptor) {
    ConditionDescriptor conditionDescriptor = (ConditionDescriptor) descriptor;
    Map args = conditionDescriptor.getArgs();

    String sField = (String) args.get("fieldsList");

    Field field = null;

    try {
      field = workflowUtils.getFieldFromKey(sField);
    } catch (Exception e) {
    }

    if (field != null) {
      velocityParams.put("val-fieldSelected", field);
    } else {
      velocityParams.put("val-errorMessage", "Unable to find field '" + sField + "'");
    }

    boolean allowUserInField = getAllowUserInField(args);

    velocityParams.put("allowUserInField-selected", allowUserInField);
  }
コード例 #5
0
  protected void getVelocityParamsForView(
      Map<String, Object> velocityParams, AbstractDescriptor abstractDescriptor) {
    if (!(abstractDescriptor instanceof ConditionDescriptor)) {
      throw new IllegalArgumentException("Descriptor must be a ConditionDescriptor.");
    }

    ConditionDescriptor descriptor = (ConditionDescriptor) abstractDescriptor;

    Collection<Long> selectedInwardLinkTypesIds =
        getSelectedLinkTypesIds(descriptor, "inwardIssueLinkTypes");
    Collection<Long> selectedOutwardLinkTypesIds =
        getSelectedLinkTypesIds(descriptor, "outwardIssueLinkTypes");
    Collection<String> selectedIssueTypesIds = getSelectedIssueTypesIds(descriptor);
    Collection<String> selectedStatusesIds = getSelectedStatusesIds(descriptor);

    List<IssueLinkType> selectedInwardIssueLinkTypes = new LinkedList<IssueLinkType>();
    List<IssueLinkType> selectedOutwardIssueLinkTypes = new LinkedList<IssueLinkType>();
    List<IssueType> selectedIssueTypes = new LinkedList<IssueType>();
    List<Status> selectedStatuses = new LinkedList<Status>();

    for (Long issueLinkTypeId : selectedInwardLinkTypesIds) {
      selectedInwardIssueLinkTypes.add(this.issueLinkTypeManager.getIssueLinkType(issueLinkTypeId));
    }

    for (Long issueLinkTypeId : selectedOutwardLinkTypesIds) {
      selectedOutwardIssueLinkTypes.add(
          this.issueLinkTypeManager.getIssueLinkType(issueLinkTypeId));
    }

    for (String issueTypeId : selectedIssueTypesIds) {
      selectedIssueTypes.add(this.constantsManager.getIssueTypeObject(issueTypeId));
    }

    for (String statusId : selectedStatusesIds) {
      selectedStatuses.add(this.constantsManager.getStatusObject(statusId));
    }

    String projectKeys = (String) descriptor.getArgs().get("projectKeys");

    if (projectKeys == null) {
      projectKeys = "";
    }

    String ignoreOtherProjects = (String) descriptor.getArgs().get("ignoreOtherProjects");

    if (ignoreOtherProjects == null) {
      ignoreOtherProjects = "false";
    }

    velocityParams.put(
        "selectedIssueTypes", Collections.unmodifiableCollection(selectedIssueTypes));
    velocityParams.put(
        "selectedInwardIssueLinkTypes",
        Collections.unmodifiableCollection(selectedInwardIssueLinkTypes));
    velocityParams.put(
        "selectedOutwardIssueLinkTypes",
        Collections.unmodifiableCollection(selectedOutwardIssueLinkTypes));
    velocityParams.put("selectedStatuses", Collections.unmodifiableCollection(selectedStatuses));
    velocityParams.put("projectCondition", descriptor.getArgs().get("projectCondition"));
    velocityParams.put("projectKeys", projectKeys);
    velocityParams.put(
        "projectKeysWithReplacedNames",
        LinkConditionUtil.replaceCustomFieldIdsWithNames(projectKeys));
    velocityParams.put("minLinks", getMinLinks(descriptor));
    velocityParams.put("maxLinks", getMaxLinks(descriptor));
    velocityParams.put("ignoreOtherProjects", ignoreOtherProjects);
    velocityParams.put(
        "restOfLinkTypesAreAllowed", descriptor.getArgs().get("restOfLinkTypesAreAllowed"));
    velocityParams.put(
        "restOfIssueTypesAreAllowed", descriptor.getArgs().get("restOfIssueTypesAreAllowed"));
    velocityParams.put(
        "restOfStatusesAreAllowed", descriptor.getArgs().get("restOfStatusesAreAllowed"));
  }