Exemplo n.º 1
0
 public Object clone() {
   try {
     TransHopMeta retval = (TransHopMeta) super.clone();
     retval.setID(-1L);
     retval.setTempId(this.tempId);
     return retval;
   } catch (CloneNotSupportedException e) {
     return null;
   }
 }
Exemplo n.º 2
0
  public TransHopMeta(Repository rep, long id_trans_hop, List<StepMeta> steps)
      throws KettleException {
    try {
      setID(id_trans_hop);

      RowMetaAndData r = rep.getTransHop(id_trans_hop);

      long id_step_from = r.getInteger("ID_STEP_FROM", 0); // $NON-NLS-1$
      long id_step_to = r.getInteger("ID_STEP_TO", 0); // $NON-NLS-1$
      enabled = r.getBoolean("ENABLED", false); // $NON-NLS-1$
      guiMidLocationX = r.getString("GUI_MID_LOCATION_X", "");
      guiMidLocationY = r.getString("GUI_MID_LOCATION_Y", "");

      from_step = StepMeta.findStep(steps, id_step_from);
      if (from_step == null && id_step_from > 0) // Links to a shared
      // objects, try again by
      // looking up the
      // name...
      {
        // Simply load this, we only want the name, we don't care about
        // the rest...
        StepMeta stepMeta =
            new StepMeta(
                rep,
                id_step_from,
                new ArrayList<DatabaseMeta>(),
                new Hashtable<String, Counter>(),
                new ArrayList<PartitionSchema>());
        from_step = StepMeta.findStep(steps, stepMeta.getName());
      }
      from_step.setDraw(true);

      to_step = StepMeta.findStep(steps, id_step_to);
      if (to_step == null && id_step_to > 0) // Links to a shared
      // objects, try again by
      // looking up the name...
      {
        // Simply load this, we only want the name, we don't care about
        // the rest...
        StepMeta stepMeta =
            new StepMeta(
                rep,
                id_step_to,
                new ArrayList<DatabaseMeta>(),
                new Hashtable<String, Counter>(),
                new ArrayList<PartitionSchema>());
        to_step = StepMeta.findStep(steps, stepMeta.getName());
      }
      to_step.setDraw(true);
    } catch (KettleDatabaseException dbe) {
      throw new KettleException(
          Messages.getString("TransHopMeta.Exception.LoadTransformationHopInfo") + id_trans_hop,
          dbe); //$NON-NLS-1$
    }
  }
Exemplo n.º 3
0
  public void saveRep(Repository rep, long id_transformation) throws KettleException {
    try {
      // See if a transformation hop with the same fromstep and tostep is
      // already available...
      long id_step_from = from_step == null ? -1 : from_step.getID();
      long id_step_to = to_step == null ? -1 : to_step.getID();

      // Insert new transMeta hop in repository
      setID(
          rep.insertTransHop(
              id_transformation,
              id_step_from,
              id_step_to,
              enabled,
              guiMidLocationX,
              guiMidLocationY));
    } catch (KettleDatabaseException dbe) {
      throw new KettleException(
          Messages.getString("TransHopMeta.Exception.UnableToSaveTransformationHopInfo")
              + id_transformation,
          dbe); //$NON-NLS-1$
    }
  }