use of org.pentaho.di.core.row.value.ValueMetaBoolean in project pentaho-kettle by pentaho.
the class SSHMeta method getFields.
@Override
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
if (!isDynamicCommand()) {
row.clear();
}
ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getStdOutFieldName()));
v.setOrigin(name);
row.addValueMeta(v);
String stderrfield = space.environmentSubstitute(getStdErrFieldName());
if (!Utils.isEmpty(stderrfield)) {
v = new ValueMetaBoolean(stderrfield);
v.setOrigin(name);
row.addValueMeta(v);
}
}
use of org.pentaho.di.core.row.value.ValueMetaBoolean in project pentaho-kettle by pentaho.
the class SystemDataMeta method getFields.
@Override
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
for (int i = 0; i < fieldName.length; i++) {
ValueMetaInterface v;
switch(fieldType[i]) {
// All date values...
case TYPE_SYSTEM_INFO_SYSTEM_START:
case TYPE_SYSTEM_INFO_SYSTEM_DATE:
case TYPE_SYSTEM_INFO_TRANS_DATE_FROM:
case TYPE_SYSTEM_INFO_TRANS_DATE_TO:
case TYPE_SYSTEM_INFO_JOB_DATE_FROM:
case TYPE_SYSTEM_INFO_JOB_DATE_TO:
case TYPE_SYSTEM_INFO_PREV_DAY_START:
case TYPE_SYSTEM_INFO_PREV_DAY_END:
case TYPE_SYSTEM_INFO_THIS_DAY_START:
case TYPE_SYSTEM_INFO_THIS_DAY_END:
case TYPE_SYSTEM_INFO_NEXT_DAY_START:
case TYPE_SYSTEM_INFO_NEXT_DAY_END:
case TYPE_SYSTEM_INFO_PREV_MONTH_START:
case TYPE_SYSTEM_INFO_PREV_MONTH_END:
case TYPE_SYSTEM_INFO_THIS_MONTH_START:
case TYPE_SYSTEM_INFO_THIS_MONTH_END:
case TYPE_SYSTEM_INFO_NEXT_MONTH_START:
case TYPE_SYSTEM_INFO_NEXT_MONTH_END:
case TYPE_SYSTEM_INFO_MODIFIED_DATE:
case TYPE_SYSTEM_INFO_KETTLE_BUILD_DATE:
case TYPE_SYSTEM_INFO_PREV_WEEK_START:
case TYPE_SYSTEM_INFO_PREV_WEEK_END:
case TYPE_SYSTEM_INFO_PREV_WEEK_OPEN_END:
case TYPE_SYSTEM_INFO_PREV_WEEK_START_US:
case TYPE_SYSTEM_INFO_PREV_WEEK_END_US:
case TYPE_SYSTEM_INFO_THIS_WEEK_START:
case TYPE_SYSTEM_INFO_THIS_WEEK_END:
case TYPE_SYSTEM_INFO_THIS_WEEK_OPEN_END:
case TYPE_SYSTEM_INFO_THIS_WEEK_START_US:
case TYPE_SYSTEM_INFO_THIS_WEEK_END_US:
case TYPE_SYSTEM_INFO_NEXT_WEEK_START:
case TYPE_SYSTEM_INFO_NEXT_WEEK_END:
case TYPE_SYSTEM_INFO_NEXT_WEEK_OPEN_END:
case TYPE_SYSTEM_INFO_NEXT_WEEK_START_US:
case TYPE_SYSTEM_INFO_NEXT_WEEK_END_US:
case TYPE_SYSTEM_INFO_PREV_QUARTER_START:
case TYPE_SYSTEM_INFO_PREV_QUARTER_END:
case TYPE_SYSTEM_INFO_THIS_QUARTER_START:
case TYPE_SYSTEM_INFO_THIS_QUARTER_END:
case TYPE_SYSTEM_INFO_NEXT_QUARTER_START:
case TYPE_SYSTEM_INFO_NEXT_QUARTER_END:
case TYPE_SYSTEM_INFO_PREV_YEAR_START:
case TYPE_SYSTEM_INFO_PREV_YEAR_END:
case TYPE_SYSTEM_INFO_THIS_YEAR_START:
case TYPE_SYSTEM_INFO_THIS_YEAR_END:
case TYPE_SYSTEM_INFO_NEXT_YEAR_START:
case TYPE_SYSTEM_INFO_NEXT_YEAR_END:
v = new ValueMetaDate(fieldName[i]);
break;
case TYPE_SYSTEM_INFO_TRANS_NAME:
case TYPE_SYSTEM_INFO_FILENAME:
case TYPE_SYSTEM_INFO_ARGUMENT_01:
case TYPE_SYSTEM_INFO_ARGUMENT_02:
case TYPE_SYSTEM_INFO_ARGUMENT_03:
case TYPE_SYSTEM_INFO_ARGUMENT_04:
case TYPE_SYSTEM_INFO_ARGUMENT_05:
case TYPE_SYSTEM_INFO_ARGUMENT_06:
case TYPE_SYSTEM_INFO_ARGUMENT_07:
case TYPE_SYSTEM_INFO_ARGUMENT_08:
case TYPE_SYSTEM_INFO_ARGUMENT_09:
case TYPE_SYSTEM_INFO_ARGUMENT_10:
case TYPE_SYSTEM_INFO_MODIFIED_USER:
case TYPE_SYSTEM_INFO_HOSTNAME:
case TYPE_SYSTEM_INFO_HOSTNAME_REAL:
case TYPE_SYSTEM_INFO_IP_ADDRESS:
case TYPE_SYSTEM_INFO_KETTLE_VERSION:
case TYPE_SYSTEM_INFO_KETTLE_BUILD_VERSION:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_LOG_TEXT:
v = new ValueMetaString(fieldName[i]);
break;
case TYPE_SYSTEM_INFO_COPYNR:
case TYPE_SYSTEM_INFO_TRANS_BATCH_ID:
case TYPE_SYSTEM_INFO_JOB_BATCH_ID:
case TYPE_SYSTEM_INFO_CURRENT_PID:
case TYPE_SYSTEM_INFO_JVM_TOTAL_MEMORY:
case TYPE_SYSTEM_INFO_JVM_FREE_MEMORY:
case TYPE_SYSTEM_INFO_JVM_MAX_MEMORY:
case TYPE_SYSTEM_INFO_JVM_AVAILABLE_MEMORY:
case TYPE_SYSTEM_INFO_AVAILABLE_PROCESSORS:
case TYPE_SYSTEM_INFO_JVM_CPU_TIME:
case TYPE_SYSTEM_INFO_TOTAL_PHYSICAL_MEMORY_SIZE:
case TYPE_SYSTEM_INFO_TOTAL_SWAP_SPACE_SIZE:
case TYPE_SYSTEM_INFO_COMMITTED_VIRTUAL_MEMORY_SIZE:
case TYPE_SYSTEM_INFO_FREE_PHYSICAL_MEMORY_SIZE:
case TYPE_SYSTEM_INFO_FREE_SWAP_SPACE_SIZE:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_EXIT_STATUS:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_ENTRY_NR:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_ERRORS:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_FILES:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_FILES_RETRIEVED:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_DELETED:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_INPUT:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_OUTPUT:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_READ:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_REJETED:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_UPDATED:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_NR_LINES_WRITTEN:
v = new ValueMetaInteger(fieldName[i]);
v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
break;
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_RESULT:
case TYPE_SYSTEM_INFO_PREVIOUS_RESULT_IS_STOPPED:
v = new ValueMetaBoolean(fieldName[i]);
break;
default:
v = new ValueMetaNone(fieldName[i]);
break;
}
v.setOrigin(name);
row.addValueMeta(v);
}
}
use of org.pentaho.di.core.row.value.ValueMetaBoolean in project pentaho-kettle by pentaho.
the class PropertyInputMeta method getFields.
public void getFields(RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
int i;
for (i = 0; i < inputFields.length; i++) {
PropertyInputField field = inputFields[i];
int type = field.getType();
if (type == ValueMetaInterface.TYPE_NONE) {
type = ValueMetaInterface.TYPE_STRING;
}
try {
ValueMetaInterface v = ValueMetaFactory.createValueMeta(space.environmentSubstitute(field.getName()), type);
v.setLength(field.getLength());
v.setPrecision(field.getPrecision());
v.setOrigin(name);
v.setConversionMask(field.getFormat());
v.setDecimalSymbol(field.getDecimalSymbol());
v.setGroupingSymbol(field.getGroupSymbol());
v.setCurrencySymbol(field.getCurrencySymbol());
r.addValueMeta(v);
} catch (Exception e) {
throw new KettleStepException(e);
}
}
String realFilenameField = space.environmentSubstitute(filenameField);
if (includeFilename && !Utils.isEmpty(realFilenameField)) {
ValueMetaInterface v = new ValueMetaString(realFilenameField);
v.setLength(500);
v.setPrecision(-1);
v.setOrigin(name);
r.addValueMeta(v);
}
String realRowNumberField = space.environmentSubstitute(rowNumberField);
if (includeRowNumber && !Utils.isEmpty(realRowNumberField)) {
ValueMetaInterface v = new ValueMetaInteger(realRowNumberField);
v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
v.setOrigin(name);
r.addValueMeta(v);
}
String realSectionField = space.environmentSubstitute(iniSectionField);
if (includeIniSection && !Utils.isEmpty(realSectionField)) {
ValueMetaInterface v = new ValueMetaString(realSectionField);
v.setLength(500);
v.setPrecision(-1);
v.setOrigin(name);
r.addValueMeta(v);
}
if (getShortFileNameField() != null && getShortFileNameField().length() > 0) {
ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getShortFileNameField()));
v.setLength(100, -1);
v.setOrigin(name);
r.addValueMeta(v);
}
if (getExtensionField() != null && getExtensionField().length() > 0) {
ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getExtensionField()));
v.setLength(100, -1);
v.setOrigin(name);
r.addValueMeta(v);
}
if (getPathField() != null && getPathField().length() > 0) {
ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getPathField()));
v.setLength(100, -1);
v.setOrigin(name);
r.addValueMeta(v);
}
if (getSizeField() != null && getSizeField().length() > 0) {
ValueMetaInterface v = new ValueMetaInteger(space.environmentSubstitute(getSizeField()));
v.setOrigin(name);
v.setLength(9);
r.addValueMeta(v);
}
if (isHiddenField() != null && isHiddenField().length() > 0) {
ValueMetaInterface v = new ValueMetaBoolean(space.environmentSubstitute(isHiddenField()));
v.setOrigin(name);
r.addValueMeta(v);
}
if (getLastModificationDateField() != null && getLastModificationDateField().length() > 0) {
ValueMetaInterface v = new ValueMetaDate(space.environmentSubstitute(getLastModificationDateField()));
v.setOrigin(name);
r.addValueMeta(v);
}
if (getUriField() != null && getUriField().length() > 0) {
ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getUriField()));
v.setLength(100, -1);
v.setOrigin(name);
r.addValueMeta(v);
}
if (getRootUriField() != null && getRootUriField().length() > 0) {
ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getRootUriField()));
v.setLength(100, -1);
v.setOrigin(name);
r.addValueMeta(v);
}
}
use of org.pentaho.di.core.row.value.ValueMetaBoolean in project pentaho-kettle by pentaho.
the class RegexEvalMeta method getFields.
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] infos, StepMeta nextSteps, VariableSpace space, Repository repositorys, IMetaStore metaStores) throws KettleStepException {
try {
if (!Utils.isEmpty(resultfieldname)) {
if (replacefields) {
int replaceIndex = inputRowMeta.indexOfValue(resultfieldname);
if (replaceIndex < 0) {
ValueMetaInterface v = new ValueMetaBoolean(space.environmentSubstitute(resultfieldname));
v.setOrigin(name);
inputRowMeta.addValueMeta(v);
} else {
ValueMetaInterface valueMeta = inputRowMeta.getValueMeta(replaceIndex);
ValueMetaInterface replaceMeta = ValueMetaFactory.cloneValueMeta(valueMeta, ValueMetaInterface.TYPE_BOOLEAN);
replaceMeta.setOrigin(name);
inputRowMeta.setValueMeta(replaceIndex, replaceMeta);
}
} else {
ValueMetaInterface v = new ValueMetaBoolean(space.environmentSubstitute(resultfieldname));
v.setOrigin(name);
inputRowMeta.addValueMeta(v);
}
}
if (allowcapturegroups == true) {
for (int i = 0; i < fieldName.length; i++) {
if (Utils.isEmpty(fieldName[i])) {
continue;
}
if (replacefields) {
int replaceIndex = inputRowMeta.indexOfValue(fieldName[i]);
if (replaceIndex < 0) {
inputRowMeta.addValueMeta(constructValueMeta(null, fieldName[i], i, name));
} else {
ValueMetaInterface valueMeta = inputRowMeta.getValueMeta(replaceIndex);
ValueMetaInterface replaceMeta = constructValueMeta(valueMeta, fieldName[i], i, name);
inputRowMeta.setValueMeta(replaceIndex, replaceMeta);
}
} else {
inputRowMeta.addValueMeta(constructValueMeta(null, fieldName[i], i, name));
}
}
}
} catch (Exception e) {
throw new KettleStepException(e);
}
}
use of org.pentaho.di.core.row.value.ValueMetaBoolean in project pdi-dataservice-server-plugin by pentaho.
the class ParameterPushdownTest method setUp.
@Before
public void setUp() throws Exception {
optimizationMeta = new PushDownOptimizationMeta();
optimizationMeta.setType(parameterPushdown);
optimizationMeta.setStepName("OUTPUT");
dataService = new DataServiceMeta(transMeta);
dataService.setStepname("OUTPUT");
dataService.getPushDownOptimizationMeta().add(optimizationMeta);
parameterPushdown.createDefinition().setFieldName("ARTIST").setParameter("ARTIST_FIELD").setFormat("artist: \"%s\",");
parameterPushdown.createDefinition().setFieldName("ALBUM").setParameter("ALBUM_FIELD").setFormat("album: \"%s\",");
parameterPushdown.createDefinition().setFieldName("LIVE").setParameter("LIVE_FIELD");
when(executor.getServiceTransMeta()).thenReturn(transMeta);
when(executor.getParameters()).thenReturn(parameters = Maps.newHashMap());
rowMeta = new RowMeta();
rowMeta.addValueMeta(new ValueMetaString("ARTIST"));
rowMeta.addValueMeta(new ValueMetaString("ALBUM"));
rowMeta.addValueMeta(new ValueMetaBoolean("LIVE"));
}
Aggregations