Exemplo n.º 1
0
  /**
   * This method will remap the current {@link BulkEditBean} Map to be keyed by the <em>target</em>
   * {@link IssueContext} rather than the originating {@link IssueContext}.
   */
  public void remapBulkEditBeansByTargetContext() {
    Map bulkEditBeans = getBulkEditBeans();
    ListOrderedMap targetKeyedBulkEditBeans = new ListOrderedMap();
    Set entries = bulkEditBeans.entrySet();
    for (final Object entry1 : entries) {
      Map.Entry entry = (Map.Entry) entry1;
      BulkEditBean bulkEditBean = (BulkEditBean) entry.getValue();

      // Build Target Issue contexts
      IssueContext targetIssueContext =
          new IssueContextImpl(
              bulkEditBean.getTargetProject(), bulkEditBean.getTargetIssueTypeObject());

      if (targetKeyedBulkEditBeans.containsKey(targetIssueContext)) {
        // Add to to the bulk edit bean
        BulkEditBean finalBulkEditBean =
            (BulkEditBean) targetKeyedBulkEditBeans.get(targetIssueContext);
        // We add the top-level issues now. Affected subtasks will be calculated later
        // by calling BulkMoveOperation().finishChooseContext()
        finalBulkEditBean.addIssues(bulkEditBean.getSelectedIssues());
      } else {
        targetKeyedBulkEditBeans.put(targetIssueContext, bulkEditBean);
      }
    }

    // Set the BulkEditBean Map to our new map (keyed by Target Context)
    setBulkEditBeans(targetKeyedBulkEditBeans);
  }
Exemplo n.º 2
0
 static {
   REQUEST_METHOD_MAP.put("GET", REQUEST_METHOD_GET);
   REQUEST_METHOD_MAP.put("POST", REQUEST_METHOD_POST);
   REQUEST_METHOD_MAP.put("PUT", REQUEST_METHOD_PUT);
   REQUEST_METHOD_MAP.put("DELETE", REQUEST_METHOD_DELETE);
   REQUEST_METHOD_MAP.put("OPTIONS", REQUEST_METHOD_OPTIONS);
   REQUEST_METHOD_MAP.put("HEAD", REQUEST_METHOD_HEAD);
 }
Exemplo n.º 3
0
  /**
   * Initialises this MultiBulkMoveBean given a list of issues.
   *
   * <p>If this MultiBulkMoveBean links a BulkEditBean with parent issues to BulkEditBeans with
   * subtasks, then include the parent BulkEditBean in the parentBulkEditBean parameter. Otherwise
   * you can pass null.
   *
   * @param issues Issues for this MultiBulkMoveBean.
   * @param parentBulkEditBean If this MultiBulkMoveBean represents subtasks, then this is the
   *     BulkEditBean that contains the parents of the subtasks, otherwise null.
   */
  public void initFromIssues(List issues, BulkEditBean parentBulkEditBean) {
    // Ensure that the order is kept
    issuesInContext = (ListOrderedMap) ListOrderedMap.decorate(new MultiHashMap());
    regularIssues = new ListOrderedMap();
    subTaskIssues = new ArrayList<Issue>();

    // First pass stores att the
    for (final Object issue2 : issues) {
      MutableIssue issue = (MutableIssue) issue2;
      if (!issue.isSubTask()) {
        regularIssues.put(issue.getId(), issue);
      } else {
        subTaskIssues.add(issue);
      }
    }

    // Split it up by context, also check special rule that you can't move sub tasks & its parent
    // all in the same go
    for (final Object issue1 : issues) {
      MutableIssue issue = (MutableIssue) issue1;
      // NOTE: we only do this for the bulk move operation, this is likely the correct behavior for
      // the
      // bulk move operation but I am certain that it is not correct for the bulk migrate operation
      // JRA-10244.
      // In bulk move the wizard will prompt the user with subtask information once it has collected
      // the project
      // information about the parent issues, this is not need in the the issue type scheme
      // migration since you
      // will never be changing the project
      // TODO: Why test for operation name?
      if (BulkMigrateOperation.OPERATION_NAME.equals(operationName)
          && issue.isSubTask()
          && regularIssues.containsKey(issue.getParentId())) {
        log.info(
            "Sub issue: "
                + issue.getKey()
                + " : discarded since parent was also present in the bulk move");
        subTasksDiscarded++;
      } else {
        issuesInContext.put(
            new IssueContextImpl(issue.getProjectObject(), issue.getIssueTypeObject()), issue);
      }
    }

    // Set the bulk edit bean.. sort the keys by project
    bulkEditBeans = new ListOrderedMap();
    List keys = new ArrayList(issuesInContext.keySet());
    Collections.sort(keys);

    for (final Object key : keys) {
      IssueContext context = (IssueContext) key;
      Collection issuesForContext = (Collection) issuesInContext.get(context);

      BulkEditBean bulkEditBean = new BulkEditBeanImpl(issueManager);
      bulkEditBean.initSelectedIssues(issuesForContext);
      bulkEditBean.setOperationName(operationName);
      bulkEditBean.setTargetProject(context.getProjectObject());
      bulkEditBean.setTargetIssueTypeId(
          context.getIssueTypeObject() != null ? context.getIssueTypeObject().getId() : null);
      // Set the Parent BulkEditBean - used by subtask BulkEditBean's to get to the new version of
      // the subtask's parents.
      bulkEditBean.setParentBulkEditBean(parentBulkEditBean);

      bulkEditBeans.put(context, bulkEditBean);
    }
  }