コード例 #1
0
  /**
   * DOC jsxie Comment method "createTrigger".
   *
   * @param dialog
   * @param jobVersion2
   */
  private WSRoutingRuleE createTrigger(String jobName, String jobVersion, JobOptionsDialog dialog) {
    WSRoutingRuleE routingRule = MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleE();

    try {
      String server = "http://localhost:8180"; // $NON-NLS-1$

      Execution execution = dialog.getExecution();
      String url = ""; // $NON-NLS-1$
      switch (execution) {
        case EMBEDDED:
          url = "ltj://" + jobName + "/" + jobVersion; // $NON-NLS-1$ //$NON-NLS-2$
          break;
        case WEB_SERVICE:
          url =
              Messages.bind(Messages.GenerateJobXX_UrlString, server, jobName, jobVersion, jobName);
          break;
      }

      Parameter executionParameter = dialog.getParameter();
      String parameter = ""; // $NON-NLS-1$
      switch (executionParameter) {
        case CONTEXT_VARIABLE:
          parameter =
              "<configuration>\n"
                  + "<url>"
                  + url
                  + "</url><contextParam>\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                  + "<name>xmlInput</name>\n"
                  + "<value>{exchange_data}</value>\n"
                  + "</contextParam>\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                  + "</configuration>\n"; //$NON-NLS-1$
          break;
        case INTEGRATED:
          parameter =
              "<configuration>\n"
                  + "<url>"
                  + url
                  + "</url>" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                  + "</configuration>\n"; //$NON-NLS-1$
          break;
      }

      // Generate the job call
      // create default CREATE operation express
      WSRoutingRuleExpressionE expression1 =
          MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleExpressionE();

      expression1.setName("C1"); // $NON-NLS-1$
      expression1.setXpath("Update/OperationType"); // $NON-NLS-1$
      expression1.setWsOperator(newContainRoutingRuleOperator());
      expression1.setValue("CREATE"); // $NON-NLS-1$

      WSRoutingRuleExpressionE expression2 =
          MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleExpressionE();
      expression2.setName("C2"); // $NON-NLS-1$
      expression2.setXpath("Update/OperationType"); // $NON-NLS-1$
      expression2.setWsOperator(newContainRoutingRuleOperator());
      expression2.setValue("UPDATE"); // $NON-NLS-1$

      WSRoutingRuleExpressionE expression3 =
          MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleExpressionE();
      expression3.setName("C3"); // $NON-NLS-1$
      expression3.setXpath("Update/OperationType"); // $NON-NLS-1$
      expression3.setWsOperator(newContainRoutingRuleOperator());
      expression3.setValue("DELETE"); // $NON-NLS-1$

      routingRule.setName(getNewTriggerName(jobName));
      routingRule.setDescription("Trigger that calls the Talend Job: " + jobName); // $NON-NLS-1$
      routingRule.setSynchronous(false);
      routingRule.setConcept("Update"); // $NON-NLS-1$
      routingRule.setServiceJNDI("amalto/local/service/callJob"); // $NON-NLS-1$
      routingRule.setParameters(parameter);

      routingRule.setCondition(null);
      routingRule.setDeactive(false);

      routingRule.getWsRoutingRuleExpressions().add(expression1);
      routingRule.getWsRoutingRuleExpressions().add(expression2);
      routingRule.getWsRoutingRuleExpressions().add(expression3);

      routingRule.setCondition("C1 Or C2 Or C3"); // $NON-NLS-1$
      routingRule.setDeactive(false);

    } catch (Exception e) {
      log.error(e.getMessage(), e);
    }

    return routingRule;
  }
コード例 #2
0
 public ConfirmConflictMessageDialog(Shell parentShell, int conflictCount) {
   super(parentShell);
   this.message =
       Messages.bind(Messages.ConfirmConflictMessageDialog_dialogMessage, conflictCount);
 }