use of org.pentaho.di.trans.step.StepInjectionMetaEntry in project pentaho-kettle by pentaho.
the class ExcelWriterMetaInjection method getStepInjectionMetadataEntries.
@Override
public List<StepInjectionMetaEntry> getStepInjectionMetadataEntries() throws KettleException {
List<StepInjectionMetaEntry> all = new ArrayList<StepInjectionMetaEntry>();
StepInjectionMetaEntry fieldsEntry = new StepInjectionMetaEntry("FIELDS", ValueMetaInterface.TYPE_NONE, BaseMessages.getString(PKG, "ExcelWriterMetaInjection.AllFields"));
all.add(fieldsEntry);
StepInjectionMetaEntry fieldEntry = new StepInjectionMetaEntry("FIELD", ValueMetaInterface.TYPE_NONE, BaseMessages.getString(PKG, "ExcelWriterMetaInjection.AllFields"));
fieldsEntry.getDetails().add(fieldEntry);
for (Entry entry : Entry.values()) {
if (entry.getValueType() != ValueMetaInterface.TYPE_NONE) {
StepInjectionMetaEntry metaEntry = new StepInjectionMetaEntry(entry.name(), entry.getValueType(), entry.getDescription());
fieldEntry.getDetails().add(metaEntry);
}
}
return all;
}
use of org.pentaho.di.trans.step.StepInjectionMetaEntry in project pentaho-kettle by pentaho.
the class DataGridMetaInjection method getStepInjectionMetadataEntries.
@Override
public List<StepInjectionMetaEntry> getStepInjectionMetadataEntries() throws KettleException {
List<StepInjectionMetaEntry> all = new ArrayList<StepInjectionMetaEntry>();
// Add the fields...
//
StepInjectionMetaEntry fieldsEntry = new StepInjectionMetaEntry(Entry.FIELDS.name(), Entry.FIELDS.getValueType(), Entry.FIELDS.getDescription());
all.add(fieldsEntry);
StepInjectionMetaEntry fieldEntry = new StepInjectionMetaEntry(Entry.FIELD.name(), Entry.FIELD.getValueType(), Entry.FIELD.getDescription());
fieldsEntry.getDetails().add(fieldEntry);
for (Entry entry : Entry.values()) {
if (entry.getParent() == Entry.FIELD) {
StepInjectionMetaEntry metaEntry = new StepInjectionMetaEntry(entry.name(), entry.getValueType(), entry.getDescription());
fieldEntry.getDetails().add(metaEntry);
}
}
// And the data fields
//
StepInjectionMetaEntry sheetsEntry = new StepInjectionMetaEntry(Entry.DATA_LINES.name(), Entry.DATA_LINES.getValueType(), Entry.DATA_LINES.getDescription());
all.add(sheetsEntry);
StepInjectionMetaEntry sheetEntry = new StepInjectionMetaEntry(Entry.DATA_LINE.name(), Entry.DATA_LINE.getValueType(), Entry.DATA_LINE.getDescription());
sheetsEntry.getDetails().add(sheetEntry);
for (Entry entry : Entry.values()) {
if (entry.getParent() == Entry.DATA_LINE) {
StepInjectionMetaEntry metaEntry = new StepInjectionMetaEntry(entry.name(), entry.getValueType(), entry.getDescription());
sheetEntry.getDetails().add(metaEntry);
}
}
return all;
}
use of org.pentaho.di.trans.step.StepInjectionMetaEntry in project pentaho-kettle by pentaho.
the class DataGridMetaInjection method injectStepMetadataEntries.
@Override
public void injectStepMetadataEntries(List<StepInjectionMetaEntry> all) throws KettleException {
List<GridMetaEntry> gridMetaEntries = new ArrayList<GridMetaEntry>();
List<List<String>> dataLines = new ArrayList<List<String>>();
//
for (StepInjectionMetaEntry lookFields : all) {
Entry fieldsEntry = Entry.findEntry(lookFields.getKey());
if (fieldsEntry != null) {
if (fieldsEntry == Entry.FIELDS) {
for (StepInjectionMetaEntry lookField : lookFields.getDetails()) {
Entry fieldEntry = Entry.findEntry(lookField.getKey());
if (fieldEntry != null) {
if (fieldEntry == Entry.FIELD) {
GridMetaEntry gridMetaEntry = new GridMetaEntry();
List<StepInjectionMetaEntry> entries = lookField.getDetails();
for (StepInjectionMetaEntry entry : entries) {
Entry metaEntry = Entry.findEntry(entry.getKey());
if (metaEntry != null) {
String value = (String) entry.getValue();
switch(metaEntry) {
case NAME:
gridMetaEntry.fieldName = value;
break;
case TYPE:
gridMetaEntry.fieldType = value;
break;
case LENGTH:
gridMetaEntry.fieldLength = Const.toInt(value, -1);
break;
case PRECISION:
gridMetaEntry.fieldPrecision = Const.toInt(value, -1);
break;
case CURRENCY:
gridMetaEntry.currency = value;
break;
case GROUP:
gridMetaEntry.group = value;
break;
case DECIMAL:
gridMetaEntry.decimal = value;
break;
case FORMAT:
gridMetaEntry.fieldFormat = value;
break;
case EMPTY_STRING:
gridMetaEntry.setEmptyString = "Y".equalsIgnoreCase(value) || "TRUE".equalsIgnoreCase(value);
break;
default:
break;
}
}
}
gridMetaEntries.add(gridMetaEntry);
}
}
}
}
}
}
// Now that we know how many fields we have we can simply read all the data fields...
//
List<String> line = new ArrayList<String>();
for (StepInjectionMetaEntry lookFields : all) {
Entry fieldsEntry = Entry.findEntry(lookFields.getKey());
if (fieldsEntry != null) {
if (fieldsEntry == Entry.DATA_LINES) {
for (StepInjectionMetaEntry lookField : lookFields.getDetails()) {
Entry fieldEntry = Entry.findEntry(lookField.getKey());
if (fieldEntry != null) {
if (fieldEntry == Entry.DATA_LINE) {
List<StepInjectionMetaEntry> entries = lookField.getDetails();
for (StepInjectionMetaEntry entry : entries) {
Entry metaEntry = Entry.findEntry(entry.getKey());
if (metaEntry != null) {
String value = (String) entry.getValue();
switch(metaEntry) {
case DATA_VALUE:
line.add(value);
if (line.size() >= gridMetaEntries.size()) {
dataLines.add(line);
line = new ArrayList<String>();
}
break;
default:
break;
}
}
}
}
}
}
}
}
}
//
if (gridMetaEntries.size() > 0) {
meta.allocate(gridMetaEntries.size());
for (int i = 0; i < gridMetaEntries.size(); i++) {
GridMetaEntry entry = gridMetaEntries.get(i);
// CHECKSTYLE:Indentation:OFF
meta.getFieldName()[i] = entry.fieldName;
meta.getFieldType()[i] = entry.fieldType;
meta.getFieldFormat()[i] = entry.fieldFormat;
meta.getFieldLength()[i] = entry.fieldLength;
meta.getFieldPrecision()[i] = entry.fieldPrecision;
meta.getCurrency()[i] = entry.currency;
meta.getGroup()[i] = entry.group;
meta.getDecimal()[i] = entry.decimal;
meta.isSetEmptyString()[i] = entry.setEmptyString;
}
}
if (dataLines.size() > 0) {
// Set the data ...
//
meta.setDataLines(dataLines);
}
}
use of org.pentaho.di.trans.step.StepInjectionMetaEntry in project pentaho-kettle by pentaho.
the class DenormaliserMetaInjection method getStepInjectionMetadataEntries.
@Override
public List<StepInjectionMetaEntry> getStepInjectionMetadataEntries() throws KettleException {
List<StepInjectionMetaEntry> all = new ArrayList<StepInjectionMetaEntry>();
StepInjectionMetaEntry fieldsEntry = new StepInjectionMetaEntry("FIELDS", ValueMetaInterface.TYPE_NONE, "All the fields on the spreadsheets");
all.add(fieldsEntry);
StepInjectionMetaEntry fieldEntry = new StepInjectionMetaEntry("FIELD", ValueMetaInterface.TYPE_NONE, "All the fields on the spreadsheets");
fieldsEntry.getDetails().add(fieldEntry);
for (Entry entry : Entry.values()) {
if (entry.getValueType() != ValueMetaInterface.TYPE_NONE) {
StepInjectionMetaEntry metaEntry = new StepInjectionMetaEntry(entry.name(), entry.getValueType(), entry.getDescription());
fieldEntry.getDetails().add(metaEntry);
}
}
return all;
}
use of org.pentaho.di.trans.step.StepInjectionMetaEntry in project pentaho-kettle by pentaho.
the class ParGzipCsvInputMetaInjection method getStepInjectionMetadataEntries.
@Override
public List<StepInjectionMetaEntry> getStepInjectionMetadataEntries() throws KettleException {
List<StepInjectionMetaEntry> all = new ArrayList<StepInjectionMetaEntry>();
Entry[] topEntries = new Entry[] { Entry.FILENAME, Entry.FILENAME_FIELD, Entry.INCLUDING_FILENAMES, Entry.ROW_NUMBER_FIELD, Entry.HEADER_PRESENT, Entry.DELIMITER, Entry.ENCLOSURE, Entry.BUFFER_SIZE, Entry.LAZY_CONVERSION, Entry.ADD_FILES_TO_RESULT, Entry.RUN_IN_PARALLEL, Entry.ENCODING };
for (Entry topEntry : topEntries) {
all.add(new StepInjectionMetaEntry(topEntry.name(), topEntry.getValueType(), topEntry.getDescription()));
}
// The fields...
//
StepInjectionMetaEntry fieldsEntry = new StepInjectionMetaEntry(Entry.FIELDS.name(), ValueMetaInterface.TYPE_NONE, Entry.FIELDS.description);
all.add(fieldsEntry);
StepInjectionMetaEntry fieldEntry = new StepInjectionMetaEntry(Entry.FIELD.name(), ValueMetaInterface.TYPE_NONE, Entry.FIELD.description);
fieldsEntry.getDetails().add(fieldEntry);
Entry[] aggEntries = new Entry[] { Entry.FIELD_NAME, Entry.FIELD_POSITION, Entry.FIELD_LENGTH, Entry.FIELD_TYPE, Entry.FIELD_IGNORE, Entry.FIELD_FORMAT, Entry.FIELD_TRIM_TYPE, Entry.FIELD_PRECISION, Entry.FIELD_DECIMAL, Entry.FIELD_GROUP, Entry.FIELD_CURRENCY, Entry.FIELD_REPEAT, Entry.FIELD_NULL_STRING, Entry.FIELD_IF_NULL };
for (Entry entry : aggEntries) {
StepInjectionMetaEntry metaEntry = new StepInjectionMetaEntry(entry.name(), entry.getValueType(), entry.getDescription());
fieldEntry.getDetails().add(metaEntry);
}
return all;
}
Aggregations