本文整理汇总了Java中org.apache.metamodel.data.DataSetHeader类的典型用法代码示例。如果您正苦于以下问题:Java DataSetHeader类的具体用法?Java DataSetHeader怎么用?Java DataSetHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSetHeader类属于org.apache.metamodel.data包,在下文中一共展示了DataSetHeader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testDelegateOnPhysicalColumn
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
public void testDelegateOnPhysicalColumn() throws Exception {
final Column col1 = new MutableColumn("foo");
final InputColumn<?> inputColumn1 = new MetaModelInputColumn(col1);
final Column col2 = new MutableColumn("bar");
final InputColumn<?> inputColumn2 = new MetaModelInputColumn(col2);
final SelectItem[] selectItems = new SelectItem[] { new SelectItem(col1), new SelectItem(col2) };
final Object[] values = new Object[] { 1234, 4567 };
final DataSetHeader header = new SimpleDataSetHeader(selectItems);
final TransformedInputRow row =
new TransformedInputRow(new MetaModelInputRow(0, new DefaultRow(header, values)), 1);
assertEquals(1234, row.getValue(inputColumn1));
assertEquals(4567, row.getValue(inputColumn2));
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:17,代码来源:TransformedInputRowTest.java
示例2: getRow
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
@Override
public Row getRow() {
final DataSetHeader header = getHeader();
final Object[] values = new Object[header.size()];
if (row != null) {
for (int i = 0; i < header.size(); i++) {
final Column column = header.getSelectItem(i).getColumn();
final int kettleIndex = rowMeta.indexOfValue(column.getName());
final Object rawValue = row[kettleIndex];
try {
final ValueMetaInterface valueMeta = rowMeta.getValueMeta(kettleIndex);
values[i] = valueMeta.convertData(valueMeta, rawValue);
} catch (KettleValueException e) {
throw new MetaModelException(e);
}
}
}
return new DefaultRow(header, values);
}
开发者ID:datacleaner,项目名称:pdi-datacleaner,代码行数:22,代码来源:KettleDataSet.java
示例3: jsonNodeToMetaModelRow
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
/**
* Converts {@link JsonNode} to MetaModel {@link Row}.
*
* @param node
* {@link JsonNode} to convert.
* @param selectItems
* Column names for the values in the row.
* @return MetaModel {@link Row} populated with values from {@link JsonNode}
* .
*/
public static Row jsonNodeToMetaModelRow(JsonNode node, DataSetHeader header) {
final Map<String, ?> map = jsonNodeToMap(node);
final int size = header.size();
final Object[] values = new Object[size];
for (int i = 0; i < size; i++) {
final String key = header.getSelectItem(i).getColumn().getName();
final Object value = CollectionUtils.find(map, key);
values[i] = value;
}
final DefaultRow finalRow = new DefaultRow(header, values);
return finalRow;
}
开发者ID:apache,项目名称:metamodel,代码行数:26,代码来源:CouchDbUtils.java
示例4: createRow
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
/**
* Creates a MetaModel row based on an Excel row
*
* @param workbook
* @param row
* @param selectItems select items of the columns in the table
* @return
*/
public static DefaultRow createRow(Workbook workbook, Row row, DataSetHeader header) {
final int size = header.size();
final String[] values = new String[size];
final Style[] styles = new Style[size];
if (row != null) {
for (int i = 0; i < size; i++) {
final int columnNumber = header.getSelectItem(i).getColumn().getColumnNumber();
final Cell cell = row.getCell(columnNumber);
final String value = ExcelUtils.getCellValue(workbook, cell);
final Style style = ExcelUtils.getCellStyle(workbook, cell);
values[i] = value;
styles[i] = style;
}
}
return new DefaultRow(header, values, styles);
}
开发者ID:apache,项目名称:metamodel,代码行数:26,代码来源:ExcelUtils.java
示例5: executePrimaryKeyLookupQuery
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
@Override
protected Row executePrimaryKeyLookupQuery(Table table, List<SelectItem> selectItems, Column primaryKeyColumn,
Object keyValue) {
final org.apache.hadoop.hbase.client.Table hTable = getHTable(table.getName());
final Get get = new Get(ByteUtils.toBytes(keyValue));
try {
final Result result = hTable.get(get);
final DataSetHeader header = new SimpleDataSetHeader(selectItems);
final Row row = new HBaseRow(header, result);
return row;
} catch (IOException e) {
throw new IllegalStateException("Failed to execute HBase get operation with " + primaryKeyColumn.getName()
+ " = " + keyValue, e);
} finally {
FileHelper.safeClose(hTable);
}
}
开发者ID:apache,项目名称:metamodel,代码行数:18,代码来源:HBaseDataContext.java
示例6: toRow
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
/**
* Converts a Cassandra Row data object {@link com.datastax.driver.core.Row}
* into MetaModel {@link org.apache.metamodel.data.Row}.
*
* @param dbObject
* a Cassandra object storing data.
* @param header
* a header describing the columns of the data stored.
* @return the MetaModel {@link org.apache.metamodel.data.Row} result
* object.
*/
public static Row toRow(com.datastax.driver.core.Row dbObject, DataSetHeader header) {
if (dbObject == null) {
return null;
}
final int size = header.size();
final Object[] values = new Object[size];
for (int i = 0; i < values.length; i++) {
final SelectItem selectItem = header.getSelectItem(i);
final String key = selectItem.getColumn().getName();
values[i] = getColumnValue(key, dbObject);
}
return new DefaultRow(header, values);
}
开发者ID:apache,项目名称:metamodel,代码行数:27,代码来源:CassandraUtils.java
示例7: executePrimaryKeyLookupQuery
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
@Override
protected Row executePrimaryKeyLookupQuery(Table table, List<SelectItem> selectItems, Column primaryKeyColumn,
Object keyValue) {
if (keyValue == null) {
return null;
}
final String documentType = table.getName();
final String id = keyValue.toString();
final DataSetHeader header = new SimpleDataSetHeader(selectItems);
try {
return ElasticSearchUtils.createRow(getElasticSearchClient()
.get(new GetRequest(getIndexName(), documentType, id))
.getSource(), id, header);
} catch (IOException e) {
logger.warn("Could not execute ElasticSearch query", e);
throw new MetaModelException("Could not execute ElasticSearch query", e);
}
}
开发者ID:apache,项目名称:metamodel,代码行数:22,代码来源:ElasticSearchRestDataContext.java
示例8: executePrimaryKeyLookupQuery
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
@Override
protected Row executePrimaryKeyLookupQuery(Table table, List<SelectItem> selectItems, Column primaryKeyColumn,
Object keyValue) {
if (keyValue == null) {
return null;
}
final String documentType = table.getName();
final String id = keyValue.toString();
final GetResponse response = getElasticSearchClient().prepareGet(indexName, documentType, id).execute().actionGet();
if (!response.isExists()) {
return null;
}
final Map<String, Object> source = response.getSource();
final String documentId = response.getId();
final DataSetHeader header = new SimpleDataSetHeader(selectItems);
return ElasticSearchUtils.createRow(source, documentId, header);
}
开发者ID:apache,项目名称:metamodel,代码行数:24,代码来源:ElasticSearchDataContext.java
示例9: testCreateRowWithParsableDates
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
public void testCreateRowWithParsableDates() throws Exception {
SelectItem item1 = new SelectItem(new MutableColumn("value1", ColumnType.STRING));
SelectItem item2 = new SelectItem(new MutableColumn("value2", ColumnType.DATE));
List<SelectItem> selectItems1 = Arrays.asList(item1, item2);
String documentId = "doc1";
DataSetHeader header = new SimpleDataSetHeader(selectItems1);
Map<String, Object> values = new HashMap<>();
values.put("value1", "theValue");
values.put("value2", "2013-01-04T15:55:51.217+01:00");
Row row = ElasticSearchUtils.createRow(values, documentId, header);
Object stringValue = row.getValue(item1);
Object dateValue = row.getValue(item2);
assertTrue(stringValue instanceof String);
assertTrue(dateValue instanceof Date);
}
开发者ID:apache,项目名称:metamodel,代码行数:17,代码来源:ElasticSearchUtilsTest.java
示例10: getRow
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
@Override
public Row getRow() {
if (_record == null) {
return null;
}
final DataSetHeader header = getHeader();
final Object[] values = new Object[header.size()];
for (int i = 0; i < values.length; i++) {
final Column column = header.getSelectItem(i).getColumn();
final String fieldName = column.getName();
final Object value = _record.getField(fieldName);
final Object parsedValue = convert(value, column.getType());
values[i] = parsedValue;
}
return new DefaultRow(header, values);
}
开发者ID:apache,项目名称:metamodel,代码行数:19,代码来源:SalesforceDataSet.java
示例11: executePrimaryKeyLookupQuery
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
@Override
protected Row executePrimaryKeyLookupQuery(Table table, List<SelectItem> selectItems, Column primaryKeyColumn,
Object keyValue) {
final MongoCollection<Document> collection = _mongoDb.getCollection(table.getName());
final List<FilterItem> whereItems = new ArrayList<FilterItem>();
final SelectItem selectItem = new SelectItem(primaryKeyColumn);
final FilterItem primaryKeyWhereItem = new FilterItem(selectItem, OperatorType.EQUALS_TO, keyValue);
whereItems.add(primaryKeyWhereItem);
final Document query = createMongoDbQuery(table, whereItems, null);
final Document resultDoc = collection.find(query).first();
final DataSetHeader header = new SimpleDataSetHeader(selectItems);
final Row row = MongoDBUtils.toRow(resultDoc, header);
return row;
}
开发者ID:apache,项目名称:metamodel,代码行数:19,代码来源:MongoDbDataContext.java
示例12: toRow
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
/**
* Converts a map into MetaModel. This map stores data of a MongoDB document.
*
* @param map
* a map object storing data of a MongoDB document.
* @param header
* a header describing the columns of the data stored.
* @return the MetaModel {@link Row} result object.
*/
public static Row toRow(Map<?,?> map, DataSetHeader header) {
if (map == null) {
return null;
}
final int size = header.size();
final Object[] values = new Object[size];
for (int i = 0; i < values.length; i++) {
final SelectItem selectItem = header.getSelectItem(i);
final String key = selectItem.getColumn().getName();
final Object value = CollectionUtils.find(map, key);
values[i] = toValue(selectItem.getColumn(), value);
}
return new DefaultRow(header, values);
}
开发者ID:apache,项目名称:metamodel,代码行数:25,代码来源:MongoDBUtils.java
示例13: executePrimaryKeyLookupQuery
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
@Override
protected Row executePrimaryKeyLookupQuery(Table table, List<SelectItem> selectItems, Column primaryKeyColumn,
Object keyValue) {
final DBCollection collection = _mongoDb.getCollection(table.getName());
List<FilterItem> whereItems = new ArrayList<FilterItem>();
SelectItem selectItem = new SelectItem(primaryKeyColumn);
FilterItem primaryKeyWhereItem = new FilterItem(selectItem, OperatorType.EQUALS_TO, keyValue);
whereItems.add(primaryKeyWhereItem);
final DBObject query = createMongoDbQuery(table, whereItems);
final DBObject resultDBObject = collection.findOne(query);
DataSetHeader header = new SimpleDataSetHeader(selectItems);
Row row = MongoDBUtils.toRow(resultDBObject, header);
return row;
}
开发者ID:apache,项目名称:metamodel,代码行数:19,代码来源:MongoDbDataContext.java
示例14: testOrFilterItem
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
public void testOrFilterItem() throws Exception {
Column col1 = new MutableColumn("Col1", ColumnType.VARCHAR);
SelectItem s1 = new SelectItem(col1);
FilterItem c1 = new FilterItem(s1, OperatorType.EQUALS_TO, "foo");
FilterItem c2 = new FilterItem(s1, OperatorType.EQUALS_TO, "bar");
FilterItem c3 = new FilterItem(s1, OperatorType.EQUALS_TO, "foobar");
FilterItem filter = new FilterItem(c1, c2, c3);
assertEquals("(Col1 = 'foo' OR Col1 = 'bar' OR Col1 = 'foobar')", filter.toString());
DataSetHeader header = new SimpleDataSetHeader(new SelectItem[] { s1 });
assertTrue(filter.evaluate(new DefaultRow(header, new Object[] { "foo" })));
assertTrue(filter.evaluate(new DefaultRow(header, new Object[] { "bar" })));
assertTrue(filter.evaluate(new DefaultRow(header, new Object[] { "foobar" })));
assertFalse(filter.evaluate(new DefaultRow(header, new Object[] { "foob" })));
}
开发者ID:apache,项目名称:metamodel,代码行数:20,代码来源:FilterItemTest.java
示例15: materializeMainSchemaTable
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
@Override
protected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) {
if (_tableName.equals(table.getName())) {
final List<SelectItem> allSelectItems = table.getColumns().stream().map(SelectItem::new).collect(Collectors.toList());
final DataSetHeader header = new CachingDataSetHeader(allSelectItems);
final List<Row> data = new ArrayList<Row>();
data.add(new DefaultRow(header, new Object[] { "1", "hello", "world" }, null));
data.add(new DefaultRow(header, new Object[] { "2", _value, "world" }, null));
data.add(new DefaultRow(header, new Object[] { "3", "hi", _value }, null));
data.add(new DefaultRow(header, new Object[] { "4", "yo", "world" }, null));
final DataSet sourceDataSet = new InMemoryDataSet(header, data);
final List<SelectItem> columnSelectItems = columns.stream().map(SelectItem::new).collect(Collectors.toList());
final DataSet selectionDataSet = MetaModelHelper.getSelection(columnSelectItems, sourceDataSet);
return selectionDataSet;
} else if ("an_empty_table".equals(table.getName())) {
return new EmptyDataSet(columns.stream().map(SelectItem::new).collect(Collectors.toList()));
}
throw new UnsupportedOperationException();
}
开发者ID:apache,项目名称:metamodel,代码行数:22,代码来源:MockDataContext.java
示例16: next
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
@Override
public boolean next() {
final int index = _recordIndex.getAndIncrement();
if (index >= _records.size()) {
final int nextOffset = _entryList.getNextOffset();
if (nextOffset == _entryList.getTotalCount()) {
_record = null;
return false;
}
final DataSetHeader header = getHeader();
final List<SelectItem> selectItems = header.getSelectItems();
final List<Column> columns = selectItems.stream().map(si -> si.getColumn()).collect(Collectors.toList());
final String moduleName = selectItems.get(0).getColumn().getTable().getName();
final SelectFields selectFields = SugarCrmXmlHelper.createSelectFields(columns);
_entryList = _service.getEntryList(_session, moduleName, "", "", nextOffset, selectFields,
new LinkNamesToFieldsArray(), SugarCrmDataContext.FETCH_SIZE, 0, false);
_records = _entryList.getEntryList().getAny();
_recordIndex.set(0);
return next();
}
_record = (Node) _records.get(index);
return true;
}
开发者ID:apache,项目名称:metamodel,代码行数:27,代码来源:SugarCrmDataSet.java
示例17: testContainsInputColumn
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
public void testContainsInputColumn() throws Exception {
final SelectItem[] items =
new SelectItem[] { new SelectItem(new MutableColumn("foo")), new SelectItem(new MutableColumn("bar")) };
final Object[] values = new Object[] { "baz", null };
final DataSetHeader header = new SimpleDataSetHeader(items);
final MetaModelInputRow row = new MetaModelInputRow(1, new DefaultRow(header, values));
assertTrue(row.containsInputColumn(new MetaModelInputColumn(new MutableColumn("foo"))));
assertTrue(row.containsInputColumn(new MetaModelInputColumn(new MutableColumn("bar"))));
assertFalse(row.containsInputColumn(new MetaModelInputColumn(new MutableColumn("baz"))));
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:13,代码来源:MetaModelInputRowTest.java
示例18: materializeMainSchemaTable
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
@Override
public DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) {
try {
final com.healthmarketscience.jackcess.Table mdbTable = getDatabase().getTable(table.getName());
final List<SelectItem> selectItems = columns.stream().map(c -> new SelectItem(c)).collect(Collectors.toList());
final DataSetHeader header = new CachingDataSetHeader(selectItems);
int rowNum = 0;
final List<Row> data = new LinkedList<Row>();
final Iterator<com.healthmarketscience.jackcess.Row> it = mdbTable.iterator();
while (it.hasNext() && (maxRows < 0 || rowNum < maxRows)) {
rowNum++;
final com.healthmarketscience.jackcess.Row valueMap = it.next();
final Object[] values = new Object[columns.size()];
for (int j = 0; j < columns.size(); j++) {
values[j] = valueMap.get(columns.get(j).getName());
}
data.add(new DefaultRow(header, values));
}
return new InMemoryDataSet(header, data);
} catch (Exception e) {
throw new MetaModelException(e);
}
}
开发者ID:datacleaner,项目名称:metamodel_extras,代码行数:28,代码来源:AccessDataContext.java
示例19: testDelegateOnPhysicalColumn
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
public void testDelegateOnPhysicalColumn() throws Exception {
Column col1 = new MutableColumn("foo");
InputColumn<?> inputColumn1 = new MetaModelInputColumn(col1);
Column col2 = new MutableColumn("bar");
InputColumn<?> inputColumn2 = new MetaModelInputColumn(col2);
SelectItem[] selectItems = new SelectItem[] { new SelectItem(col1), new SelectItem(col2) };
Object[] values = new Object[] { 1234, 4567 };
DataSetHeader header = new SimpleDataSetHeader(selectItems);
TransformedInputRow row = new TransformedInputRow(new MetaModelInputRow(0, new DefaultRow(header, values)));
assertEquals(1234, row.getValue(inputColumn1));
assertEquals(4567, row.getValue(inputColumn2));
}
开发者ID:datacleaner,项目名称:AnalyzerBeans,代码行数:16,代码来源:TransformedInputRowTest.java
示例20: testContainsInputColumn
import org.apache.metamodel.data.DataSetHeader; //导入依赖的package包/类
public void testContainsInputColumn() throws Exception {
SelectItem[] items = new SelectItem[] { new SelectItem(new MutableColumn("foo")),
new SelectItem(new MutableColumn("bar")) };
Object[] values = new Object[] { "baz", null };
DataSetHeader header = new SimpleDataSetHeader(items);
MetaModelInputRow row = new MetaModelInputRow(1, new DefaultRow(header, values));
assertTrue(row.containsInputColumn(new MetaModelInputColumn(new MutableColumn("foo"))));
assertTrue(row.containsInputColumn(new MetaModelInputColumn(new MutableColumn("bar"))));
assertFalse(row.containsInputColumn(new MetaModelInputColumn(new MutableColumn("baz"))));
}
开发者ID:datacleaner,项目名称:AnalyzerBeans,代码行数:13,代码来源:MetaModelInputRowTest.java
注:本文中的org.apache.metamodel.data.DataSetHeader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论