本文整理了Java中javax.jcr.query.Row.getValue
方法的一些代码示例,展示了Row.getValue
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Row.getValue
方法的具体详情如下:
包路径:javax.jcr.query.Row
类名称:Row
方法名:getValue
[英]Returns the value of the indicated column in this Row
.
[中]返回此Row
中指定列的值。
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons
public Value getValue(String propertyName) throws ItemNotFoundException, RepositoryException {
if (propertyName.startsWith(REP_EXCERPT)) {
propertyName = REP_EXCERPT + "(" + excerptPath + ")";
}
return row.getValue(propertyName);
}
代码示例来源:origin: apache/jackrabbit
public Object call(Query query) throws RepositoryException {
RowIterator rows = query.execute().getRows();
assertTrue("empty result", rows.hasNext());
Row r = rows.nextRow();
assertEquals("unexpected value", TEST_VALUE, r.getValue(columnName1).getString());
assertEquals("unexpected value", TEST_VALUE, r.getValue(columnName2).getString());
return null;
}
});
代码示例来源:origin: info.magnolia/magnolia-core
@Override
protected String featureValueOf(Row row) {
try {
return row.getValue(columnName).getString();
} catch (RepositoryException e) {
throw new RuntimeException(e);
}
}
};
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public Value getValue(String propertyName)
throws RepositoryException, RemoteException {
try {
return SerialValueFactory.makeSerialValue(row.getValue(propertyName));
} catch (RepositoryException ex) {
throw getRepositoryException(ex);
}
}
代码示例来源:origin: ModeShape/modeshape
@Override
public void validate( int rowNumber, Row row ) throws RepositoryException {
String actualValue = row.getValue("car:maker").getString();
expectedMakers.remove(actualValue);
}
}).validate(query, result);
代码示例来源:origin: ModeShape/modeshape
public Value getValue( String columnLabel ) throws SQLException {
notClosed();
isRowSet();
try {
return row.getValue(columnLabel);
} catch (PathNotFoundException pnfe) {
return null;
} catch (RepositoryException e) {
throw new SQLException(e.getLocalizedMessage(), e);
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
@Override
public boolean isTraversal(ResourceResolver resourceResolver, String language, String statement) throws RepositoryException {
final QueryManager queryManager = resourceResolver.adaptTo(Session.class).getWorkspace().getQueryManager();
final Query query = queryManager.createQuery("explain " + statement, language);
final QueryResult queryResult = query.execute();
final RowIterator rows = queryResult.getRows();
final Row firstRow = rows.nextRow();
final String plan = firstRow.getValue("plan").getString();
return StringUtils.contains(plan, " /* traverse ");
}
代码示例来源:origin: apache/jackrabbit
public Object next() throws NoSuchElementException {
Row next = (Row) super.next();
try {
return superuser.getItem(next.getValue("jcr:path").getString());
} catch (RepositoryException e) {
throw new NoSuchElementException();
}
}
}, nodes);
代码示例来源:origin: apache/jackrabbit-oak
static String getResult(QueryResult result, String propertyName) throws RepositoryException {
StringBuilder buff = new StringBuilder();
RowIterator it = result.getRows();
while (it.hasNext()) {
if (buff.length() > 0) {
buff.append(", ");
}
buff.append(it.nextRow().getValue(propertyName).getString());
}
return buff.toString();
}
代码示例来源:origin: ModeShape/modeshape
@Override
public RowResult has( String columnName,
long value ) throws RepositoryException {
assertThat(row.getValue(columnName).getLong(), is(value));
return this;
}
代码示例来源:origin: apache/jackrabbit-oak
static List<String> getResult(QueryResult result, String propertyName) throws RepositoryException {
List<String> results = Lists.newArrayList();
RowIterator it = result.getRows();
while (it.hasNext()) {
Row row = it.nextRow();
results.add(row.getValue(propertyName).getString());
}
return results;
}
代码示例来源:origin: apache/jackrabbit-oak
static List<String> getResult(QueryResult result, String propertyName) throws RepositoryException {
List<String> results = Lists.newArrayList();
RowIterator it = result.getRows();
while (it.hasNext()) {
Row row = it.nextRow();
results.add(row.getValue(propertyName).getString());
}
return results;
}
代码示例来源:origin: ModeShape/modeshape
@Override
public void validate( int rowNumber,
Row row ) throws RepositoryException {
String pathStr = row.getValue("jcr:path").getString();
Path path = path(pathStr);
if (lastPath != null) {
assertThat(path.compareTo(lastPath) >= 0, is(true));
}
lastPath = path;
}
};
代码示例来源:origin: apache/jackrabbit-oak
private static double getCost(Session session, String xpath) throws RepositoryException {
QueryManager qm = session.getWorkspace().getQueryManager();
QueryResult qr = qm.createQuery("explain measure " + xpath, "xpath").execute();
Row r = qr.getRows().nextRow();
String plan = r.getValue("plan").getString();
String cost = plan.substring(plan.lastIndexOf('{'));
JsonObject json = parseJson(cost);
double c = Double.parseDouble(json.getProperties().get("a"));
return c;
}
代码示例来源:origin: ModeShape/modeshape
protected void assertResultsHaveRows( QueryResult result,
String columnName,
String... rowValuesAsStrings ) throws RepositoryException {
RowIterator iter = result.getRows();
int i = 0;
while (iter.hasNext()) {
Row row = iter.nextRow();
assertThat(row.getValue(columnName).getString(), is(rowValuesAsStrings[i++]));
}
}
代码示例来源:origin: apache/jackrabbit-oak
private static String getQueryPlan(RepositoryFixture fixture, String query) throws RepositoryException, IOException {
Session session = fixture.getAdminSession();
QueryManager qm = session.getWorkspace().getQueryManager();
Query explain = qm.createQuery("explain "+query, Query.JCR_SQL2);
QueryResult explainResult = explain.execute();
Row explainRow = explainResult.getRows().nextRow();
String explanation = explainRow.getValue("plan").getString();
session.logout();
return explanation;
}
代码示例来源:origin: ModeShape/modeshape
@Override
public void validate( int rowNumber,
Row row ) throws RepositoryException {
String id = row.getValue("mode:id").getString();
Node nodeFromQuery = row.getNode();
assertSame(nodeFromQuery, expectedNode);
assertSame(nodeFromQuery.getIdentifier(), id);
}
}).validate(query, result);
代码示例来源:origin: apache/jackrabbit-oak
private static String getPlan(Session session, String xpath) throws RepositoryException {
QueryManager qm = session.getWorkspace().getQueryManager();
QueryResult qr = qm.createQuery("explain " + xpath, "xpath").execute();
Row r = qr.getRows().nextRow();
String plan = r.getValue("plan").getString();
return plan;
}
代码示例来源:origin: apache/jackrabbit-oak
private Set<String> getSuggestions(String query) throws Exception {
QueryManager queryManager = session.getWorkspace().getQueryManager();
QueryResult result = queryManager.createQuery(query, Query.JCR_SQL2).execute();
RowIterator rows = result.getRows();
Set<String> suggestions = newHashSet();
while (rows.hasNext()) {
suggestions.add(rows.nextRow().getValue("suggestion").getString());
}
return suggestions;
}
代码示例来源:origin: apache/jackrabbit-oak
private Set<String> getSpellchecks(String query) throws Exception {
QueryManager queryManager = session.getWorkspace().getQueryManager();
QueryResult result = queryManager.createQuery(query, Query.JCR_SQL2).execute();
RowIterator rows = result.getRows();
Set<String> suggestions = newHashSet();
while (rows.hasNext()) {
suggestions.add(rows.nextRow().getValue("spellcheck").getString());
}
return suggestions;
}
内容来源于网络,如有侵权,请联系作者删除!