/*
  * (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);
         }
       }
     }
   }
 }
예제 #2
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);
      }
    }
  }