当前位置: 首页>>代码示例>>Java>>正文


Java DataRow类代码示例

本文整理汇总了Java中org.apache.cayenne.DataRow的典型用法代码示例。如果您正苦于以下问题:Java DataRow类的具体用法?Java DataRow怎么用?Java DataRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataRow类属于org.apache.cayenne包,在下文中一共展示了DataRow类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReader

import org.apache.cayenne.DataRow; //导入依赖的package包/类
@Override
public RowReader getReader(Map<String, ?> parameters) {

	// TODO: fetching DataRows and then converting them to Object[] is kind
	// of expensive... maybe we can create Object[] bypassing DR, ideally by
	// iterating a JDBC ResultSet

	SQLSelect<DataRow> select = SQLSelect.dataRowQuery(sqlTemplate);
	select.params(parameters);

	switch (capsStrategy) {

	case LOWER:
		select.lowerColumnNames();
		break;
	case UPPER:
		select.upperColumnNames();
		break;
	case DEFAULT:
		select.upperColumnNames();
		break;
	}

	return new JdbcRowReader(attributes, context.iterator(select));
}
 
开发者ID:nhl,项目名称:link-move,代码行数:26,代码来源:JdbcExtractor.java

示例2: testAttributesFromDataRow

import org.apache.cayenne.DataRow; //导入依赖的package包/类
@Test
public void testAttributesFromDataRow() {

	DataRow row = new DataRow(5);
	row.put("A1", new Object());
	row.put("A2", null);
	row.put("A0", "aaaa");

	RowAttribute[] attributes = reader.attributesFromDataRow(row);
	assertNotNull(attributes);
	assertEquals(3, attributes.length);

	assertEquals("A0", attributes[0].getSourceName());
	assertEquals("db:A0", attributes[0].getTargetPath());
	
	assertEquals("A1", attributes[1].getSourceName());
	assertEquals("db:A1", attributes[1].getTargetPath());
	
	assertEquals("A2", attributes[2].getSourceName());
	assertEquals("db:A2", attributes[2].getTargetPath());
}
 
开发者ID:nhl,项目名称:link-move,代码行数:22,代码来源:JdbcRowReader_DynamicAttributesTest.java

示例3: createOrUpdateEtl8

import org.apache.cayenne.DataRow; //导入依赖的package包/类
private void createOrUpdateEtl8(int id, BigDecimal c1, BigDecimal c2, BigDecimal c3) {

		DataRow etl8 = getEtl8(id);
		if (etl8 == null) {
			srcRunSql(String.format("INSERT INTO utest.etl8 (ID, C_DECIMAL1, C_DECIMAL2, C_DECIMAL3) " +
				"VALUES (%d, %s, %s, %s)", id, c1, c2, c3));
		} else {
			srcRunSql(String.format("UPDATE utest.etl8 SET C_DECIMAL1 = %s, C_DECIMAL2 = %s, C_DECIMAL3 = %s " +
					"WHERE id = %d", c1, c2, c3, id));
		}

		etl8 = getEtl8(id);
		assertNotNull(etl8);
		assertEquals(c1, etl8.get("C_DECIMAL1"));
		assertEquals(c2, etl8.get("C_DECIMAL2"));
		assertEquals(c3, etl8.get("C_DECIMAL3"));
	}
 
开发者ID:nhl,项目名称:link-move,代码行数:18,代码来源:CreateOrUpdate_ValueConvertersIT.java

示例4: testRelate_ToMany_New

import org.apache.cayenne.DataRow; //导入依赖的package包/类
@Test
public void testRelate_ToMany_New() {

    insert("e2", "id, name", "24, 'xxx'");

    Response response = target("/e2/24/e3s")
            .request()
            .post(Entity.json("{\"name\":\"zzz\"}"));

    assertEquals(Status.OK.getStatusCode(), response.getStatus());
    assertEquals("{\"data\":[{REPLACED_ID,\"name\":\"zzz\",\"phoneNumber\":null}],\"total\":1}",
            response.readEntity(String.class).replaceFirst("\"id\":[\\d]+", "REPLACED_ID"));

    assertEquals(1, intForQuery("SELECT count(1) FROM utest.e3"));

    DataRow row = SQLSelect.dataRowQuery("SELECT e2_id, name FROM utest.e3").lowerColumnNames()
            .selectOne(newContext());
    assertEquals("zzz", row.get("name"));
    assertEquals(24, row.get("e2_id"));
}
 
开发者ID:nhl,项目名称:link-rest,代码行数:21,代码来源:POST_Related_IT.java

示例5: testRelate_ToMany_New_CompoundId

import org.apache.cayenne.DataRow; //导入依赖的package包/类
@Test
public void testRelate_ToMany_New_CompoundId() {

    insert("e17", "id1, id2, name", "1, 1, 'aaa'");

    Response response = target("/e17/e18s")
            .matrixParam("parentId1", 1)
            .matrixParam("parentId2", 1)
            .request()
            .post(Entity.json("{\"name\":\"xxx\"}"));

    assertEquals(Status.OK.getStatusCode(), response.getStatus());
    assertEquals("{\"data\":[{REPLACED_ID,\"name\":\"xxx\"}],\"total\":1}",
            response.readEntity(String.class).replaceFirst("\"id\":[\\d]+", "REPLACED_ID"));

    assertEquals(1, intForQuery("SELECT count(1) FROM utest.e18"));

    DataRow row = SQLSelect.dataRowQuery("SELECT e17_id1, e17_id2, name FROM utest.e18").lowerColumnNames()
            .selectOne(newContext());
    assertEquals("xxx", row.get("name"));
    assertEquals(1, row.get("e17_id1"));
    assertEquals(1, row.get("e17_id2"));
}
 
开发者ID:nhl,项目名称:link-rest,代码行数:24,代码来源:POST_Related_IT.java

示例6: filterSearchForProject

import org.apache.cayenne.DataRow; //导入依赖的package包/类
/**
 * Filter the results of a free-text SNOMED-CT search to include 
 * only the "common concepts" recorded for that project and its parent projects. 
 * While specifying root concepts is optional, it is more efficient to specify the same root concepts
 * that were used for the search to be filtered.
 * @param p - the project.
 * @param unfiltered - the unfiltered result of a search.
 * @param rootConcepts - root concepts - can be null but more efficient if specified.
 * @return
 */
public static List<ResultItem> filterSearchForProject(List<ResultItem> unfiltered, Project p, Collection<Long> rootConcepts) {
	final List<Project> parents = p.getOrderedParents().collect(Collectors.toList());
	Expression qual = ProjectConcept.PROJECT.in(parents);
	if (rootConcepts != null) {
		qual = qual.andExp(ProjectConcept.CONCEPT.dot(Concept.RECURSIVE_PARENT_CONCEPTS).dot(Concept.CONCEPT_ID).in(rootConcepts));
	}
	final List<DataRow> ids = SelectQuery.dataRowQuery(ProjectConcept.class, qual).select(p.getObjectContext());
	final Set<Long> commonConceptIds = ids.stream()
			.map(dr -> (Long) dr.get(ProjectConcept.CONCEPTCONCEPTID_PK_COLUMN))
			.distinct().collect(Collectors.toSet());
	return unfiltered.stream()
			.filter(ri -> commonConceptIds.contains(ri.getConceptId()))
			.collect(Collectors.toList());
}
 
开发者ID:wardle,项目名称:rsterminology,代码行数:25,代码来源:SearchUtilities.java

示例7: attributesFromDataRow

import org.apache.cayenne.DataRow; //导入依赖的package包/类
RowAttribute[] attributesFromDataRow(DataRow row) {

		List<String> names = new ArrayList<>(row.keySet());

		// ensure predictable order on each run...
		Collections.sort(names);

		RowAttribute[] attributes = new RowAttribute[row.size()];
		for (int i = 0; i < attributes.length; i++) {
			String name = names.get(i);
			attributes[i] = new BaseRowAttribute(Object.class, name, ASTDbPath.DB_PREFIX + name, i);
		}

		return attributes;
	}
 
开发者ID:nhl,项目名称:link-move,代码行数:16,代码来源:JdbcRowReader.java

示例8: JdbcRowReader

import org.apache.cayenne.DataRow; //导入依赖的package包/类
public JdbcRowReader(RowAttribute[] attributes, ResultIterator<DataRow> rows) {
	this.rows = rows;
	this.attributes = attributes;
}
 
开发者ID:nhl,项目名称:link-move,代码行数:5,代码来源:JdbcRowReader.java

示例9: DataRowRow

import org.apache.cayenne.DataRow; //导入依赖的package包/类
DataRowRow(RowAttribute[] attributes, DataRow row) {
	this.attributes = attributes;
	this.row = row;
}
 
开发者ID:nhl,项目名称:link-move,代码行数:5,代码来源:DataRowRow.java

示例10: before

import org.apache.cayenne.DataRow; //导入依赖的package包/类
@Before
public void before() {
	@SuppressWarnings("unchecked")
	ResultIterator<DataRow> rows = mock(ResultIterator.class);
	this.reader = new JdbcRowReader(null, rows);
}
 
开发者ID:nhl,项目名称:link-move,代码行数:7,代码来源:JdbcRowReader_DynamicAttributesTest.java

示例11: getEtl8

import org.apache.cayenne.DataRow; //导入依赖的package包/类
private DataRow getEtl8(int id) {
	return SQLSelect.dataRowQuery("SELECT ID, C_DECIMAL1, C_DECIMAL2, C_DECIMAL3 FROM utest.etl8 WHERE ID = " + id)
			.selectFirst(srcStack.runtime().newContext());
}
 
开发者ID:nhl,项目名称:link-move,代码行数:5,代码来源:CreateOrUpdate_ValueConvertersIT.java


注:本文中的org.apache.cayenne.DataRow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。