本文整理汇总了Java中org.pentaho.di.core.RowMetaAndData类的典型用法代码示例。如果您正苦于以下问题:Java RowMetaAndData类的具体用法?Java RowMetaAndData怎么用?Java RowMetaAndData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RowMetaAndData类属于org.pentaho.di.core包,在下文中一共展示了RowMetaAndData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testProcessRow
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
@Test
public void testProcessRow() throws KettleException {
AddDOMXMLHandler addXML = new AddDOMXMLHandler(
stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0,
stepMockHelper.transMeta, stepMockHelper.trans);
Object[] row = new Object[] { "ROW_DATA" };
addXML.setRow(row);
addXML.init( stepMockHelper.initStepMetaInterface, stepMockHelper.initStepDataInterface );
RowMetaInterface inputRowMeta = createInputRowMeta();
addXML.setInputRowMeta(inputRowMeta);
RowStepCollector dummyRowCollector = new RowStepCollector();
addXML.addRowListener(dummyRowCollector);
assertTrue( addXML.processRow( stepMockHelper.initStepMetaInterface, stepMockHelper.processRowsStepDataInterface ) );
assertTrue( addXML.getErrors() == 0 );
assertTrue( addXML.getLinesWritten() > 0 );
List<RowMetaAndData> resultRows = dummyRowCollector.getRowsWritten();
Assert.assertEquals(ADDDOMXML_PROCESSROW_RESULT, DOMTestUtilities.toString((Document)resultRows.get(0).getData()[1]));
}
示例2: createExpectedResults
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
/**
* Create result data for test case 1. Each list object should mirror the output of the parsed JSON
*
* @return list of metadata/data couples of how the result should look.
*/
private List<RowMetaAndData> createExpectedResults() {
List<RowMetaAndData> list = new ArrayList<RowMetaAndData>();
ValueMetaInterface[] valuesMeta =
{ new ValueMeta("id", ValueMeta.TYPE_INTEGER), new ValueMeta("first_name", ValueMeta.TYPE_STRING),
new ValueMeta("last_name", ValueMeta.TYPE_STRING), new ValueMeta("city", ValueMeta.TYPE_STRING)};
RowMetaInterface rm = createRowMetaInterface(valuesMeta);
Object[] r1 = new Object[] { "123", "Jesse", "Adametz", "Santa Barbara" };
Object[] r2 = new Object[] { "456", "James", "Ebentier", "Santa Barbara" };
list.add(new RowMetaAndData(rm, r1));
list.add(new RowMetaAndData(rm, r2));
return list;
}
示例3: createDataRows
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
/**
* Create the input rows used for a unit test.
*/
public List<RowMetaAndData> createDataRows()
{
List<RowMetaAndData> list = new ArrayList<RowMetaAndData>();
RowMetaInterface rm = createRowMetaInterface();
Object[] r1 = new Object[] { new Long( 5L) };
Object[] r2 = new Object[] { new Long( 9L) };
Object[] r3 = new Object[] { new Long(20L) }; // non-existing one.
list.add(new RowMetaAndData(rm, r1));
list.add(new RowMetaAndData(rm, r2));
list.add(new RowMetaAndData(rm, r3));
return list;
}
示例4: createResultData4
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
/**
* Create result data for test case 4: indexOf.
*/
public List<RowMetaAndData> createResultData4()
{
List<RowMetaAndData> list = new ArrayList<RowMetaAndData>();
RowMetaInterface rm = createRowMetaInterfaceResult4();
Object[] r1 = new Object[] { "abcdefgh", "ef", new Long(3), new Long(10), new Long(4), new Long(4), new Long(-1) };
Object[] r2 = new Object[] { "abcdefgh", "h", new Long(0), new Long(7), new Long(7), new Long(7), new Long(7) };
Object[] r3 = new Object[] { "abcdefgh", "h", new Long(1), new Long(6), new Long(7), new Long(7), new Long(7) };
Object[] r4 = new Object[] { "abcdefgh", null, new Long(1), new Long(2), new Long(-1), new Long(-1), new Long(-1) };
Object[] r5 = new Object[] { "abcdefgh", "invalid", new Long(1), new Long(1), new Long(-1), new Long(-1), new Long(-1) };
Object[] r6 = new Object[] { "abcdefgh", "invalidlonger", new Long(1), new Long(1), new Long(-1), new Long(-1), new Long(-1) };
list.add(new RowMetaAndData(rm, r1));
list.add(new RowMetaAndData(rm, r2));
list.add(new RowMetaAndData(rm, r3));
list.add(new RowMetaAndData(rm, r4));
list.add(new RowMetaAndData(rm, r5));
list.add(new RowMetaAndData(rm, r6));
return list;
}
示例5: getJobsWithIDList
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
public String[] getJobsWithIDList(List<Object[]> list, RowMetaInterface rowMeta) throws KettleException
{
String[] jobList = new String[list.size()];
for (int i=0;i<list.size();i++)
{
long id_job = rowMeta.getInteger( list.get(i), quote(KettleDatabaseRepository.FIELD_JOB_ID_JOB), -1L);
if (id_job > 0)
{
RowMetaAndData jobRow = getJob(new LongObjectId(id_job));
if (jobRow!=null)
{
String jobName = jobRow.getString(KettleDatabaseRepository.FIELD_JOB_NAME, "<name not found>");
long id_directory = jobRow.getInteger(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY, -1L);
RepositoryDirectoryInterface dir = repository.loadRepositoryDirectoryTree().findDirectory(new LongObjectId(id_directory)); // always reload the directory tree!
jobList[i]=dir.getPathObjectCombination(jobName);
}
}
}
return jobList;
}
示例6: createData
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
public List<RowMetaAndData> createData()
{
List<RowMetaAndData> list = new ArrayList<RowMetaAndData>();
RowMetaInterface rm = createRowMetaInterface();
Object[] r1 = new Object[] { "KETTLE1", new Long(123L),
new Double(10.5D), new Date(),
Boolean.TRUE, BigDecimal.valueOf(123.45),
BigDecimal.valueOf(123.60) };
Object[] r2 = new Object[] { "KETTLE2", new Long(500L),
new Double(20.0D), new Date(),
Boolean.FALSE, BigDecimal.valueOf(123.45),
BigDecimal.valueOf(123.60) };
Object[] r3 = new Object[] { "KETTLE3", new Long(501L),
new Double(21.0D), new Date(),
Boolean.FALSE, BigDecimal.valueOf(123.45),
BigDecimal.valueOf(123.70) };
list.add(new RowMetaAndData(rm, r1));
list.add(new RowMetaAndData(rm, r2));
list.add(new RowMetaAndData(rm, r3));
return list;
}
示例7: getIDWithValue
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
private synchronized long getIDWithValue(String tablename, String idfield, String lookupfield, String value, String lookupkey[], long key[]) throws KettleException
{
RowMetaAndData par = new RowMetaAndData();
par.addValue(new ValueMeta(lookupfield, ValueMetaInterface.TYPE_STRING), value);
String sql = "SELECT " + idfield + " FROM " + tablename + " WHERE " + lookupfield + " = ? ";
for (int i = 0; i < lookupkey.length; i++)
{
par.addValue( new ValueMeta(lookupkey[i], ValueMetaInterface.TYPE_STRING), new Long(key[i]) );
sql += "AND " + lookupkey[i] + " = ? ";
}
RowMetaAndData result = database.getOneRow(sql, par.getRowMeta(), par.getData());
if (result != null && result.getRowMeta() != null && result.getData() != null && result.isNumeric(0))
return result.getInteger(0, 0);
return -1;
}
示例8: insertNote
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
public synchronized long insertNote(String note, long gui_location_x, long gui_location_y, long gui_location_width, long gui_location_height) throws KettleException
{
long id = getNextNoteID();
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMeta(FIELD_NOTE_ID_NOTE, ValueMetaInterface.TYPE_INTEGER), new Long(id));
table.addValue(new ValueMeta(FIELD_NOTE_VALUE_STR, ValueMetaInterface.TYPE_STRING), note);
table.addValue(new ValueMeta(FIELD_NOTE_GUI_LOCATION_X, ValueMetaInterface.TYPE_INTEGER), new Long(gui_location_x));
table.addValue(new ValueMeta(FIELD_NOTE_GUI_LOCATION_Y, ValueMetaInterface.TYPE_INTEGER), new Long(gui_location_y));
table.addValue(new ValueMeta(FIELD_NOTE_GUI_LOCATION_WIDTH, ValueMetaInterface.TYPE_INTEGER), new Long(gui_location_width));
table.addValue(new ValueMeta(FIELD_NOTE_GUI_LOCATION_HEIGHT, ValueMetaInterface.TYPE_INTEGER), new Long(gui_location_height));
database.prepareInsert(table.getRowMeta(), TABLE_R_NOTE);
database.setValuesInsert(table);
database.insertRow();
database.closeInsert();
return id;
}
示例9: testRegexEval1
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
public void testRegexEval1() throws Exception
{
String regexStepName = "regexeval";
RegexEvalMeta regexEvalMeta = new RegexEvalMeta();
regexEvalMeta.setScript("[abc]*");
regexEvalMeta.setMatcher("field1");
regexEvalMeta.setResultFieldName("res");
TransMeta transMeta = TransTestFactory.generateTestTransformation(new Variables(), regexEvalMeta, regexStepName);
// Now execute the transformation and get the result from the dummy step.
//
List<RowMetaAndData> result = TransTestFactory.executeTestTransformation
(
transMeta,
TransTestFactory.INJECTOR_STEPNAME,
regexStepName,
TransTestFactory.DUMMY_STEPNAME,
createSourceData()
);
checkRows(createResultData1(), result);
}
示例10: insertDirectory
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
private synchronized ObjectId insertDirectory(ObjectId id_directory_parent, RepositoryDirectoryInterface dir)
throws KettleException {
ObjectId id = repository.connectionDelegate.getNextDirectoryID();
String tablename = KettleDatabaseRepository.TABLE_R_DIRECTORY;
RowMetaAndData table = new RowMetaAndData();
table.addValue(
new ValueMeta(KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY, ValueMetaInterface.TYPE_INTEGER), id);
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY_PARENT,
ValueMetaInterface.TYPE_INTEGER), id_directory_parent);
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_DIRECTORY_DIRECTORY_NAME,
ValueMetaInterface.TYPE_STRING), dir.getName());
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), tablename);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:21,代码来源:KettleDatabaseRepositoryDirectoryDelegate.java
示例11: insertCluster
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
private synchronized ObjectId insertCluster(ClusterSchema clusterSchema) throws KettleException
{
if(getClusterID(clusterSchema.getName()) != null) {
// This cluster schema name is already in use. Throw an exception.
throw new KettleObjectExistsException("Failed to create object in repository. Object [" + clusterSchema.getName() + "] already exists.");
}
ObjectId id = repository.connectionDelegate.getNextClusterID();
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CLUSTER_ID_CLUSTER, ValueMetaInterface.TYPE_INTEGER), id);
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CLUSTER_NAME, ValueMetaInterface.TYPE_STRING), clusterSchema.getName());
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CLUSTER_BASE_PORT, ValueMetaInterface.TYPE_STRING), clusterSchema.getBasePort());
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_BUFFER_SIZE, ValueMetaInterface.TYPE_STRING), clusterSchema.getSocketsBufferSize());
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_FLUSH_INTERVAL, ValueMetaInterface.TYPE_STRING), clusterSchema.getSocketsFlushInterval());
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_COMPRESSED, ValueMetaInterface.TYPE_BOOLEAN), Boolean.valueOf(clusterSchema.isSocketsCompressed()));
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CLUSTER_DYNAMIC, ValueMetaInterface.TYPE_BOOLEAN), Boolean.valueOf(clusterSchema.isDynamic()));
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), KettleDatabaseRepository.TABLE_R_CLUSTER);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:27,代码来源:KettleDatabaseRepositoryClusterSchemaDelegate.java
示例12: insertJobEntryAttribute
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
public synchronized long insertJobEntryAttribute(long id_job, long id_jobentry, long nr, String code, double value_num,
String value_str) throws KettleException
{
long id = getNextJobEntryAttributeID();
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMeta(FIELD_JOBENTRY_ATTRIBUTE_ID_JOBENTRY_ATTRIBUTE, ValueMetaInterface.TYPE_INTEGER), new Long(id));
table.addValue(new ValueMeta(FIELD_JOBENTRY_ATTRIBUTE_ID_JOB, ValueMetaInterface.TYPE_INTEGER), new Long(id_job));
table.addValue(new ValueMeta(FIELD_JOBENTRY_ATTRIBUTE_ID_JOBENTRY, ValueMetaInterface.TYPE_INTEGER), new Long(id_jobentry));
table.addValue(new ValueMeta(FIELD_JOBENTRY_ATTRIBUTE_NR, ValueMetaInterface.TYPE_INTEGER), new Long(nr));
table.addValue(new ValueMeta(FIELD_JOBENTRY_ATTRIBUTE_CODE, ValueMetaInterface.TYPE_STRING), code);
table.addValue(new ValueMeta(FIELD_JOBENTRY_ATTRIBUTE_VALUE_NUM, ValueMetaInterface.TYPE_NUMBER), new Double(value_num));
table.addValue(new ValueMeta(FIELD_JOBENTRY_ATTRIBUTE_VALUE_STR, ValueMetaInterface.TYPE_STRING), value_str);
database.prepareInsert(table.getRowMeta(), TABLE_R_JOBENTRY_ATTRIBUTE);
database.setValuesInsert(table);
database.insertRow();
database.closeInsert();
return id;
}
示例13: createResultData1
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
/**
* Create result data for test case 1.
*/
public List<RowMetaAndData> createResultData1()
{
List<RowMetaAndData> list = new ArrayList<RowMetaAndData>();
RowMetaInterface rm = createRowMetaInterfaceResult1();
Object[] r1 = new Object[] { "446-667-651", Boolean.FALSE };
Object[] r2 = new Object[] { "446667651", Boolean.TRUE };
Object[] r3 = new Object[] { "4444333322221111", Boolean.TRUE };
Object[] r4 = new Object[] { "4444 3333 2222 1111", Boolean.FALSE };
Object[] r5 = new Object[] { "444433332aa2221111", Boolean.FALSE };
Object[] r6 = new Object[] { "4444333322221111aa", Boolean.FALSE };
list.add(new RowMetaAndData(rm, r1));
list.add(new RowMetaAndData(rm, r2));
list.add(new RowMetaAndData(rm, r3));
list.add(new RowMetaAndData(rm, r4));
list.add(new RowMetaAndData(rm, r5));
list.add(new RowMetaAndData(rm, r6));
return list;
}
示例14: getIDWithValue
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
public synchronized ObjectId getIDWithValue(String tablename, String idfield, String lookupfield, String value, String lookupkey[], ObjectId key[]) throws KettleException
{
RowMetaAndData par = new RowMetaAndData();
par.addValue(new ValueMeta(lookupfield, ValueMetaInterface.TYPE_STRING), value);
String sql = "SELECT " + idfield + " FROM " + tablename + " WHERE " + lookupfield + " = ? ";
for (int i = 0; i < lookupkey.length; i++)
{
par.addValue( new ValueMeta(lookupkey[i], ValueMetaInterface.TYPE_STRING), new LongObjectId(key[i]) );
sql += "AND " + lookupkey[i] + " = ? ";
}
RowMetaAndData result = getOneRow(sql, par.getRowMeta(), par.getData());
if (result != null && result.getRowMeta() != null && result.getData() != null && result.isNumeric(0)) {
return new LongObjectId(result.getInteger(0, 0));
}
return null;
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:20,代码来源:KettleDatabaseRepositoryConnectionDelegate.java
示例15: updateTableRow
import org.pentaho.di.core.RowMetaAndData; //导入依赖的package包/类
public synchronized void updateTableRow(String tablename, String idfield, RowMetaAndData values, ObjectId id) throws KettleException
{
String sets[] = new String[values.size()];
for (int i = 0; i < values.size(); i++)
sets[i] = values.getValueMeta(i).getName();
String codes[] = new String[] { idfield };
String condition[] = new String[] { "=" };
database.prepareUpdate(tablename, codes, condition, sets);
values.addValue(new ValueMeta(idfield, ValueMetaInterface.TYPE_INTEGER), id);
database.setValuesUpdate(values.getRowMeta(), values.getData());
database.updateRow();
database.closeUpdate();
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:17,代码来源:KettleDatabaseRepositoryConnectionDelegate.java