Java Code Examples for org.pentaho.di.repository.Repository#countNrStepAttributes()

The following examples show how to use org.pentaho.di.repository.Repository#countNrStepAttributes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SalesforceUpsertMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  super.readRep( rep, metaStore, id_step, databases );
  try {
    setUpsertField( rep.getStepAttributeString( id_step, "upsertfield" ) );
    setBatchSize( rep.getStepAttributeString( id_step, "batchSize" ) );
    setSalesforceIDFieldName( rep.getStepAttributeString( id_step, "salesforceIDFieldName" ) );
    int nrFields = rep.countNrStepAttributes( id_step, "field_name" );
    allocate( nrFields );

    for ( int i = 0; i < nrFields; i++ ) {
      updateLookup[i] = rep.getStepAttributeString( id_step, i, "field_name" );
      updateStream[i] = rep.getStepAttributeString( id_step, i, "field_attribut" );
      useExternalId[i] =
        Boolean.valueOf( rep.getStepAttributeBoolean( id_step, i, "field_useExternalId", false ) );
    }
    setRollbackAllChangesOnError( rep.getStepAttributeBoolean( id_step, "rollbackAllChangesOnError" ) );
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "SalesforceUpsertMeta.Exception.ErrorReadingRepository" ), e );
  }
}
 
Example 2
Source File: SwitchCaseMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    fieldname = rep.getStepAttributeString( id_step, "fieldname" );
    isContains = rep.getStepAttributeBoolean( id_step, "use_contains" );
    caseValueType = ValueMetaBase.getType( rep.getStepAttributeString( id_step, "case_value_type" ) );
    caseValueFormat = rep.getStepAttributeString( id_step, "case_value_format" );
    caseValueDecimal = rep.getStepAttributeString( id_step, "case_value_decimal" );
    caseValueGroup = rep.getStepAttributeString( id_step, "case_value_group" );

    defaultTargetStepname = rep.getStepAttributeString( id_step, "default_target_step" );

    int nrCases = rep.countNrStepAttributes( id_step, "case_value" );
    allocate();
    for ( int i = 0; i < nrCases; i++ ) {
      SwitchCaseTarget target = new SwitchCaseTarget();
      target.caseValue = rep.getStepAttributeString( id_step, i, "case_value" );
      target.caseTargetStepname = rep.getStepAttributeString( id_step, i, "case_target_step" );
      caseTargets.add( target );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "SwitchCaseMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository" ), e );
  }
}
 
Example 3
Source File: AggregateRowsMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {

  try {
    int nrfields = rep.countNrStepAttributes( id_step, "field_name" );

    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      fieldName[i] = rep.getStepAttributeString( id_step, i, "field_name" );
      fieldNewName[i] = rep.getStepAttributeString( id_step, i, "field_rename" );
      aggregateType[i] = getType( rep.getStepAttributeString( id_step, i, "field_type" ) );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "AggregateRowsMeta.Exception.UnexpectedErrorWhileReadingStepInfo" ), e );
  }

}
 
Example 4
Source File: OdpsOutputMeta.java    From aliyun-maxcompute-data-collectors with Apache License 2.0 6 votes vote down vote up
@Override public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step,
    List<DatabaseMeta> databases) throws KettleException {
    super.readRep(rep, metaStore, id_step, databases);

    String truncateStr = rep.getStepAttributeString(id_step, "truncate");
    if (truncateStr.equals("true")) {
        setTruncate(true);
    } else {
        setTruncate(false);
    }

    int nrStreamFields = rep.countNrStepAttributes(id_step, "stream_field_name");
    streamFields = new ArrayList<String>(nrStreamFields);
    for (int i = 0; i < nrStreamFields; i++) {
        streamFields.add(rep.getStepAttributeString(id_step, i, "stream_field_name"));
    }
}
 
Example 5
Source File: StringOperationsMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {

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

    allocate( nrkeys );
    for ( int i = 0; i < nrkeys; i++ ) {
      fieldInStream[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "in_stream_name" ), "" );
      fieldOutStream[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "out_stream_name" ), "" );

      trimType[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "trim_type" ), "" );
      lowerUpper[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "lower_upper" ), "" );
      padding_type[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "padding_type" ), "" );
      padChar[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "pad_char" ), "" );
      padLen[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "pad_len" ), "" );
      initCap[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "init_cap" ), "" );
      maskXML[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "mask_xml" ), "" );
      digits[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "digits" ), "" );
      remove_special_characters[i] = Const.NVL( rep.getStepAttributeString( id_step, i, "remove_special_characters" ), "" );

    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "StringOperationsMeta.Exception.UnexpectedErrorInReadingStepInfo" ), e );
  }
}
 
Example 6
Source File: PaloDimOutputMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId idStep, List<DatabaseMeta> databases )
  throws KettleException {
  try {
    this.databaseMeta = rep.loadDatabaseMetaFromStepAttribute( idStep, "connection", databases );
    this.dimension = rep.getStepAttributeString( idStep, "dimension" );
    this.elementType = rep.getStepAttributeString( idStep, "elementtype" );
    this.createNewDimension = rep.getStepAttributeBoolean( idStep, "createdimension" );
    this.clearDimension = rep.getStepAttributeBoolean( idStep, "cleardimension" );
    this.clearConsolidations = rep.getStepAttributeBoolean( idStep, "clearconsolidations" );
    this.recreateDimension = rep.getStepAttributeBoolean( idStep, "recreatedimension" );
    this.enableElementCache = rep.getStepAttributeBoolean( idStep, "enableElementCache" );
    this.preloadElementCache = rep.getStepAttributeBoolean( idStep, "preloadElementCache" );

    int nrLevels = rep.countNrStepAttributes( idStep, "levelname" );

    for ( int i = 0; i < nrLevels; i++ ) {
      String levelName = rep.getStepAttributeString( idStep, i, "levelname" );
      int levelNumber = (int) rep.getStepAttributeInteger( idStep, i, "levelnumber" );
      String fieldName = rep.getStepAttributeString( idStep, i, "fieldname" );
      String fieldType = rep.getStepAttributeString( idStep, i, "fieldtype" );
      String consolidationField = rep.getStepAttributeString( idStep, i, "consolidationfieldname" );
      this.levels.add( new PaloDimensionLevel( levelName, levelNumber, fieldName, fieldType, consolidationField ) );
    }
  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 7
Source File: MemoryGroupByMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    int groupsize = rep.countNrStepAttributes( id_step, "group_name" );
    int nrvalues = rep.countNrStepAttributes( id_step, "aggregate_name" );

    allocate( groupsize, nrvalues );

    for ( int i = 0; i < groupsize; i++ ) {
      groupField[i] = rep.getStepAttributeString( id_step, i, "group_name" );
    }

    boolean hasNumberOfValues = false;
    for ( int i = 0; i < nrvalues; i++ ) {
      aggregateField[i] = rep.getStepAttributeString( id_step, i, "aggregate_name" );
      subjectField[i] = rep.getStepAttributeString( id_step, i, "aggregate_subject" );
      aggregateType[i] = getType( rep.getStepAttributeString( id_step, i, "aggregate_type" ) );

      if ( aggregateType[i] == TYPE_GROUP_COUNT_ALL
        || aggregateType[i] == TYPE_GROUP_COUNT_DISTINCT || aggregateType[i] == TYPE_GROUP_COUNT_ANY ) {
        hasNumberOfValues = true;
      }
      valueField[i] = rep.getStepAttributeString( id_step, i, "aggregate_value_field" );
    }

    alwaysGivingBackOneRow = rep.getStepAttributeBoolean( id_step, 0, "give_back_row", hasNumberOfValues );
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "MemoryGroupByMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository" ), e );
  }
}
 
Example 8
Source File: ScriptMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    String script = rep.getStepAttributeString( id_step, "script" );

    // When in compatibility mode, we load the script, not the other tabs...
    //
    if ( !Utils.isEmpty( script ) ) {
      jsScripts = new ScriptValuesScript[1];
      jsScripts[0] = new ScriptValuesScript( ScriptValuesScript.TRANSFORM_SCRIPT, "ScriptValue", script );
    } else {
      int nrScripts = rep.countNrStepAttributes( id_step, JSSCRIPT_TAG_NAME );
      jsScripts = new ScriptValuesScript[nrScripts];
      for ( int i = 0; i < nrScripts; i++ ) {
        jsScripts[i] = new ScriptValuesScript(
          (int) rep.getStepAttributeInteger( id_step, i, JSSCRIPT_TAG_TYPE ),
          rep.getStepAttributeString( id_step, i, JSSCRIPT_TAG_NAME ),
          rep.getStepAttributeString( id_step, i, JSSCRIPT_TAG_SCRIPT ) );
      }
    }

    int nrfields = rep.countNrStepAttributes( id_step, "field_name" );
    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      fieldname[i] = rep.getStepAttributeString( id_step, i, "field_name" );
      rename[i] = rep.getStepAttributeString( id_step, i, "field_rename" );
      type[i] = ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, "field_type" ) );
      length[i] = (int) rep.getStepAttributeInteger( id_step, i, "field_length" );
      precision[i] = (int) rep.getStepAttributeInteger( id_step, i, "field_precision" );
      replace[i] = rep.getStepAttributeBoolean( id_step, i, "field_replace" );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "ScriptMeta.Exception.UnexpectedErrorInReadingStepInfo" ), e );
  }
}
 
Example 9
Source File: HTTPMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    url = rep.getStepAttributeString( id_step, "url" );
    urlInField = rep.getStepAttributeBoolean( id_step, "urlInField" );
    urlField = rep.getStepAttributeString( id_step, "urlField" );
    encoding = rep.getStepAttributeString( id_step, "encoding" );
    httpLogin = rep.getStepAttributeString( id_step, "httpLogin" );
    httpPassword =
      Encr.decryptPasswordOptionallyEncrypted( rep.getStepAttributeString( id_step, "httpPassword" ) );
    proxyHost = rep.getStepAttributeString( id_step, "proxyHost" );
    proxyPort = rep.getStepAttributeString( id_step, "proxyPort" );
    socketTimeout = rep.getStepAttributeString( id_step, "socketTimeout" );
    connectionTimeout = rep.getStepAttributeString( id_step, "connectionTimeout" );
    closeIdleConnectionsTime = rep.getStepAttributeString( id_step, "closeIdleConnectionsTime" );

    int nrargs = rep.countNrStepAttributes( id_step, "arg_name" );
    int nrheaders = rep.countNrStepAttributes( id_step, "header_name" );
    allocate( nrargs, nrheaders );

    for ( int i = 0; i < nrargs; i++ ) {
      argumentField[i] = rep.getStepAttributeString( id_step, i, "arg_name" );
      argumentParameter[i] = rep.getStepAttributeString( id_step, i, "arg_parameter" );
    }

    for ( int i = 0; i < nrheaders; i++ ) {
      headerField[i] = rep.getStepAttributeString( id_step, i, "header_name" );
      headerParameter[i] = rep.getStepAttributeString( id_step, i, "header_parameter" );
    }

    fieldName = rep.getStepAttributeString( id_step, "result_name" );
    resultCodeFieldName = rep.getStepAttributeString( id_step, "result_code" );
    responseTimeFieldName = rep.getStepAttributeString( id_step, "response_time" );
    responseHeaderFieldName = rep.getStepAttributeString( id_step, "response_header" );
  } catch ( Exception e ) {
    throw new KettleException(
      BaseMessages.getString( PKG, "HTTPMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
  }
}
 
Example 10
Source File: GetFileNamesMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    int nrfiles = rep.countNrStepAttributes( id_step, "file_name" );
    fileTypeFilter =
      FileInputList.FileTypeFilter.getByName( rep.getStepAttributeString( id_step, "filterfiletype" ) );
    doNotFailIfNoFile = rep.getStepAttributeBoolean( id_step, "doNotFailIfNoFile" );
    dynamicFilenameField = rep.getStepAttributeString( id_step, "filename_Field" );
    dynamicWildcardField = rep.getStepAttributeString( id_step, "wildcard_Field" );
    dynamicExcludeWildcardField = rep.getStepAttributeString( id_step, "exclude_wildcard_Field" );
    dynamicIncludeSubFolders = rep.getStepAttributeBoolean( id_step, "dynamic_include_subfolders" );

    includeRowNumber = rep.getStepAttributeBoolean( id_step, "rownum" );
    isaddresult = rep.getStepAttributeBoolean( id_step, "isaddresult" );
    filefield = rep.getStepAttributeBoolean( id_step, "filefield" );
    rowNumberField = rep.getStepAttributeString( id_step, "rownum_field" );
    rowLimit = rep.getStepAttributeInteger( id_step, "limit" );

    allocate( nrfiles );

    for ( int i = 0; i < nrfiles; i++ ) {
      fileName[i] = rep.getStepAttributeString( id_step, i, "file_name" );
      fileMask[i] = rep.getStepAttributeString( id_step, i, "file_mask" );
      excludeFileMask[i] = rep.getStepAttributeString( id_step, i, "exclude_file_mask" );
      fileRequired[i] = rep.getStepAttributeString( id_step, i, "file_required" );
      if ( !YES.equalsIgnoreCase( fileRequired[i] ) ) {
        fileRequired[i] = NO;
      }
      includeSubFolders[i] = rep.getStepAttributeString( id_step, i, "include_subfolders" );
      if ( !YES.equalsIgnoreCase( includeSubFolders[i] ) ) {
        includeSubFolders[i] = NO;
      }
    }
  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 11
Source File: FuzzyMatchMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    String lookupFromStepname = rep.getStepAttributeString( id_step, "lookup_from_step" );
    StreamInterface infoStream = getStepIOMeta().getInfoStreams().get( 0 );
    infoStream.setSubject( lookupFromStepname );
    lookupfield = rep.getStepAttributeString( id_step, "lookupfield" );
    mainstreamfield = rep.getStepAttributeString( id_step, "mainstreamfield" );
    outputmatchfield = rep.getStepAttributeString( id_step, "outputmatchfield" );
    outputvaluefield = rep.getStepAttributeString( id_step, "outputvaluefield" );

    caseSensitive = rep.getStepAttributeBoolean( id_step, "caseSensitive" );
    closervalue = rep.getStepAttributeBoolean( id_step, "closervalue" );
    minimalValue = rep.getStepAttributeString( id_step, "minimalValue" );
    maximalValue = rep.getStepAttributeString( id_step, "maximalValue" );
    separator = rep.getStepAttributeString( id_step, "separator" );

    algorithm = getAlgorithmTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "algorithm" ), "" ) );

    int nrvalues = rep.countNrStepAttributes( id_step, "return_value_name" );
    allocate( nrvalues );

    for ( int i = 0; i < nrvalues; i++ ) {
      value[i] = rep.getStepAttributeString( id_step, i, "return_value_name" );
      valueName[i] = rep.getStepAttributeString( id_step, i, "return_value_rename" );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "FuzzyMatchMeta.Exception.UnexpecteErrorReadingStepInfoFromRepository" ), e );
  }
}
 
Example 12
Source File: IngresVectorwiseLoaderMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    tablename = rep.getStepAttributeString( id_step, "table" );
    fifoFileName = rep.getStepAttributeString( id_step, "fifo_file_name" );
    sqlPath = rep.getStepAttributeString( id_step, "sql_path" );
    encoding = rep.getStepAttributeString( id_step, "encoding" );
    delimiter = rep.getStepAttributeString( id_step, "delimiter" );
    continueOnError = rep.getStepAttributeBoolean( id_step, "continue_on_error" );
    errorFileName = rep.getStepAttributeString( id_step, "error_file_name" );
    useStandardConversion = rep.getStepAttributeBoolean( id_step, "use_standard_conversion" );
    useAuthentication = rep.getStepAttributeBoolean( id_step, "use_authentication" );
    useDynamicVNode = rep.getStepAttributeBoolean( id_step, "use_dynamic_vnode" );
    useSSV = rep.getStepAttributeBoolean( id_step, "use_SSV_delimiter" );
    escapingSpecialCharacters = rep.getStepAttributeBoolean( id_step, 0, "escape_special_characters", true );
    usingVwload = rep.getStepAttributeBoolean( id_step, "use_vwload" );
    maxNrErrors = rep.getStepAttributeString( id_step, "max_errors" );
    truncatingTable = rep.getStepAttributeBoolean( id_step, "truncate_table" );
    bufferSize = rep.getStepAttributeString( id_step, "buffer_size" );

    int nrCols = rep.countNrStepAttributes( id_step, "column_name" );
    int nrStreams = rep.countNrStepAttributes( id_step, "stream_name" );

    int nrRows = ( nrCols < nrStreams ? nrStreams : nrCols );
    allocate( nrRows );

    for ( int idx = 0; idx < nrRows; idx++ ) {
      fieldDatabase[idx] = Const.NVL( rep.getStepAttributeString( id_step, idx, "column_name" ), "" );
      fieldStream[idx] = Const.NVL( rep.getStepAttributeString( id_step, idx, "stream_name" ), "" );
    }
  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 13
Source File: GetVariableMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases )
  throws KettleException {
  try {
    int nrfields = rep.countNrStepAttributes( id_step, "field_name" );

    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      fieldDefinitions[i].setFieldName( rep.getStepAttributeString( id_step, i, "field_name" ) );
      fieldDefinitions[i].setVariableString( rep.getStepAttributeString( id_step, i, "field_variable" ) );
      fieldDefinitions[i].setFieldType(
        ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, "field_type" ) ) );

      fieldDefinitions[i].setFieldFormat( rep.getStepAttributeString( id_step, i, "field_format" ) );
      fieldDefinitions[i].setCurrency( rep.getStepAttributeString( id_step, i, "field_currency" ) );
      fieldDefinitions[i].setDecimal( rep.getStepAttributeString( id_step, i, "field_decimal" ) );
      fieldDefinitions[i].setGroup( rep.getStepAttributeString( id_step, i, "field_group" ) );
      fieldDefinitions[i].setFieldLength( (int) rep.getStepAttributeInteger( id_step, i, "field_length" ) );
      fieldDefinitions[i].setFieldPrecision( (int) rep.getStepAttributeInteger( id_step, i, "field_precision" ) );
      fieldDefinitions[i].setTrimType(
        ValueMetaString.getTrimTypeByCode( rep.getStepAttributeString( id_step, i, "field_trim_type" ) ) );

      // Backward compatibility
      //
      int fieldType = fieldDefinitions[i].getFieldType();
      if ( fieldType == ValueMetaInterface.TYPE_NONE ) {
        fieldDefinitions[i].setFieldType( ValueMetaInterface.TYPE_STRING );
      }
    }

  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 14
Source File: LucidDBBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    maxErrors = (int) rep.getStepAttributeInteger( id_step, "errors" );
    bufferSize = rep.getStepAttributeString( id_step, "buffer_size" );
    schemaName = rep.getStepAttributeString( id_step, "schema" );
    tableName = rep.getStepAttributeString( id_step, "table" );
    encoding = rep.getStepAttributeString( id_step, "encoding" );
    fifoDirectory = rep.getStepAttributeString( id_step, "fifo_directory" );
    fifoServerName = rep.getStepAttributeString( id_step, "fifo_server_name" );

    int nrvalues = rep.countNrStepAttributes( id_step, "stream_name" );

    allocate( nrvalues );

    for ( int i = 0; i < nrvalues; i++ ) {
      fieldTable[i] = rep.getStepAttributeString( id_step, i, "stream_name" );
      fieldStream[i] = rep.getStepAttributeString( id_step, i, "field_name" );
      if ( fieldStream[i] == null ) {
        fieldStream[i] = fieldTable[i];
      }
      fieldFormatOk[i] = rep.getStepAttributeBoolean( id_step, i, "field_format_ok" );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "LucidDBBulkLoaderMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository" ), e );
  }
}
 
Example 15
Source File: InsertUpdateMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  this.databases = databases;
  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" );
    updateBypassed = rep.getStepAttributeBoolean( id_step, "update_bypassed" );

    int nrkeys = rep.countNrStepAttributes( id_step, "key_field" );
    int nrvalues = rep.countNrStepAttributes( id_step, "value_name" );

    allocate( nrkeys, nrvalues );

    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" );
    }

    for ( int i = 0; i < nrvalues; i++ ) {
      updateLookup[i] = rep.getStepAttributeString( id_step, i, "value_name" );
      updateStream[i] = rep.getStepAttributeString( id_step, i, "value_rename" );
      update[i] = Boolean.valueOf( rep.getStepAttributeBoolean( id_step, i, "value_update", true ) );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "InsertUpdateMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository" ), e );
  }
}
 
Example 16
Source File: MappingMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  String method = rep.getStepAttributeString( id_step, "specification_method" );
  specificationMethod = ObjectLocationSpecificationMethod.getSpecificationMethodByCode( method );
  String transId = rep.getStepAttributeString( id_step, "trans_object_id" );
  transObjectId = Utils.isEmpty( transId ) ? null : new StringObjectId( transId );
  transName = rep.getStepAttributeString( id_step, "trans_name" );
  fileName = rep.getStepAttributeString( id_step, "filename" );
  directoryPath = rep.getStepAttributeString( id_step, "directory_path" );

  // Backward compatibility check for object specification
  //
  checkObjectLocationSpecificationMethod();
  inputMappings.clear();
  outputMappings.clear();

  int nrInput = rep.countNrStepAttributes( id_step, "input_field" );
  int nrOutput = rep.countNrStepAttributes( id_step, "output_field" );

  // Backward compatibility...
  //
  if ( nrInput > 0 || nrOutput > 0 ) {
    MappingIODefinition inputMappingDefinition = new MappingIODefinition();
    inputMappingDefinition.setMainDataPath( true );

    for ( int i = 0; i < nrInput; i++ ) {
      String inputField = rep.getStepAttributeString( id_step, i, "input_field" );
      String inputMapping = rep.getStepAttributeString( id_step, i, "input_mapping" );
      inputMappingDefinition.getValueRenames().add( new MappingValueRename( inputField, inputMapping ) );
    }

    MappingIODefinition outputMappingDefinition = new MappingIODefinition();
    outputMappingDefinition.setMainDataPath( true );

    for ( int i = 0; i < nrOutput; i++ ) {
      String outputField = rep.getStepAttributeString( id_step, i, "output_field" );
      String outputMapping = rep.getStepAttributeString( id_step, i, "output_mapping" );
      outputMappingDefinition.getValueRenames().add( new MappingValueRename( outputMapping, outputField ) );
    }

    // Don't forget to add these to the input and output mapping
    // definitions...
    //
    inputMappings.add( inputMappingDefinition );
    outputMappings.add( outputMappingDefinition );

    // The default is to have no mapping parameters: the concept didn't exist
    // before.
    mappingParameters = new MappingParameters();
  } else {
    nrInput = rep.countNrStepAttributes( id_step, "input_main_path" );
    nrOutput = rep.countNrStepAttributes( id_step, "output_main_path" );

    for ( int i = 0; i < nrInput; i++ ) {
      inputMappings.add( new MappingIODefinition( rep, id_step, "input_", i ) );
    }

    for ( int i = 0; i < nrOutput; i++ ) {
      outputMappings.add( new MappingIODefinition( rep, id_step, "output_", i ) );
    }

    mappingParameters = new MappingParameters( rep, id_step );
  }

  allowingMultipleInputs =
    rep.getStepAttributeBoolean( id_step, 0, "allow_multiple_input", inputMappings.size() > 1 );
  allowingMultipleOutputs =
    rep.getStepAttributeBoolean( id_step, 0, "allow_multiple_output", outputMappings.size() > 1 );
}
 
Example 17
Source File: LDIFInputMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    filefield = rep.getStepAttributeBoolean( id_step, "filefield" );
    dynamicFilenameField = rep.getStepAttributeString( id_step, "dynamicFilenameField" );
    includeFilename = rep.getStepAttributeBoolean( id_step, "include" );
    filenameField = rep.getStepAttributeString( id_step, "include_field" );
    addtoresultfilename = rep.getStepAttributeBoolean( id_step, "addtoresultfilename" );
    multiValuedSeparator = rep.getStepAttributeString( id_step, "multiValuedSeparator" );

    includeRowNumber = rep.getStepAttributeBoolean( id_step, "rownum" );
    rowNumberField = rep.getStepAttributeString( id_step, "rownum_field" );
    includeContentType = rep.getStepAttributeBoolean( id_step, "contenttype" );
    contentTypeField = rep.getStepAttributeString( id_step, "contenttype_field" );
    DNField = rep.getStepAttributeString( id_step, "dn_field" );
    includeDN = rep.getStepAttributeBoolean( id_step, "dn" );
    rowLimit = rep.getStepAttributeInteger( id_step, "limit" );

    int nrFiles = rep.countNrStepAttributes( id_step, "file_name" );
    int nrFields = rep.countNrStepAttributes( id_step, "field_name" );

    allocate( nrFiles, nrFields );

    for ( int i = 0; i < nrFiles; i++ ) {
      fileName[i] = rep.getStepAttributeString( id_step, i, "file_name" );
      fileMask[i] = rep.getStepAttributeString( id_step, i, "file_mask" );
      excludeFileMask[i] = rep.getStepAttributeString( id_step, i, "exclude_file_mask" );
      fileRequired[i] = rep.getStepAttributeString( id_step, i, "file_required" );
      if ( !YES.equalsIgnoreCase( fileRequired[i] ) ) {
        fileRequired[i] = NO;
      }
      includeSubFolders[i] = rep.getStepAttributeString( id_step, i, "include_subfolders" );
      if ( !YES.equalsIgnoreCase( includeSubFolders[i] ) ) {
        includeSubFolders[i] = NO;
      }
    }

    for ( int i = 0; i < nrFields; i++ ) {
      LDIFInputField field = new LDIFInputField();

      field.setName( rep.getStepAttributeString( id_step, i, "field_name" ) );
      field.setAttribut( rep.getStepAttributeString( id_step, i, "field_attribut" ) );
      field.setType( ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, "field_type" ) ) );
      field.setFormat( rep.getStepAttributeString( id_step, i, "field_format" ) );
      field.setCurrencySymbol( rep.getStepAttributeString( id_step, i, "field_currency" ) );
      field.setDecimalSymbol( rep.getStepAttributeString( id_step, i, "field_decimal" ) );
      field.setGroupSymbol( rep.getStepAttributeString( id_step, i, "field_group" ) );
      field.setLength( (int) rep.getStepAttributeInteger( id_step, i, "field_length" ) );
      field.setPrecision( (int) rep.getStepAttributeInteger( id_step, i, "field_precision" ) );
      field.setTrimType( LDIFInputField.getTrimTypeByCode( rep.getStepAttributeString(
        id_step, i, "field_trim_type" ) ) );
      field.setRepeated( rep.getStepAttributeBoolean( id_step, i, "field_repeat" ) );

      inputFields[i] = field;
    }
    shortFileFieldName = rep.getStepAttributeString( id_step, "shortFileFieldName" );
    pathFieldName = rep.getStepAttributeString( id_step, "pathFieldName" );
    hiddenFieldName = rep.getStepAttributeString( id_step, "hiddenFieldName" );
    lastModificationTimeFieldName = rep.getStepAttributeString( id_step, "lastModificationTimeFieldName" );
    rootUriNameFieldName = rep.getStepAttributeString( id_step, "rootUriNameFieldName" );
    extensionFieldName = rep.getStepAttributeString( id_step, "extensionFieldName" );
    sizeFieldName = rep.getStepAttributeString( id_step, "sizeFieldName" );
    uriNameFieldName = rep.getStepAttributeString(  id_step, "uriNameFieldName" );
  } catch ( Exception e ) {
    throw new KettleException(
      BaseMessages.getString( PKG, "LDIFInputMeta.Exception.ErrorReadingRepository" ), e );
  }
}
 
Example 18
Source File: ExcelWriterStepMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    headerEnabled = rep.getStepAttributeBoolean( id_step, "header" );
    footerEnabled = rep.getStepAttributeBoolean( id_step, "footer" );
    makeSheetActive = rep.getStepAttributeBoolean( id_step, "makeSheetActive" );
    appendOmitHeader = rep.getStepAttributeBoolean( id_step, "appendOmitHeader" );
    startingCell = rep.getStepAttributeString( id_step, "startingCell" );
    appendEmpty = (int) rep.getStepAttributeInteger( id_step, "appendEmpty" );
    appendOffset = (int) rep.getStepAttributeInteger( id_step, "appendOffset" );
    rowWritingMethod = rep.getStepAttributeString( id_step, "rowWritingMethod" );
    appendLines = rep.getStepAttributeBoolean( id_step, "appendLines" );
    forceFormulaRecalculation = rep.getStepAttributeBoolean( id_step, "forceFormulaRecalculation" );
    leaveExistingStylesUnchanged = rep.getStepAttributeBoolean( id_step, "leaveExistingStylesUnchanged" );

    String addToResult = rep.getStepAttributeString( id_step, "add_to_result_filenames" );
    if ( Utils.isEmpty( addToResult ) ) {
      addToResultFilenames = true;
    } else {
      addToResultFilenames = rep.getStepAttributeBoolean( id_step, "add_to_result_filenames" );
    }

    fileName = rep.getStepAttributeString( id_step, "file_name" );
    extension = rep.getStepAttributeString( id_step, "file_extention" );

    doNotOpenNewFileInit = rep.getStepAttributeBoolean( id_step, "do_not_open_newfile_init" );

    splitEvery = (int) rep.getStepAttributeInteger( id_step, "file_split" );
    stepNrInFilename = rep.getStepAttributeBoolean( id_step, "file_add_stepnr" );
    dateInFilename = rep.getStepAttributeBoolean( id_step, "file_add_date" );
    timeInFilename = rep.getStepAttributeBoolean( id_step, "file_add_time" );
    SpecifyFormat = rep.getStepAttributeBoolean( id_step, "SpecifyFormat" );
    date_time_format = rep.getStepAttributeString( id_step, "date_time_format" );

    autosizecolums = rep.getStepAttributeBoolean( id_step, "autosizecolums" );
    streamingData = rep.getStepAttributeBoolean( id_step, "stream_data" );
    protectsheet = rep.getStepAttributeBoolean( id_step, "protect_sheet" );
    password = Encr.decryptPasswordOptionallyEncrypted( rep.getStepAttributeString( id_step, "password" ) );
    protectedBy = rep.getStepAttributeString( id_step, "protected_by" );

    templateEnabled = rep.getStepAttributeBoolean( id_step, "template_enabled" );
    templateFileName = rep.getStepAttributeString( id_step, "template_filename" );
    templateSheetEnabled = rep.getStepAttributeBoolean( id_step, "template_sheet_enabled" );
    templateSheetHidden = rep.getStepAttributeBoolean( id_step, "template_sheet_hidden" );
    templateSheetName = rep.getStepAttributeString( id_step, "template_sheetname" );
    sheetname = rep.getStepAttributeString( id_step, "sheetname" );
    ifFileExists = rep.getStepAttributeString( id_step, "if_file_exists" );
    ifSheetExists = rep.getStepAttributeString( id_step, "if_sheet_exists" );

    int nrfields = rep.countNrStepAttributes( id_step, "field_name" );

    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      outputFields[i] = new ExcelWriterStepField();

      outputFields[i].setName( rep.getStepAttributeString( id_step, i, "field_name" ) );
      outputFields[i].setType( rep.getStepAttributeString( id_step, i, "field_type" ) );
      outputFields[i].setFormat( rep.getStepAttributeString( id_step, i, "field_format" ) );
      outputFields[i].setTitle( rep.getStepAttributeString( id_step, i, "field_title" ) );
      outputFields[i].setTitleStyleCell( rep.getStepAttributeString( id_step, i, "field_title_style_cell" ) );
      outputFields[i].setStyleCell( rep.getStepAttributeString( id_step, i, "field_style_cell" ) );
      outputFields[i].setCommentField( rep.getStepAttributeString( id_step, i, "field_comment_field" ) );
      outputFields[i].setCommentAuthorField( rep.getStepAttributeString(
        id_step, i, "field_comment_author_field" ) );
      outputFields[i].setFormula( rep.getStepAttributeBoolean( id_step, i, "field_formula" ) );
      outputFields[i].setHyperlinkField( rep.getStepAttributeString( id_step, i, "field_hyperlink_field" ) );

    }

  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 19
Source File: SalesforceInputMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId idStep, List<DatabaseMeta> databases ) throws KettleException {
  super.readRep( rep, metaStore, idStep, databases );
  try {
    // H.kawaguchi Add 19-01-2009
    setCondition( rep.getStepAttributeString( idStep, "condition" ) );
    // H.kawaguchi Add 19-01-2009
    setQuery( rep.getStepAttributeString( idStep, "query" ) );
    setSpecifyQuery( rep.getStepAttributeBoolean( idStep, "specifyQuery" ) );
    setIncludeTargetURL( rep.getStepAttributeBoolean( idStep, "include_targeturl" ) );
    setTargetURLField( rep.getStepAttributeString( idStep, "targeturl_field" ) );
    setIncludeModule( rep.getStepAttributeBoolean( idStep, "include_module" ) );
    setModuleField( rep.getStepAttributeString( idStep, "module_field" ) );
    setIncludeRowNumber( rep.getStepAttributeBoolean( idStep, "include_rownum" ) );
    setIncludeDeletionDate( rep.getStepAttributeBoolean( idStep, "include_deletion_date" ) );
    setRowNumberField( rep.getStepAttributeString( idStep, "rownum_field" ) );
    setDeletionDateField( rep.getStepAttributeString( idStep, "deletion_date_field" ) );
    setIncludeSQL( rep.getStepAttributeBoolean( idStep, "include_sql" ) );
    setSQLField( rep.getStepAttributeString( idStep, "sql_field" ) );
    setIncludeTimestamp( rep.getStepAttributeBoolean( idStep, "include_Timestamp" ) );
    setTimestampField( rep.getStepAttributeString( idStep, "timestamp_field" ) );
    setRowLimit( rep.getStepAttributeString( idStep, "limit" ) );
    setReadFrom( rep.getStepAttributeString( idStep, "read_from" ) );
    setReadTo( rep.getStepAttributeString( idStep, "read_to" ) );
    setRecordsFilter(
      SalesforceConnectionUtils.getRecordsFilterByCode( Const.NVL( rep.getStepAttributeString(
        idStep, "records_filter" ), "" ) ) );
    setQueryAll( rep.getStepAttributeBoolean( idStep, "queryAll" ) );

    int nrFields = rep.countNrStepAttributes( idStep, "field_name" );

    allocate( nrFields );

    for ( int i = 0; i < nrFields; i++ ) {
      SalesforceInputField field = new SalesforceInputField();
      field.readRep( rep, metaStore, idStep, i );
      inputFields[i] = field;
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "SalesforceInputMeta.Exception.ErrorReadingRepository" ), e );
  }
}
 
Example 20
Source File: JobExecutorMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@Override
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  String method = rep.getStepAttributeString( id_step, "specification_method" );
  specificationMethod = ObjectLocationSpecificationMethod.getSpecificationMethodByCode( method );
  String jobId = rep.getStepAttributeString( id_step, "job_object_id" );
  jobObjectId = Utils.isEmpty( jobId ) ? null : new StringObjectId( jobId );
  jobName = rep.getStepAttributeString( id_step, "job_name" );
  fileName = rep.getStepAttributeString( id_step, "filename" );
  directoryPath = rep.getStepAttributeString( id_step, "directory_path" );

  groupSize = rep.getStepAttributeString( id_step, "group_size" );
  groupField = rep.getStepAttributeString( id_step, "group_field" );
  groupTime = rep.getStepAttributeString( id_step, "group_time" );

  parameters = new JobExecutorParameters( rep, id_step );

  executionResultTargetStep = rep.getStepAttributeString( id_step, "execution_result_target_step" );
  executionResultField = rep.getStepAttributeString( id_step, "execution_result_field" );
  executionTimeField = rep.getStepAttributeString( id_step, "execution_time_field" );
  executionNrErrorsField = rep.getStepAttributeString( id_step, "execution_errors_field" );
  executionLinesReadField = rep.getStepAttributeString( id_step, "execution_lines_read_field" );
  executionLinesWrittenField = rep.getStepAttributeString( id_step, "execution_lines_written_field" );
  executionLinesInputField = rep.getStepAttributeString( id_step, "execution_lines_input_field" );
  executionLinesOutputField = rep.getStepAttributeString( id_step, "execution_lines_output_field" );
  executionLinesRejectedField = rep.getStepAttributeString( id_step, "execution_lines_rejected_field" );
  executionLinesUpdatedField = rep.getStepAttributeString( id_step, "execution_lines_updated_field" );
  executionLinesDeletedField = rep.getStepAttributeString( id_step, "execution_lines_deleted_field" );
  executionFilesRetrievedField = rep.getStepAttributeString( id_step, "execution_files_retrieved_field" );
  executionExitStatusField = rep.getStepAttributeString( id_step, "execution_exit_status_field" );
  executionLogTextField = rep.getStepAttributeString( id_step, "execution_log_text_field" );
  executionLogChannelIdField = rep.getStepAttributeString( id_step, "execution_log_channelid_field" );

  resultRowsTargetStep = rep.getStepAttributeString( id_step, "result_rows_target_step" );
  int nrFields = rep.countNrStepAttributes( id_step, "result_rows_field_name" );
  resultRowsField = new String[nrFields];
  resultRowsType = new int[nrFields];
  resultRowsLength = new int[nrFields];
  resultRowsPrecision = new int[nrFields];

  for ( int i = 0; i < nrFields; i++ ) {
    resultRowsField[i] = rep.getStepAttributeString( id_step, i, "result_rows_field_name" );
    resultRowsType[i] = ValueMetaFactory.getIdForValueMeta(
      rep.getStepAttributeString( id_step, i, "result_rows_field_type" ) );
    resultRowsLength[i] = (int) rep.getStepAttributeInteger( id_step, i, "result_rows_field_length" );
    resultRowsPrecision[i] = (int) rep.getStepAttributeInteger( id_step, i, "result_rows_field_precision" );
  }

  resultFilesTargetStep = rep.getStepAttributeString( id_step, "result_files_target_step" );
  resultFilesFileNameField = rep.getStepAttributeString( id_step, "result_files_file_name_field" );
}