/**
  * load project settings to no-opened process
  *
  * @param elemParam
  * @param projectPaType
  */
 public static void loadElementParameters(
     ParametersType processType, ParametersType projectPaType, EParameterName paramName) {
   EList listParamType = projectPaType.getElementParameter();
   for (int j = 0; j < listParamType.size(); j++) {
     ElementParameterType pType = (ElementParameterType) listParamType.get(j);
     EList processParameters = processType.getElementParameter();
     ElementParameterType processParam = null;
     for (int i = 0; i < processParameters.size(); i++) {
       ElementParameterType paramType = (ElementParameterType) processParameters.get(i);
       if (paramType.getName().equals(pType.getName())
           && paramType.getField() != null
           && paramType.getField().equals(pType.getField())) {
         processParam = paramType;
       } else if (pType.getName().contains(":")) {
         StringTokenizer token = new StringTokenizer(pType.getName(), ":"); // $NON-NLS-1$
         String parentId = token.nextToken();
         String childId = token.nextToken();
         String[] split = paramType.getName().split(":");
         if (split.length != 2) {
           continue;
         }
         String complexName = paramName + ":" + childId;
         if (complexName.equals(paramType.getName())) {
           processParam = paramType;
         }
       }
       if (processParam != null) {
         break;
       }
     }
     if (processParam != null) {
       processParam.setValue(pType.getValue());
     } else {
       TalendFileFactory fileFact = TalendFileFactory.eINSTANCE;
       ElementParameterType processTypes = fileFact.createElementParameterType();
       processTypes.setName(pType.getName());
       processTypes.setField(pType.getField());
       processTypes.setValue(pType.getValue());
       processType.getElementParameter().add(processTypes);
     }
   }
 }
Ejemplo n.º 2
0
  @Override
  public List<ModuleNeeded> getModulesNeededForJobs() throws PersistenceException {
    List<ModuleNeeded> importNeedsList = new ArrayList<ModuleNeeded>();
    IProxyRepositoryFactory repositoryFactory =
        CoreRuntimePlugin.getInstance().getRepositoryService().getProxyRepositoryFactory();
    ERepositoryObjectType jobType = ERepositoryObjectType.PROCESS;
    if (jobType != null) {
      List<IRepositoryViewObject> jobs = repositoryFactory.getAll(jobType, true);
      for (IRepositoryViewObject cur : jobs) {
        if (!cur.isDeleted()) {
          ProcessItem item = (ProcessItem) cur.getProperty().getItem();
          if (item == null || item.getProcess() == null) {
            continue;
          }
          List<NodeType> nodes = item.getProcess().getNode();
          for (NodeType node : nodes) {
            List<ElementParameterType> elementParameter = node.getElementParameter();
            for (ElementParameterType elementParam : elementParameter) {
              if (elementParam.getField() != null
                  && elementParam.getField().equals(EParameterFieldType.MODULE_LIST.getName())) {
                String uniquename = coreSerivce.getParameterUNIQUENAME(node);
                ModuleNeeded toAdd =
                    new ModuleNeeded(
                        Messages.getString("AbstractEMFRepositoryFactory.job")
                            + item.getProperty().getLabel(), // $NON-NLS-1$
                        elementParam.getValue(),
                        Messages.getString("AbstractEMFRepositoryFactory.requiredComponent")
                            + uniquename
                            + ".",
                        true); //$NON-NLS-1$ //$NON-NLS-2$
                importNeedsList.add(toAdd);
              }
            }
          }
        }
      }
    }

    return importNeedsList;
  }