Beispiel #1
0
  public JobHopMeta(Node hopnode, JobMeta job) throws KettleXMLException {
    try {
      String from_name = XMLHandler.getTagValue(hopnode, "from");
      String to_name = XMLHandler.getTagValue(hopnode, "to");
      String senabled = XMLHandler.getTagValue(hopnode, "enabled");
      String sevaluation = XMLHandler.getTagValue(hopnode, "evaluation");
      String sunconditional = XMLHandler.getTagValue(hopnode, "unconditional");
      String guiMidLocationX = XMLHandler.getTagValue(hopnode, "gui_mid_location_x");
      String guiMidLocationY = XMLHandler.getTagValue(hopnode, "gui_mid_location_y");

      from_entry = searchJobEntry(job.getJobEntries(), from_name);
      to_entry = searchJobEntry(job.getJobEntries(), to_name);

      if (senabled == null) enabled = true;
      else enabled = "Y".equalsIgnoreCase(senabled);
      if (sevaluation == null) evaluation = true;
      else evaluation = "Y".equalsIgnoreCase(sevaluation);
      unconditional = "Y".equalsIgnoreCase(sunconditional);
      this.guiMidLocationX = guiMidLocationX;
      this.guiMidLocationY = guiMidLocationY;
    } catch (Exception e) {
      throw new KettleXMLException(
          Messages.getString("JobHopMeta.Exception.UnableToLoadHopInfoXML"), e);
    }
  }
Beispiel #2
0
  public JobHopMeta(Repository rep, long id_job_hop, JobMeta job, List<JobEntryCopy> jobcopies)
      throws KettleException {
    try {
      long id_jobentry_copy_from;
      long id_jobentry_copy_to;

      RowMetaAndData r = rep.getJobHop(id_job_hop);
      if (r != null) {
        id_jobentry_copy_from = r.getInteger("ID_JOBENTRY_COPY_FROM", -1L);
        id_jobentry_copy_to = r.getInteger("ID_JOBENTRY_COPY_TO", -1L);
        enabled = r.getBoolean("ENABLED", true);
        evaluation = r.getBoolean("EVALUATION", true);
        unconditional = r.getBoolean("UNCONDITIONAL", !evaluation);
        guiMidLocationX = r.getString("GUI_MID_LOCATION_X", "");
        guiMidLocationY = r.getString("GUI_MID_LOCATION_Y", "");

        from_entry = JobMeta.findJobEntryCopy(jobcopies, id_jobentry_copy_from);
        to_entry = JobMeta.findJobEntryCopy(jobcopies, id_jobentry_copy_to);
      }
    } catch (KettleDatabaseException dbe) {
      throw new KettleException(
          Messages.getString("JobHopMeta.Exception.UnableToLoadHopInfoRep", "" + id_job_hop), dbe);
    }
  }
  public void getUsedVariables(JobMeta jobMeta) {
    Properties sp = new Properties();
    VariableSpace space = Variables.getADefaultVariableSpace();

    String[] keys = space.listVariables();
    for (int i = 0; i < keys.length; i++) {
      sp.put(keys[i], space.getVariable(keys[i]));
    }

    List<String> vars = jobMeta.getUsedVariables();
    if (vars != null && vars.size() > 0) {
      HashMap<String, String> newVariables = new HashMap<String, String>();

      for (int i = 0; i < vars.size(); i++) {
        String varname = vars.get(i);
        if (!varname.startsWith(Const.INTERNAL_VARIABLE_PREFIX)) {
          newVariables.put(varname, Const.NVL(variables.get(varname), sp.getProperty(varname, "")));
        }
      }
      // variables.clear();
      variables.putAll(newVariables);
    }
  }