/** ldong Comment method "resetJobProblemList". */
 public static void resetJobProblemList(IRepositoryViewObject obj, String oldLabel) {
   if (obj == null) {
     return;
   }
   Property property = obj.getProperty();
   if (property == null || !(property.getItem() instanceof ProcessItem)) {
     return;
   }
   String newLabel = property.getLabel();
   if (!newLabel.equals(oldLabel)) {
     for (Iterator<Problem> iter = Problems.getProblemList().getProblemList().iterator();
         iter.hasNext(); ) {
       Problem problem = iter.next();
       if (problem instanceof TalendProblem) {
         TalendProblem routineProblem = (TalendProblem) problem;
         if (routineProblem.getJavaUnitName() != null
             && (routineProblem.getJavaUnitName().equals(oldLabel))) {
           // TDI-24683:if rename the jobItem,need clear the problem view to avoid use the old
           // problem list
           iter.remove();
         }
       }
     }
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.talend.designer.core.ICheckNodesService#checkNode(org.talend.designer
  * .core.ui.editor.nodes.Node)
  */
 public void checkNode(Node node) {
   if (!node.getComponent().getName().equals("cJMS")) { // $NON-NLS-1$
     return;
   }
   List<? extends IElementParameter> parameters = node.getElementParameters();
   for (IElementParameter param : parameters) {
     if (param.getFieldType() == EParameterFieldType.ROUTE_COMPONENT_TYPE) {
       IElementParameter idParam =
           param.getChildParameters().get(EParameterName.ROUTE_COMPONENT_TYPE_ID.getName());
       if (idParam == null
           || idParam.getValue() == null
           || idParam.getValue().toString().isEmpty()) {
         String errorMessage =
             MessageFormat.format(
                 CamelDesignerMessages.getString(
                     "CheckJMSNodesService_emptyParaError") //$NON-NLS-1$
                 ,
                 param.getDisplayName());
         Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
       } else {
         List<? extends INode> graphicalNodes = node.getProcess().getGraphicalNodes();
         boolean has = false;
         for (INode n : graphicalNodes) {
           if (n.getUniqueName().equals(idParam.getValue())) {
             has = true;
             break;
           }
         }
         if (!has) {
           String errorMessage =
               MessageFormat.format(
                   CamelDesignerMessages.getString("CheckJMSNodesService_nonExistError"),
                   param.getDisplayName()); // $NON-NLS-1$
           Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
         }
       }
     }
   }
 }
  /** yzhang Comment method "updateProblems". */
  private void updateProblems(List<IRepositoryViewObject> routineObjectList, String filePath) {

    IRunProcessService runProcessService = CorePlugin.getDefault().getRunProcessService();
    try {
      ITalendProcessJavaProject talendProcessJavaProject =
          runProcessService.getTalendProcessJavaProject();
      if (talendProcessJavaProject == null) {
        return;
      }
      IProject javaProject = talendProcessJavaProject.getProject();
      IFile file = javaProject.getFile(filePath);
      String fileName = file.getName();

      for (IRepositoryViewObject repositoryObject : routineObjectList) {
        Property property = repositoryObject.getProperty();
        ITalendSynchronizer synchronizer =
            CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
        Item item = property.getItem();
        if (GlobalServiceRegister.getDefault()
            .isServiceRegistered(ICamelDesignerCoreService.class)) {
          ICamelDesignerCoreService service =
              (ICamelDesignerCoreService)
                  GlobalServiceRegister.getDefault().getService(ICamelDesignerCoreService.class);
          if (service.isInstanceofCamel(item)) {
            synchronizer =
                CorePlugin.getDefault().getCodeGeneratorService().createCamelBeanSynchronizer();
          }
        }
        IFile currentFile = synchronizer.getFile(item);
        if (currentFile != null && fileName.equals(currentFile.getName()) && currentFile.exists()) {
          Problems.addRoutineFile(currentFile, property);
          break;
        }
      }
    } catch (SystemException e) {
      ExceptionHandler.process(e);
    }
  }
예제 #4
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.talend.designer.core.ICheckNodesService#checkNode(org.talend.designer
   * .core.ui.editor.nodes.Node)
   */
  public void checkNode(Node node) {
    if (!node.getComponent().getName().equals("cCXF")) { // $NON-NLS-1$
      return;
    }
    IElementParameter resourceParam =
        node.getElementParameter(EParameterName.ROUTE_RESOURCE_TYPE_ID.getName());
    IElementParameter wsdlFileParam = node.getElementParameter("WSDL_FILE"); // $NON-NLS-1$
    IElementParameter serviceParam = node.getElementParameter("SERVICE_TYPE"); // $NON-NLS-1$
    IElementParameter wsdlTypeParam = node.getElementParameter("WSDL_TYPE"); // $NON-NLS-1$
    IElementParameter clazzParam = node.getElementParameter("SERVICE_CLASS"); // $NON-NLS-1$

    // Select WSDL
    if (serviceParam != null && "wsdlURL".equals(serviceParam.getValue())) { // $NON-NLS-1$
      // Select File
      if (wsdlTypeParam != null && "file".equals(wsdlTypeParam.getValue())) { // $NON-NLS-1$
        // WSDL file is empty
        if (wsdlFileParam == null
            || wsdlFileParam.getValue() == null
            || wsdlFileParam.getValue().toString().isEmpty()
            || wsdlFileParam.getValue().toString().equals("\"\"")) { // $NON-NLS-1$
          String errorMessage =
              MessageFormat.format(
                  CamelDesignerMessages.getString("CheckCXFNodesService_emptyError") // $NON-NLS-1$
                  ,
                  wsdlFileParam == null ? "" : wsdlFileParam.getDisplayName());
          Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
        }
      } // Select Repository
      else if (wsdlTypeParam != null && "repo".equals(wsdlTypeParam.getValue())) { // $NON-NLS-1$
        // WSDL file is empty
        String errorMessage = ""; // $NON-NLS-1$
        if (resourceParam == null
            || resourceParam.getValue() == null
            || resourceParam.getValue().toString().isEmpty()) {
          errorMessage =
              MessageFormat.format(
                  CamelDesignerMessages.getString("CheckCXFNodesService_emptyError") // $NON-NLS-1$
                  ,
                  wsdlFileParam.getDisplayName());
          Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
        } else {
          String id = (String) resourceParam.getValue();
          try {
            IRepositoryViewObject lastVersion =
                ProxyRepositoryFactory.getInstance().getLastVersion(id);
            if (lastVersion == null) {
              errorMessage =
                  MessageFormat.format(
                      CamelDesignerMessages.getString(
                          "CheckCXFNodesService_nonexistError") //$NON-NLS-1$
                      ,
                      wsdlFileParam.getDisplayName());
              Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
            } else if (lastVersion.isDeleted()) {
              errorMessage =
                  MessageFormat.format(
                      CamelDesignerMessages.getString(
                          "CheckCXFNodesService_removedError") //$NON-NLS-1$
                      ,
                      resourceParam.getDisplayName());
              Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
            }
          } catch (PersistenceException e) {
            errorMessage =
                MessageFormat.format(
                    CamelDesignerMessages.getString(
                        "CheckCXFNodesService_emptyError") //$NON-NLS-1$
                    ,
                    wsdlFileParam.getDisplayName());
            Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
          }
        }
      }
    }
    // Select Service class
    else if (serviceParam != null
        && "serviceClass".equals(serviceParam.getValue())) { // $NON-NLS-1$
      // Service class is empty
      if (clazzParam == null
          || clazzParam.getValue() == null
          || clazzParam.getValue().toString().isEmpty()) {
        String errorMessage =
            MessageFormat.format(
                CamelDesignerMessages.getString("CheckCXFNodesService_emptyError") // $NON-NLS-1$
                ,
                wsdlFileParam.getDisplayName());
        Problems.add(ProblemStatus.ERROR, (Element) node, errorMessage);
      }
    }
  }