/**
  * Create an attribute map as needed by HtmlElement. This is just used by the element factories.
  *
  * @param attributeCount the initial number of attributes to be added to the map
  * @return the attribute map
  */
 @SuppressWarnings("unchecked")
 static Map<String, XmlAttr> createAttributeMap(final int attributeCount) {
   return ListOrderedMap.decorate(new HashMap(attributeCount)); // preserve insertion order
 }
 /* (non-Javadoc)
  * @see org.jasig.services.persondir.support.BasePersonImpl#createImmutableAttributeMap(int)
  */
 @SuppressWarnings("unchecked")
 @Override
 protected Map<String, List<Object>> createImmutableAttributeMap(int size) {
   return ListOrderedMap.decorate(new CaseInsensitiveMap(size > 0 ? size : 1));
 }
  /**
   * 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);
    }
  }
Example #4
0
public class Table {
  private boolean colTable;
  private String name;
  private String key;
  private String col;
  private String row;
  private Map cellMap = ListOrderedMap.decorate(new HashMap());

  public Table() {}

  public Table(String name, String key, String col, String row) {
    this.name = name;
    this.key = key;
    this.col = col;
    this.row = row;
  }

  public boolean isColTable() {
    return colTable;
  }

  public void setTypeColTable() {
    colTable = true;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getKey() {
    return key;
  }

  public void setKey(String key) {
    this.key = key;
  }

  public String getCol() {
    return col;
  }

  public void setCol(String col) {
    this.col = col;
  }

  public String getRow() {
    return row;
  }

  public void setRow(String row) {
    this.row = row;
  }

  public void addCell(Cell cell) {
    cellMap.put(cell.getName(), cell);
  }

  public Iterator cellIterator() {
    return cellMap.values().iterator();
  }

  public List getCellList() {
    return new ArrayList(cellMap.values());
  }

  public void setCells(Cell[] cells) {
    if (cells == null) {
      // FIXME
      return;
    }
    for (int i = 0; i < cells.length; i++) {
      addCell(cells[i]);
    }
  }
}