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

The following examples show how to use org.pentaho.di.repository.Repository#getStepAttributeString() . 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: CubeInputMeta.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 {
    filename = rep.getStepAttributeString( id_step, "file_name" );
    try {
      rowLimit = rep.getStepAttributeString( id_step, "limit" );
    } catch ( KettleException readOldAttributeType ) {
      // PDI-12897
      rowLimit = String.valueOf( rep.getStepAttributeInteger( id_step, "limit" ) );
    }
    addfilenameresult = rep.getStepAttributeBoolean( id_step, "addfilenameresult" );

  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "CubeInputMeta.Exception.UnexpectedErrorWhileReadingStepInfo" ), e );
  }
}
 
Example 2
Source File: CloneRowMeta.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 {
    nrclones = rep.getStepAttributeString( id_step, "nrclones" );
    addcloneflag = rep.getStepAttributeBoolean( id_step, "addcloneflag" );
    cloneflagfield = rep.getStepAttributeString( id_step, "cloneflagfield" );
    nrcloneinfield = rep.getStepAttributeBoolean( id_step, "nrcloneinfield" );
    nrclonefield = rep.getStepAttributeString( id_step, "nrclonefield" );
    addclonenum = rep.getStepAttributeBoolean( id_step, "addclonenum" );

    clonenumfield = rep.getStepAttributeString( id_step, "clonenumfield" );

  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "CloneRowMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
  }
}
 
Example 3
Source File: MappingIODefinition.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public MappingIODefinition( Repository rep, ObjectId id_step, String prefix, int nr ) throws KettleException {
  this();

  inputStepname = rep.getStepAttributeString( id_step, nr, prefix + "input_step" );
  outputStepname = rep.getStepAttributeString( id_step, nr, prefix + "output_step" );
  mainDataPath = rep.getStepAttributeBoolean( id_step, nr, prefix + "main_path" );
  renamingOnOutput = rep.getStepAttributeBoolean( id_step, nr, prefix + "rename_on_output" );
  description = rep.getStepAttributeString( id_step, nr, prefix + "description" );

  int nrRenames = (int) rep.getStepAttributeInteger( id_step, nr, prefix + "nr_renames" );
  for ( int i = 0; i < nrRenames; i++ ) {
    String parent = rep.getStepAttributeString( id_step, nr, prefix + "rename_parent_" + i );
    String child = rep.getStepAttributeString( id_step, nr, prefix + "rename_child_" + i );
    valueRenames.add( new MappingValueRename( parent, child ) );
  }
}
 
Example 4
Source File: KafkaProducerMeta.java    From pentaho-kafka-producer with Apache License 2.0 6 votes vote down vote up
public void readRep(Repository rep, ObjectId stepId, List<DatabaseMeta> databases, Map<String, Counter> counters)
		throws KettleException {
	try {
		topic = rep.getStepAttributeString(stepId, "TOPIC");
		messageField = rep.getStepAttributeString(stepId, "FIELD");
		keyField = rep.getStepAttributeString(stepId, "KEYFIELD");
		String kafkaPropsXML = rep.getStepAttributeString(stepId, "KAFKA");
		if (kafkaPropsXML != null) {
			kafkaProperties.loadFromXML(new ByteArrayInputStream(kafkaPropsXML.getBytes()));
		}
		// Support old versions:
		for (String name : KAFKA_PROPERTIES_NAMES) {
			String value = rep.getStepAttributeString(stepId, name);
			if (value != null) {
				kafkaProperties.put(name, value);
			}
		}
	} catch (Exception e) {
		throw new KettleException("KafkaProducerMeta.Exception.loadRep", e);
	}
}
 
Example 5
Source File: ValueMapperMeta.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 {
    fieldToUse = rep.getStepAttributeString( id_step, "field_to_use" );
    targetField = rep.getStepAttributeString( id_step, "target_field" );
    nonMatchDefault = rep.getStepAttributeString( id_step, "non_match_default" );

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

    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      sourceValue[i] = rep.getStepAttributeString( id_step, i, "source_value" );
      targetValue[i] = rep.getStepAttributeString( id_step, i, "target_value" );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "ValueMapperMeta.RuntimeError.UnableToReadRepository.VALUEMAPPER0005" ), e );
  }
}
 
Example 6
Source File: ChangeFileEncodingMeta.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 {
    filenamefield = rep.getStepAttributeString( id_step, "filenamefield" );
    targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" );
    sourceencoding = rep.getStepAttributeString( id_step, "sourceencoding" );
    targetencoding = rep.getStepAttributeString( id_step, "targetencoding" );

    addsourceresultfilenames = rep.getStepAttributeBoolean( id_step, "addsourceresultfilenames" );
    addtargetresultfilenames = rep.getStepAttributeBoolean( id_step, "addtargetresultfilenames" );
    createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" );

  } catch ( Exception e ) {
    throw new KettleException(
        BaseMessages.getString( PKG, "ChangeFileEncodingMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
  }
}
 
Example 7
Source File: GraphOutputMeta.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 6 votes vote down vote up
@Override public void readRep( Repository rep, IMetaStore metaStore, ObjectId stepId, List<DatabaseMeta> databases ) throws KettleException {
  connectionName = rep.getStepAttributeString( stepId, CONNECTION );
  model = rep.getStepAttributeString( stepId, MODEL );
  batchSize = rep.getStepAttributeString( stepId, BATCH_SIZE );
  creatingIndexes = rep.getStepAttributeBoolean( stepId, CREATE_INDEXES );
  returningGraph = rep.getStepAttributeBoolean( stepId, RETURNING_GRAPH );
  returnGraphField = rep.getStepAttributeString( stepId, RETURN_GRAPH_FIELD );

  fieldModelMappings = new ArrayList<>();
  int nrMappings = rep.countNrStepAttributes( stepId, SOURCE_FIELD );
  for ( int i = 0; i < nrMappings; i++ ) {
    String field = rep.getStepAttributeString( stepId, i, SOURCE_FIELD );
    ModelTargetType targetType = ModelTargetType.parseCode( rep.getStepAttributeString( stepId, i, TARGET_TYPE ) );
    String targetName = rep.getStepAttributeString( stepId, i, TARGET_NAME );
    String targetProperty = rep.getStepAttributeString( stepId, i, TARGET_PROPERTY );

    fieldModelMappings.add( new FieldModelMapping( field, targetType, targetName, targetProperty ) );
  }

}
 
Example 8
Source File: RegexEvalMeta.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 {
    script = rep.getStepAttributeString( id_step, "script" );
    matcher = rep.getStepAttributeString( id_step, "matcher" );
    resultfieldname = rep.getStepAttributeString( id_step, "resultfieldname" );
    usevar = rep.getStepAttributeBoolean( id_step, "usevar" );
    allowcapturegroups = rep.getStepAttributeBoolean( id_step, "allowcapturegroups" );
    replacefields = rep.getStepAttributeBoolean( id_step, "replacefields" );
    canoneq = rep.getStepAttributeBoolean( id_step, "canoneq" );
    caseinsensitive = rep.getStepAttributeBoolean( id_step, "caseinsensitive" );
    comment = rep.getStepAttributeBoolean( id_step, "comment" );
    multiline = rep.getStepAttributeBoolean( id_step, "multiline" );
    dotall = rep.getStepAttributeBoolean( id_step, "dotall" );
    unicode = rep.getStepAttributeBoolean( id_step, "unicode" );
    unix = rep.getStepAttributeBoolean( id_step, "unix" );

    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" );
      fieldType[i] = ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, "field_type" ) );

      fieldFormat[i] = rep.getStepAttributeString( id_step, i, "field_format" );
      fieldGroup[i] = rep.getStepAttributeString( id_step, i, "field_group" );
      fieldDecimal[i] = rep.getStepAttributeString( id_step, i, "field_decimal" );
      fieldLength[i] = (int) rep.getStepAttributeInteger( id_step, i, "field_length" );
      fieldPrecision[i] = (int) rep.getStepAttributeInteger( id_step, i, "field_precision" );
      fieldNullIf[i] = rep.getStepAttributeString( id_step, i, "field_nullif" );
      fieldIfNull[i] = rep.getStepAttributeString( id_step, i, "field_ifnull" );
      fieldCurrency[i] = rep.getStepAttributeString( id_step, i, "field_currency" );
      fieldTrimType[i] =
        ValueMetaString.getTrimTypeByCode( rep.getStepAttributeString( id_step, i, "field_trimtype" ) );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "RegexEvalMeta.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: GroupByMeta.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 {
    passAllRows = rep.getStepAttributeBoolean( id_step, "all_rows" );
    aggregateIgnored = rep.getStepAttributeBoolean( id_step, "ignore_aggregate" );
    aggregateIgnoredField = rep.getStepAttributeString( id_step, "field_ignore" );
    directory = rep.getStepAttributeString( id_step, "directory" );
    prefix = rep.getStepAttributeString( id_step, "prefix" );
    addingLineNrInGroup = rep.getStepAttributeBoolean( id_step, "add_linenr" );
    lineNrInGroupField = rep.getStepAttributeString( id_step, "linenr_fieldname" );

    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, "GroupByMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository" ), e );
  }
}
 
Example 11
Source File: SampleRowsMeta.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 {
    linesrange = rep.getStepAttributeString( id_step, "linesrange" );
    linenumfield = rep.getStepAttributeString( id_step, "linenumfield" );

  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "SampleRowsMeta.Exception.UnexpectedErrorReadingStepInfo" ), e );
  }
}
 
Example 12
Source File: S3CsvInputMeta.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 {
    awsAccessKey = Encr.decryptPasswordOptionallyEncrypted( rep.getStepAttributeString( id_step, "aws_access_key" ) );
    awsSecretKey = Encr.decryptPasswordOptionallyEncrypted( rep.getStepAttributeString( id_step, "aws_secret_key" ) );
    bucket = rep.getStepAttributeString( id_step, "bucket" );
    filename = rep.getStepAttributeString( id_step, "filename" );
    filenameField = rep.getStepAttributeString( id_step, "filename_field" );
    rowNumField = rep.getStepAttributeString( id_step, "rownum_field" );
    includingFilename = rep.getStepAttributeBoolean( id_step, "include_filename" );
    delimiter = rep.getStepAttributeString( id_step, "separator" );
    enclosure = rep.getStepAttributeString( id_step, "enclosure" );
    headerPresent = rep.getStepAttributeBoolean( id_step, "header" );
    maxLineSize = rep.getStepAttributeString( id_step, "max_line_size" );
    lazyConversionActive = rep.getStepAttributeBoolean( id_step, "lazy_conversion" );
    runningInParallel = rep.getStepAttributeBoolean( id_step, "parallel" );
    int nrfields = rep.countNrStepAttributes( id_step, "field_name" );

    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      inputFields[i] = new TextFileInputField();

      inputFields[i].setName( rep.getStepAttributeString( id_step, i, "field_name" ) );
      inputFields[i].setType( ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, "field_type" ) ) );
      inputFields[i].setFormat( rep.getStepAttributeString( id_step, i, "field_format" ) );
      inputFields[i].setCurrencySymbol( rep.getStepAttributeString( id_step, i, "field_currency" ) );
      inputFields[i].setDecimalSymbol( rep.getStepAttributeString( id_step, i, "field_decimal" ) );
      inputFields[i].setGroupSymbol( rep.getStepAttributeString( id_step, i, "field_group" ) );
      inputFields[i].setLength( (int) rep.getStepAttributeInteger( id_step, i, "field_length" ) );
      inputFields[i].setPrecision( (int) rep.getStepAttributeInteger( id_step, i, "field_precision" ) );
      inputFields[i].setTrimType( ValueMetaString.getTrimTypeByCode( rep.getStepAttributeString( id_step, i,
          "field_trim_type" ) ) );
    }
  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 13
Source File: Edi2XmlMeta.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 {
    inputField = rep.getStepAttributeString( id_step, "inputfield" );
    outputField = rep.getStepAttributeString( id_step, "outputfield" );
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages
      .getString( PKG, "Edi2Xml.Exception.UnexpectedErrorInReadingStepInfo" ), e );
  }
}
 
Example 14
Source File: TextFileOutputMeta.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 {
    separator = rep.getStepAttributeString( id_step, "separator" );
    enclosure = rep.getStepAttributeString( id_step, "enclosure" );
    enclosureForced = rep.getStepAttributeBoolean( id_step, "enclosure_forced" );
    disableEnclosureFix = rep.getStepAttributeBoolean( id_step, 0, "enclosure_fix_disabled", true );
    createparentfolder = rep.getStepAttributeBoolean( id_step, "create_parent_folder" );
    headerEnabled = rep.getStepAttributeBoolean( id_step, "header" );
    footerEnabled = rep.getStepAttributeBoolean( id_step, "footer" );
    fileFormat = rep.getStepAttributeString( id_step, "format" );
    setFileCompression( rep.getStepAttributeString( id_step, "compression" ) );
    fileNameInField = rep.getStepAttributeBoolean( id_step, "fileNameInField" );
    fileNameField = rep.getStepAttributeString( id_step, "fileNameField" );
    if ( getFileCompression() == null ) {
      if ( rep.getStepAttributeBoolean( id_step, "zipped" ) ) {
        setFileCompression( fileCompressionTypeCodes[FILE_COMPRESSION_TYPE_ZIP] );
      } else {
        setFileCompression( fileCompressionTypeCodes[FILE_COMPRESSION_TYPE_NONE] );
      }
    }
    encoding = rep.getStepAttributeString( id_step, "encoding" );

    fileName = loadSourceRep( rep, id_step, metaStore );
    servletOutput = rep.getStepAttributeBoolean( id_step, "file_servlet_output" );
    doNotOpenNewFileInit = rep.getStepAttributeBoolean( id_step, "do_not_open_new_file_init" );
    extension = rep.getStepAttributeString( id_step, "file_extention" );
    fileAppended = rep.getStepAttributeBoolean( id_step, "file_append" );

    splitEveryRows = rep.getStepAttributeString( id_step, "file_split_rows" );
    if ( Utils.isEmpty( splitEveryRows ) ) {
      // test for legacy
      long splitEvery = rep.getStepAttributeInteger( id_step, "file_split" );
      if ( splitEvery > 0 ) {
        splitEveryRows = Long.toString( splitEvery );
      }
    }

    stepNrInFilename = rep.getStepAttributeBoolean( id_step, "file_add_stepnr" );
    partNrInFilename = rep.getStepAttributeBoolean( id_step, "file_add_partnr" );
    dateInFilename = rep.getStepAttributeBoolean( id_step, "file_add_date" );
    timeInFilename = rep.getStepAttributeBoolean( id_step, "file_add_time" );
    setSpecifyingFormat( rep.getStepAttributeBoolean( id_step, "SpecifyFormat" ) );
    setDateTimeFormat( rep.getStepAttributeString( id_step, "date_time_format" ) );

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

    padded = rep.getStepAttributeBoolean( id_step, "file_pad" );
    fastDump = rep.getStepAttributeBoolean( id_step, "file_fast_dump" );

    newline = getNewLine( fileFormat );

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

    allocate( nrfields );

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

      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].setCurrencySymbol( rep.getStepAttributeString( id_step, i, "field_currency" ) );
      outputFields[i].setDecimalSymbol( rep.getStepAttributeString( id_step, i, "field_decimal" ) );
      outputFields[i].setGroupingSymbol( rep.getStepAttributeString( id_step, i, "field_group" ) );
      outputFields[i].setTrimType( ValueMetaString.getTrimTypeByCode( rep.getStepAttributeString( id_step, i,
          "field_trim_type" ) ) );
      outputFields[i].setNullString( rep.getStepAttributeString( id_step, i, "field_nullif" ) );
      outputFields[i].setLength( (int) rep.getStepAttributeInteger( id_step, i, "field_length" ) );
      outputFields[i].setPrecision( (int) rep.getStepAttributeInteger( id_step, i, "field_precision" ) );
    }
    endedLine = rep.getStepAttributeString( id_step, "endedLine" );

  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }
}
 
Example 15
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 16
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 17
Source File: TransExecutorMeta.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" );

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

  parameters = new TransExecutorParameters( rep, id_step );

  executionResultTargetStep = rep.getStepAttributeString( id_step, F_EXECUTION_RESULT_TARGET_STEP );
  executionTimeField = rep.getStepAttributeString( id_step, "execution_time_field" );
  executionResultField = rep.getStepAttributeString( id_step, "execution_result_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" );

  outputRowsSourceStep = rep.getStepAttributeString( id_step, "result_rows_target_step" );
  int nrFields = rep.countNrStepAttributes( id_step, "result_rows_field_name" );
  allocate( nrFields );

  for ( int i = 0; i < nrFields; i++ ) {
    outputRowsField[ i ] = rep.getStepAttributeString( id_step, i, "result_rows_field_name" );
    outputRowsType[ i ] = ValueMetaFactory.getIdForValueMeta(
      rep.getStepAttributeString( id_step, i, "result_rows_field_type" ) );
    outputRowsLength[ i ] = (int) rep.getStepAttributeInteger( id_step, i, "result_rows_field_length" );
    outputRowsPrecision[ i ] = (int) rep.getStepAttributeInteger( id_step, i, "result_rows_field_precision" );
  }

  resultFilesTargetStep = rep.getStepAttributeString( id_step, F_RESULT_FILE_TARGET_STEP );
  resultFilesFileNameField = rep.getStepAttributeString( id_step, "result_files_file_name_field" );
  executorsOutputStep = rep.getStepAttributeString( id_step, F_EXECUTOR_OUTPUT_STEP );
}
 
Example 18
Source File: OraBulkLoaderMeta.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 {
    this.databases = databases;
    databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
    commitSize = rep.getStepAttributeString( id_step, "commit" );
    bindSize = rep.getStepAttributeString( id_step, "bind_size" );
    readSize = rep.getStepAttributeString( id_step, "read_size" );
    maxErrors = rep.getStepAttributeString( id_step, "errors" );
    schemaName = rep.getStepAttributeString( id_step, "schema" );
    tableName = rep.getStepAttributeString( id_step, "table" );
    loadMethod = rep.getStepAttributeString( id_step, "load_method" );
    loadAction = rep.getStepAttributeString( id_step, "load_action" );
    sqlldr = rep.getStepAttributeString( id_step, "sqlldr" );
    controlFile = rep.getStepAttributeString( id_step, "control_file" );
    dataFile = rep.getStepAttributeString( id_step, "data_file" );
    logFile = rep.getStepAttributeString( id_step, "log_file" );
    badFile = rep.getStepAttributeString( id_step, "bad_file" );
    discardFile = rep.getStepAttributeString( id_step, "discard_file" );

    directPath = rep.getStepAttributeBoolean( id_step, "direct_path" );
    eraseFiles = rep.getStepAttributeBoolean( id_step, "erase_files" );
    encoding = rep.getStepAttributeString( id_step, "encoding" );
    dbNameOverride = rep.getStepAttributeString( id_step, "dbname_override" );

    characterSetName = rep.getStepAttributeString( id_step, "character_set" );
    failOnWarning = rep.getStepAttributeBoolean( id_step, "fail_on_warning" );
    failOnError = rep.getStepAttributeBoolean( id_step, "fail_on_error" );
    parallel = rep.getStepAttributeBoolean( id_step, "parallel" );
    altRecordTerm = rep.getStepAttributeString( id_step, "alt_rec_term" );

    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" );
      dateMask[i] = rep.getStepAttributeString( id_step, i, "date_mask" );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "OraBulkLoaderMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository" ), e );
  }
}
 
Example 19
Source File: MongoDbOutputMeta.java    From pentaho-mongodb-plugin 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 {
  setHostnames( rep.getStepAttributeString( id_step, 0, "mongo_host" ) ); //$NON-NLS-1$
  setPort( rep.getStepAttributeString( id_step, 0, "mongo_port" ) ); //$NON-NLS-1$
  setUseAllReplicaSetMembers( rep.getStepAttributeBoolean( id_step, 0, "use_all_replica_members" ) ); //$NON-NLS-1$
  setAuthenticationDatabaseName( rep.getStepAttributeString( id_step, 0, "mongo_auth_database" ) ); //$NON-NLS-1$
  setAuthenticationUser( rep.getStepAttributeString( id_step, 0, "mongo_user" ) ); //$NON-NLS-1$
  setAuthenticationPassword( rep.getStepAttributeString( id_step, 0, "mongo_password" ) ); //$NON-NLS-1$
  if ( !Const.isEmpty( getAuthenticationPassword() ) ) {
    setAuthenticationPassword( Encr.decryptPasswordOptionallyEncrypted( getAuthenticationPassword() ) );
  }
  setAuthenticationMechanism( rep.getStepAttributeString( id_step, "auth_mech" ) );
  setUseKerberosAuthentication( rep.getStepAttributeBoolean( id_step, "auth_kerberos" ) ); //$NON-NLS-1$
  setDbName( rep.getStepAttributeString( id_step, 0, "mongo_db" ) ); //$NON-NLS-1$
  setCollection( rep.getStepAttributeString( id_step, 0, "mongo_collection" ) ); //$NON-NLS-1$
  m_batchInsertSize = rep.getStepAttributeString( id_step, 0, "batch_insert_size" ); //$NON-NLS-1$

  setConnectTimeout( rep.getStepAttributeString( id_step, "connect_timeout" ) ); //$NON-NLS-1$
  setSocketTimeout( rep.getStepAttributeString( id_step, "socket_timeout" ) ); //$NON-NLS-1$
  setUseSSLSocketFactory( rep.getStepAttributeBoolean( id_step, 0, "use_ssl_socket_factory", false ) );
  setReadPreference( rep.getStepAttributeString( id_step, "read_preference" ) ); //$NON-NLS-1$
  setWriteConcern( rep.getStepAttributeString( id_step, "write_concern" ) ); //$NON-NLS-1$
  setWTimeout( rep.getStepAttributeString( id_step, "w_timeout" ) ); //$NON-NLS-1$
  setJournal( rep.getStepAttributeBoolean( id_step, 0, "journaled_writes" ) ); //$NON-NLS-1$

  m_truncate = rep.getStepAttributeBoolean( id_step, 0, "truncate" ); //$NON-NLS-1$
  m_update = rep.getStepAttributeBoolean( id_step, 0, "update" ); //$NON-NLS-1$
  m_upsert = rep.getStepAttributeBoolean( id_step, 0, "upsert" ); //$NON-NLS-1$
  m_multi = rep.getStepAttributeBoolean( id_step, 0, "multi" ); //$NON-NLS-1$
  m_modifierUpdate = rep.getStepAttributeBoolean( id_step, 0, "modifier_update" ); //$NON-NLS-1$

  if ( m_upsert || m_multi ) {
    m_update = true;
  }

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

  String writeRetries = rep.getStepAttributeString( id_step, "write_retries" ); //$NON-NLS-1$
  if ( !Const.isEmpty( writeRetries ) ) {
    m_writeRetries = writeRetries;
  }
  String writeRetryDelay = rep.getStepAttributeString( id_step, "write_retry_delay" ); //$NON-NLS-1$
  if ( !Const.isEmpty( writeRetryDelay ) ) {
    m_writeRetryDelay = writeRetryDelay;
  }

  if ( nrfields > 0 ) {
    m_mongoFields = new ArrayList<MongoField>();

    for ( int i = 0; i < nrfields; i++ ) {
      MongoField newField = new MongoField();

      newField.m_incomingFieldName = rep.getStepAttributeString( id_step, i, "incoming_field_name" ); //$NON-NLS-1$
      newField.m_mongoDocPath = rep.getStepAttributeString( id_step, i, "mongo_doc_path" ); //$NON-NLS-1$

      newField.m_useIncomingFieldNameAsMongoFieldName =
          rep.getStepAttributeBoolean( id_step, i, "use_incoming_field_name_as_mongo_field_name" ); //$NON-NLS-1$
      newField.m_updateMatchField = rep.getStepAttributeBoolean( id_step, i, "update_match_field" ); //$NON-NLS-1$
      newField.m_modifierUpdateOperation = rep.getStepAttributeString( id_step, i, "modifier_update_operation" ); //$NON-NLS-1$
      String policy = rep.getStepAttributeString( id_step, i, "modifier_policy" ); //$NON-NLS-1$
      if ( !Const.isEmpty( policy ) ) {
        newField.m_modifierOperationApplyPolicy = policy;
      }
      newField.m_JSON = rep.getStepAttributeBoolean( id_step, i, "json_field" ); //$NON-NLS-1$
      newField.insertNull = rep.getStepAttributeBoolean( id_step, i, "allow_null" ); //$NON-NLS-1$

      m_mongoFields.add( newField );
    }
  }

  nrfields = rep.countNrStepAttributes( id_step, "path_to_fields" ); //$NON-NLS-1$
  if ( nrfields > 0 ) {
    m_mongoIndexes = new ArrayList<MongoIndex>();

    for ( int i = 0; i < nrfields; i++ ) {
      MongoIndex newIndex = new MongoIndex();

      newIndex.m_pathToFields = rep.getStepAttributeString( id_step, i, "path_to_fields" ); //$NON-NLS-1$
      newIndex.m_drop = rep.getStepAttributeBoolean( id_step, i, "drop" ); //$NON-NLS-1$
      newIndex.m_unique = rep.getStepAttributeBoolean( id_step, i, "unique" ); //$NON-NLS-1$
      newIndex.m_sparse = rep.getStepAttributeBoolean( id_step, i, "sparse" ); //$NON-NLS-1$

      m_mongoIndexes.add( newIndex );
    }
  }
}
 
Example 20
Source File: PropertyInputMeta.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 {
    fileType = rep.getStepAttributeString( id_step, "file_type" );
    section = rep.getStepAttributeString( id_step, "section" );
    encoding = rep.getStepAttributeString( id_step, "encoding" );
    includeIniSection = rep.getStepAttributeBoolean( id_step, "ini_section" );
    iniSectionField = rep.getStepAttributeString( id_step, "ini_section_field" );
    includeFilename = rep.getStepAttributeBoolean( id_step, "include" );
    filenameField = rep.getStepAttributeString( id_step, "include_field" );
    dynamicFilenameField = rep.getStepAttributeString( id_step, "filename_Field" );
    includeRowNumber = rep.getStepAttributeBoolean( id_step, "rownum" );

    String addresult = rep.getStepAttributeString( id_step, "isaddresult" );
    if ( Utils.isEmpty( addresult ) ) {
      isaddresult = true;
    } else {
      isaddresult = rep.getStepAttributeBoolean( id_step, "isaddresult" );
    }

    filefield = rep.getStepAttributeBoolean( id_step, "filefield" );
    rowNumberField = rep.getStepAttributeString( id_step, "rownum_field" );
    resetRowNumber = rep.getStepAttributeBoolean( id_step, "reset_rownumber" );
    resolvevaluevariable = rep.getStepAttributeBoolean( id_step, "resolve_value_variable" );

    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] = RequiredFilesCode[0];
      }
      includeSubFolders[i] = rep.getStepAttributeString( id_step, i, "include_subfolders" );
      if ( !YES.equalsIgnoreCase( includeSubFolders[i] ) ) {
        includeSubFolders[i] = RequiredFilesCode[0];
      }
    }

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

      field.setName( rep.getStepAttributeString( id_step, i, "field_name" ) );
      field.setColumn( PropertyInputField.getColumnByCode( rep.getStepAttributeString(
        id_step, i, "field_column" ) ) );
      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( PropertyInputField.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" );
    uriNameFieldName = rep.getStepAttributeString( id_step, "uriNameFieldName" );
    rootUriNameFieldName = rep.getStepAttributeString( id_step, "rootUriNameFieldName" );
    extensionFieldName = rep.getStepAttributeString( id_step, "extensionFieldName" );
    sizeFieldName = rep.getStepAttributeString( id_step, "sizeFieldName" );
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages
      .getString( PKG, "PropertyInputMeta.Exception.ErrorReadingRepository" ), e );
  }
}