use of org.pentaho.di.core.row.value.ValueMetaString in project pentaho-kettle by pentaho.
the class SalesforceInsertTest method testWriteToSalesForceForNullExtIdField_WithExtIdYES.
@Test
public void testWriteToSalesForceForNullExtIdField_WithExtIdYES() throws Exception {
SalesforceInsert sfInputStep = new SalesforceInsert(smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans);
SalesforceInsertMeta meta = generateSalesforceInsertMeta(new String[] { ACCOUNT_EXT_ID_ACCOUNT_ID_C_ACCOUNT }, new Boolean[] { true });
SalesforceInsertData data = generateSalesforceInsertData();
sfInputStep.init(meta, data);
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaString("AccExtId");
rowMeta.addValueMeta(valueMeta);
smh.initStepDataInterface.inputRowMeta = rowMeta;
sfInputStep.writeToSalesForce(new Object[] { null });
assertEquals(1, data.sfBuffer[0].getFieldsToNull().length);
assertEquals(ACCOUNT_ID, data.sfBuffer[0].getFieldsToNull()[0]);
assertNull(SalesforceConnection.getChildren(data.sfBuffer[0]));
}
use of org.pentaho.di.core.row.value.ValueMetaString in project pentaho-kettle by pentaho.
the class SalesforceInputMeta 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++) {
SalesforceInputField 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);
}
}
if (includeTargetURL && !Utils.isEmpty(targetURLField)) {
ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(targetURLField));
v.setLength(250);
v.setPrecision(-1);
v.setOrigin(name);
r.addValueMeta(v);
}
if (includeModule && !Utils.isEmpty(moduleField)) {
ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(moduleField));
v.setLength(250);
v.setPrecision(-1);
v.setOrigin(name);
r.addValueMeta(v);
}
if (includeSQL && !Utils.isEmpty(sqlField)) {
ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(sqlField));
v.setLength(250);
v.setPrecision(-1);
v.setOrigin(name);
r.addValueMeta(v);
}
if (includeTimestamp && !Utils.isEmpty(timestampField)) {
ValueMetaInterface v = new ValueMetaDate(space.environmentSubstitute(timestampField));
v.setOrigin(name);
r.addValueMeta(v);
}
if (includeRowNumber && !Utils.isEmpty(rowNumberField)) {
ValueMetaInterface v = new ValueMetaInteger(space.environmentSubstitute(rowNumberField));
v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
v.setOrigin(name);
r.addValueMeta(v);
}
if (includeDeletionDate && !Utils.isEmpty(deletionDateField)) {
ValueMetaInterface v = new ValueMetaDate(space.environmentSubstitute(deletionDateField));
v.setOrigin(name);
r.addValueMeta(v);
}
}
use of org.pentaho.di.core.row.value.ValueMetaString in project pentaho-kettle by pentaho.
the class SalesforceInsertMeta method getFields.
/* This function adds meta data to the rows being pushed out */
public void getFields(RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
String realfieldname = space.environmentSubstitute(getSalesforceIDFieldName());
if (!Utils.isEmpty(realfieldname)) {
ValueMetaInterface v = new ValueMetaString(realfieldname);
v.setLength(18);
v.setOrigin(name);
r.addValueMeta(v);
}
}
use of org.pentaho.di.core.row.value.ValueMetaString in project pentaho-kettle by pentaho.
the class SalesforceUpsertMeta method getFields.
/* This function adds meta data to the rows being pushed out */
public void getFields(RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
String realfieldname = space.environmentSubstitute(getSalesforceIDFieldName());
if (!Utils.isEmpty(realfieldname)) {
ValueMetaInterface v = new ValueMetaString(realfieldname);
v.setLength(18);
v.setOrigin(name);
r.addValueMeta(v);
}
}
use of org.pentaho.di.core.row.value.ValueMetaString in project pentaho-kettle by pentaho.
the class JmsConsumerMeta method getRowMeta.
public RowMeta getRowMeta(String s, VariableSpace variableSpace) {
RowMeta rowMeta = new RowMeta();
rowMeta.addValueMeta(new ValueMetaString("message"));
return rowMeta;
}
Aggregations