Ejemplo n.º 1
0
 /**
  * Gets the group params.
  *
  * <p>We need to specifically make sure that each group parameter has an Id because of an
  * underlying bug somewhere else.
  *
  * @param inputs the inputs
  * @return the group params
  */
 private GroupParameter[] getGroupParams(Object[][] inputs) {
   for (Object[] list : inputs) {
     if (list instanceof GroupParameter[]) {
       List<GroupParameter> arr = new ArrayList<GroupParameter>();
       for (int i = 0; i < list.length; i++) {
         GroupParameter groupParam = (GroupParameter) list[i];
         if (groupParam.getId() != null) arr.add(groupParam);
       }
       return arr.toArray(new GroupParameter[] {});
     }
   }
   return null;
 }
Ejemplo n.º 2
0
 public List<TableElement> getParameters(JobFilter jobFilter, Object[]... inputs) {
   List<TableElement> tableElements = new ArrayList<TableElement>();
   UnittypeParameter[] params = getUnittypeParams(inputs);
   UnitParameter[] uParams = getUnitParams(inputs);
   UnitParameter[] uSessionParams = getUnitSessionParams(inputs);
   ProfileParameter[] pParams = getProfileParams(inputs);
   GroupParameter[] gParams = getGroupParams(inputs);
   JobParameter[] jParams = getJobParams(inputs);
   for (int i = 0; i < params.length; i++) {
     if (parameterShouldNotBeListed(jobFilter, params, i)) continue;
     String param = params[i].getName();
     String[] names = param.split("\\.");
     String id = "";
     Integer tab = WebConstants.PARAMETERS_START_INDENTATION;
     for (int j = 0; j < names.length; j++) {
       UnittypeParameter utp = (j == (names.length - 1) ? params[i] : null);
       String name = names[j];
       if (id.length() > 0) id += ".";
       id += name;
       if (tableElements.size() > 0) {
         List<TableElement> copy = new ArrayList<TableElement>();
         copy.addAll(tableElements);
         boolean isThere = false;
         for (TableElement element : copy) {
           if (element.getName().equals(id)) {
             isThere = true;
             break;
           }
         }
         if (!isThere) tableElements.add(new TableElement(id, tab, utp));
       } else tableElements.add(new TableElement(id, tab, utp));
       tab += WebConstants.PARAMETERS_NEXT_INDENTATION;
     }
   }
   Collections.sort(tableElements, new TableElementComparator());
   if (pParams != null) {
     for (ProfileParameter pParam : pParams) {
       for (TableElement te : tableElements) {
         if (te.getUnittypeParameter() == pParam.getUnittypeParameter()) {
           te.setProfileParameter(pParam);
           break;
         }
       }
     }
   }
   if (uParams != null) {
     for (UnitParameter uParam : uParams) {
       for (TableElement te : tableElements) {
         if (te.getUnittypeParameter() == uParam.getParameter().getUnittypeParameter()) {
           te.setUnitParameter(uParam);
           break;
         }
       }
     }
   }
   if (uSessionParams != null) {
     for (UnitParameter uSessionParam : uSessionParams) {
       for (TableElement te : tableElements) {
         if (te.getUnittypeParameter() == uSessionParam.getParameter().getUnittypeParameter()) {
           te.setUnitSessionParameter(uSessionParam);
           break;
         }
       }
     }
   }
   if (gParams != null) {
     for (GroupParameter gParam : gParams) {
       for (TableElement te : tableElements) {
         if (te.getUnittypeParameter() != null
             && te.getUnittypeParameter().equals(gParam.getParameter().getUnittypeParameter())
             && gParam.getId() != null) te.addGroupParameter(gParam);
       }
     }
   }
   if (jParams != null) {
     for (JobParameter jParam : jParams) {
       for (TableElement te : tableElements) {
         if (te.getUnittypeParameter() != null
             && te.getUnittypeParameter().equals(jParam.getParameter().getUnittypeParameter())) {
           te.setJobParameter(jParam);
           break;
         }
       }
     }
   }
   return tableElements;
 }