예제 #1
0
  private void readData(Node stepnode, List<? extends SharedObjectInterface> databases)
      throws KettleXMLException {
    try {
      String csize;
      int nrkeys;

      String con = XMLHandler.getTagValue(stepnode, "connection"); // $NON-NLS-1$
      databaseMeta = DatabaseMeta.findDatabase(databases, con);
      csize = XMLHandler.getTagValue(stepnode, "commit"); // $NON-NLS-1$
      commitSize = Const.toInt(csize, 0);
      schemaName =
          XMLHandler.getTagValue(stepnode, "lookup", "schema"); // $NON-NLS-1$ //$NON-NLS-2$
      tableName = XMLHandler.getTagValue(stepnode, "lookup", "table"); // $NON-NLS-1$ //$NON-NLS-2$

      Node lookup = XMLHandler.getSubNode(stepnode, "lookup"); // $NON-NLS-1$
      nrkeys = XMLHandler.countNodes(lookup, "key"); // $NON-NLS-1$

      allocate(nrkeys);

      for (int i = 0; i < nrkeys; i++) {
        Node knode = XMLHandler.getSubNodeByNr(lookup, "key", i); // $NON-NLS-1$

        keyStream[i] = XMLHandler.getTagValue(knode, "name"); // $NON-NLS-1$
        keyLookup[i] = XMLHandler.getTagValue(knode, "field"); // $NON-NLS-1$
        keyCondition[i] = XMLHandler.getTagValue(knode, "condition"); // $NON-NLS-1$
        if (keyCondition[i] == null) keyCondition[i] = "="; // $NON-NLS-1$
        keyStream2[i] = XMLHandler.getTagValue(knode, "name2"); // $NON-NLS-1$
      }

    } catch (Exception e) {
      throw new KettleXMLException(
          Messages.getString("DeleteMeta.Exception.UnableToReadStepInfoFromXML"), e); // $NON-NLS-1$
    }
  }
예제 #2
0
  public void readRep(
      Repository rep, long id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {
      long id_connection = rep.getStepAttributeInteger(id_step, "id_connection"); // $NON-NLS-1$
      databaseMeta = DatabaseMeta.findDatabase(databases, id_connection);

      commitSize = (int) rep.getStepAttributeInteger(id_step, "commit"); // $NON-NLS-1$
      schemaName = rep.getStepAttributeString(id_step, "schema"); // $NON-NLS-1$
      tableName = rep.getStepAttributeString(id_step, "table"); // $NON-NLS-1$

      int nrkeys = rep.countNrStepAttributes(id_step, "key_name"); // $NON-NLS-1$

      allocate(nrkeys);

      for (int i = 0; i < nrkeys; i++) {
        keyStream[i] = rep.getStepAttributeString(id_step, i, "key_name"); // $NON-NLS-1$
        keyLookup[i] = rep.getStepAttributeString(id_step, i, "key_field"); // $NON-NLS-1$
        keyCondition[i] = rep.getStepAttributeString(id_step, i, "key_condition"); // $NON-NLS-1$
        keyStream2[i] = rep.getStepAttributeString(id_step, i, "key_name2"); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleException(
          Messages.getString("DeleteMeta.Exception.UnexpectedErrorInReadingStepInfo"),
          e); //$NON-NLS-1$
    }
  }
예제 #3
0
  public void setDefault() {
    keyStream = null;
    databaseMeta = null;
    commitSize = 100;
    schemaName = ""; // $NON-NLS-1$
    tableName = Messages.getString("DeleteMeta.DefaultTableName.Label"); // $NON-NLS-1$

    int nrkeys = 0;

    allocate(nrkeys);
  }
예제 #4
0
  public void setDefault() {
    keyStream = null;
    databaseMeta = null;
    commitSize = "100";
    schemaName = "";
    tableName = BaseMessages.getString(PKG, "DeleteMeta.DefaultTableName.Label");

    int nrkeys = 0;

    allocate(nrkeys);
  }
예제 #5
0
  public Object clone() {
    DeleteMeta retval = (DeleteMeta) super.clone();
    int nrkeys = keyStream.length;

    retval.allocate(nrkeys);

    System.arraycopy(keyStream, 0, retval.keyStream, 0, nrkeys);
    System.arraycopy(keyLookup, 0, retval.keyLookup, 0, nrkeys);
    System.arraycopy(keyCondition, 0, retval.keyCondition, 0, nrkeys);
    System.arraycopy(keyStream2, 0, retval.keyStream2, 0, nrkeys);

    return retval;
  }
예제 #6
0
  public Object clone() {
    DeleteMeta retval = (DeleteMeta) super.clone();
    int nrkeys = keyStream.length;

    retval.allocate(nrkeys);

    for (int i = 0; i < nrkeys; i++) {
      retval.keyStream[i] = keyStream[i];
      retval.keyLookup[i] = keyLookup[i];
      retval.keyCondition[i] = keyCondition[i];
      retval.keyStream2[i] = keyStream2[i];
    }

    return retval;
  }
예제 #7
0
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      databaseMeta = rep.loadDatabaseMetaFromStepAttribute(id_step, "id_connection", databases);

      commitSize = rep.getStepAttributeString(id_step, "commit");
      if (commitSize == null) {
        long comSz = -1;
        try {
          comSz = rep.getStepAttributeInteger(id_step, "commit");
        } catch (Exception ex) {
          commitSize = "100";
        }
        if (comSz >= 0) {
          commitSize = Long.toString(comSz);
        }
      }
      schemaName = rep.getStepAttributeString(id_step, "schema");
      tableName = rep.getStepAttributeString(id_step, "table");

      int nrkeys = rep.countNrStepAttributes(id_step, "key_name");

      allocate(nrkeys);

      for (int i = 0; i < nrkeys; i++) {
        keyStream[i] = rep.getStepAttributeString(id_step, i, "key_name");
        keyLookup[i] = rep.getStepAttributeString(id_step, i, "key_field");
        keyCondition[i] = rep.getStepAttributeString(id_step, i, "key_condition");
        keyStream2[i] = rep.getStepAttributeString(id_step, i, "key_name2");
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(PKG, "DeleteMeta.Exception.UnexpectedErrorInReadingStepInfo"), e);
    }
  }