/**
   * 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);
  }
Exemple #2
0
  /**
   * @param args Command line arguments.
   * @throws JMetalException
   * @throws java.io.FileNotFoundException Invoking command: java MOMBIRunner problemName
   *     [referenceFront]
   */
  public static void experiment() {
    ListOrderedMap problemMap = ProblemListUtils.getProblemsMap();

    for (int i = 0; i < problemMap.size(); i++) {
      for (int j = 0; j < 30; j++) {
        singleRun((String) problemMap.get(i), (String) problemMap.getValue(i));
      }
    }

    FileRename.renameFile(
        "G:\\学习资料\\百度云\\ItelliWorkSpace\\J4MOP", "indicators.tsv", "MOMBI2_metrics.tsv");
    FileRename.renameFile("G:\\学习资料\\百度云\\ItelliWorkSpace\\J4MOP", "FUN.tsv", "MOMBI2_FUN.tsv");
    FileRename.renameFile("G:\\学习资料\\百度云\\ItelliWorkSpace\\J4MOP", "VAR.tsv", "MOMBI2_VAR.tsv");
  }
  public int getNumberOfStatusChangeRequired(BulkMoveOperation bulkMoveOperation) {
    int i = 0;
    for (final Object o : bulkEditBeans.values()) {
      BulkEditBean bulkEditBean = (BulkEditBean) o;
      if (bulkEditBean.getTargetPid() != null && !bulkMoveOperation.isStatusValid(bulkEditBean)) {
        i++;
      }
    }

    return i;
  }
  @RequestMapping(
      value = {"VIEW"},
      params = {"action=browseWai"})
  public ModelAndView browseWai(
      RenderRequest request,
      RenderResponse response,
      @RequestParam(required = false) String dir,
      @RequestParam(required = false) String msg) {
    this.init(request);

    String decodedDir = pathEncodingUtils.decodeDir(dir);

    if (!serverAccess.isInitialized(userParameters)) {
      serverAccess.initializeServices(userParameters);
    }

    ModelMap model;
    if (!(dir == null || dir.length() == 0 || decodedDir.equals(JsTreeFile.ROOT_DRIVE))) {
      if (this.serverAccess.formAuthenticationRequired(decodedDir, userParameters)) {
        ListOrderedMap parentPathes = pathEncodingUtils.getParentsEncPathes(decodedDir, null, null);
        // we want to get the (last-1) key of sortedmap "parentPathes"
        String parentDir = (String) parentPathes.get(parentPathes.size() - 2);
        model = new ModelMap("currentDir", dir);
        model.put("parentDir", parentDir);
        model.put(
            "username",
            this.serverAccess.getUserPassword(decodedDir, userParameters).getUsername());
        model.put(
            "password",
            this.serverAccess.getUserPassword(decodedDir, userParameters).getPassword());
        if (msg != null) model.put("msg", msg);
        return new ModelAndView("authenticationForm-portlet-wai", model);
      }
    }

    model = browse(dir);
    FormCommand command = new FormCommand();
    model.put("command", command);
    if (msg != null) model.put("msg", msg);
    return new ModelAndView("view-portlet-wai", model);
  }
  @RequestMapping(
      value = {"VIEW"},
      params = {"action=browseMobile"})
  public ModelAndView browseMobile(
      RenderRequest request, RenderResponse response, @RequestParam String dir) {
    this.init(request);

    final PortletPreferences prefs = request.getPreferences();
    boolean forceMaximized4Mobile =
        "true".equals(prefs.getValue(PREF_FORCE_MAXIMIZED_4_MOBILE, "true"));
    String forceWindowState4Mobile =
        forceMaximized4Mobile
            ? WindowState.MAXIMIZED.toString()
            : request.getWindowState().toString();

    String decodedDir = pathEncodingUtils.decodeDir(dir);

    ModelMap model;
    if (!(dir == null || dir.length() == 0 || decodedDir.equals(JsTreeFile.ROOT_DRIVE))) {
      if (this.serverAccess.formAuthenticationRequired(decodedDir, userParameters)) {
        ListOrderedMap parentPathes = pathEncodingUtils.getParentsEncPathes(decodedDir, null, null);
        // we want to get the (last-1) key of sortedmap "parentPathes"
        String parentDir = (String) parentPathes.get(parentPathes.size() - 2);
        model = new ModelMap("currentDir", dir);
        model.put("parentDir", parentDir);
        model.put(
            "username",
            this.serverAccess.getUserPassword(decodedDir, userParameters).getUsername());
        model.put(
            "password",
            this.serverAccess.getUserPassword(decodedDir, userParameters).getPassword());
        model.put("forceWindowState4Mobile", forceWindowState4Mobile);
        return new ModelAndView("authenticationForm-portlet-mobile", model);
      }
    }
    model = browse(dir);
    model.put("forceWindowState4Mobile", forceWindowState4Mobile);
    return new ModelAndView("view-portlet-mobile", model);
  }
Exemple #6
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);
 }
  @Override
  public void validate(
      final ErrorCollection errors,
      final BulkMoveOperation bulkMoveOperation,
      final ApplicationUser applicationUser) {
    if (!regularIssues.isEmpty() && regularOptions.isEmpty()) {
      errors.addErrorMessage(
          authenticationContext
              .getI18nHelper()
              .getText("admin.errors.bean.issues.affected", "" + regularIssues.size()));
    }

    if (!subTaskIssues.isEmpty() && subTaskOptions.isEmpty()) {
      errors.addErrorMessage(
          authenticationContext
              .getI18nHelper()
              .getText("admin.errors.bean.subtasks.affected", "" + subTaskIssues.size()));
    }

    // Validate permission
    Set entries = bulkEditBeans.entrySet();
    for (final Object entry1 : entries) {
      Map.Entry entry = (Map.Entry) entry1;
      IssueContext issueContext = (IssueContext) entry.getKey();
      BulkEditBean bulkEditBean = (BulkEditBean) entry.getValue();
      if (!bulkMoveOperation.canPerform(bulkEditBean, applicationUser)) {
        errors.addErrorMessage(
            authenticationContext
                .getI18nHelper()
                .getText(
                    "admin.errors.bean.no.permission",
                    issueContext.getProject().getString("name"),
                    issueContext.getIssueTypeObject().getName()));
      }
    }
  }
 /**
  * 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
 }
  /**
   * 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);
    }
  }
Exemple #10
0
 public static String getDataSetByPar(MainTableChart maintablechart, List resoultListchart) {
   // String parm="<chart palette='2' ";
   //		if(maintablechart.getCharttitle()!=null){
   //			parm+="caption='"+maintablechart.getCharttitle()+"'";
   //		}
   //		parm+="baseFontSize='12'  rotateNames='0' slantLabels='1'  shownames='1' showvalues='0' ";
   //		if(maintablechart.getAxisNameX()!=null){
   //			parm+="xAxisName='"+maintablechart.getAxisNameX()+"' ";
   //		}
   //		if(maintablechart.getAxisNameY()!=null){
   //			parm+="yAxisName='"+maintablechart.getAxisNameY()+"' ";
   //		}
   String parm =
       "<chart palette=\"2\" caption=\"\" shownames=\"1\" showvalues=\"0\" numberPrefix=\"\" useRoundEdges=\"1\" legendBorderAlpha=\"0\" >";
   HashMap chartmap = new HashMap();
   List<String> seriesSet = new ArrayList();
   HashSet axisvaXlue = new HashSet();
   for (Object obj : resoultListchart) {
     ListOrderedMap map = (ListOrderedMap) obj;
     String[] seriesNames = maintablechart.getSeriesName().split(",");
     String[] axisvalueYs = maintablechart.getAxisvalueY().split(",");
     for (int i = 0; i < seriesNames.length; i++) {
       Object sn = map.get(seriesNames[i]);
       Object avx = map.get(maintablechart.getAxisvalueX());
       Object avy = map.get(axisvalueYs[i]);
       boolean flag = false;
       for (String se : seriesSet) {
         if (se.equals(sn.toString())) {
           flag = true;
         }
       }
       if (flag == false) {
         seriesSet.add(sn.toString());
       }
       if (avx == null) {
         avx = "其他";
       }
       axisvaXlue.add(avx);
       Double avyold = 0d;
       if (chartmap.get(sn + "" + avx) != null) {
         avyold =
             Double.parseDouble(chartmap.get(sn + "" + avx).toString())
                 + Double.parseDouble(avy.toString());
         chartmap.put(sn + "" + avx, avyold.toString());
       } else {
         chartmap.put(sn + "" + avx, avy == null ? 0 : avy.toString());
       }
     }
   }
   List alist = new ArrayList();
   for (Object ob : axisvaXlue) {
     alist.add(ob);
   }
   Collections.sort(alist);
   String categories = "<categories>";
   for (Object ob : alist) {
     categories = categories + "<category label='" + ob.toString() + "' />";
   }
   categories += "</categories>";
   String dataset = "";
   int i = 0;
   for (Object obj : seriesSet) {
     String colors = "";
     if (obj.toString().equals("紧�??")) {
       colors = "DC143C";
     } else if (obj.toString().equals("主要")) {
       colors = "FF6347";
     } else if (obj.toString().equals("次要")) {
       colors = "FFFF00";
     } else if (obj.toString().equals("�?�?")) {
       colors = "00FFFF";
     } else {
       colors = ColorUtil.getColor().get(i).toString();
     }
     dataset =
         dataset
             + "<dataset  lineThickness='3' seriesName='"
             + obj
             + "' color='"
             + colors
             + "' showValues='0'  parentYAxis='S' >";
     i++;
     for (Object ob : alist) {
       dataset +=
           "<set  value='"
               + (chartmap.get(obj + "" + ob) == null ? 0 : chartmap.get(obj + "" + ob))
               + "'  />";
     }
     dataset += "</dataset>";
   }
   parm += categories + dataset + "</chart>";
   return parm;
 }
 /* (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));
 }
Exemple #12
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]);
    }
  }
}