本文整理了Java中javax.jcr.query.Query.getLanguage
方法的一些代码示例,展示了Query.getLanguage
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getLanguage
方法的具体详情如下:
包路径:javax.jcr.query.Query
类名称:Query
方法名:getLanguage
[英]Returns the language set for this query. This will be one of the query language constants returned by QueryManager#getSupportedQueryLanguages.
[中]返回此查询的语言集。这将是QueryManager#getSupportedQueryLanguages返回的查询语言常量之一。
代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector
/**
* @inheritDoc
*/
public String getLanguage() {
return query.getLanguage();
}
代码示例来源:origin: info.magnolia/magnolia-core
@Override
public String getLanguage() {
return this.query.getLanguage();
}
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public String getLanguage() throws RemoteException {
return query.getLanguage();
}
代码示例来源:origin: net.adamcin.oakpal/oakpal-core
@Override
public String getLanguage() {
return delegate.getLanguage();
}
代码示例来源:origin: brix-cms/brix-cms
public String getLanguage() {
return getDelegate().getLanguage();
}
代码示例来源:origin: brix-cms/brix-cms
public String execute() throws Exception {
return getDelegate().getLanguage();
}
});
代码示例来源:origin: apache/jackrabbit
/**
* Tests if a JCR_SQL2 query returns {@link Query#JCR_SQL2} when calling
* {@link Query#getLanguage()}.
*/
public void testJCRSQL2() throws RepositoryException {
String stmt = "SELECT * FROM [" + testNodeType + "]";
Query q = session.getWorkspace().getQueryManager().createQuery(stmt, Query.JCR_SQL2);
assertEquals("Query returns wrong language.", Query.JCR_SQL2, q.getLanguage());
}
代码示例来源:origin: apache/jackrabbit
/**
* Tests if a XPath query returns {@link Query#XPATH} when calling
* {@link Query#getLanguage()}.
*/
public void testGetLanguage() throws RepositoryException {
String statement = "/" + jcrRoot;
Query q = session.getWorkspace().getQueryManager().createQuery(statement, qsXPATH);
assertEquals("Query returns wrong language.", qsXPATH, q.getLanguage());
}
代码示例来源:origin: org.onehippo.cms7.essentials/hippo-essentials-plugin-api-implementation
private static void extractPrototype(final JcrMatcher matcher, final Map<String, Set<String>> types, final QueryManager qmgr, final Node queryTemplate) throws RepositoryException {
try {
Set<String> prototypes = new TreeSet<>();
if (queryTemplate.isNodeType("nt:query")) {
Query query = qmgr.getQuery(queryTemplate);
query = qmgr.createQuery(queryTemplate.getProperty("jcr:statement").getString(), query.getLanguage()); // HREPTWO-1266
QueryResult rs = query.execute();
for (NodeIterator iter = rs.getNodes(); iter.hasNext(); ) {
Node typeNode = iter.nextNode();
if (typeNode.getName().equals(EssentialConst.HIPPOSYSEDIT_PROTOTYPE)) {
String documentType = typeNode.getPrimaryNodeType().getName();
final boolean isTemplate = INTERNAL_TYPES_PREDICATE.apply(documentType);
if (isTemplate && (matcher == null || matcher.matches(typeNode))) {
prototypes.add(documentType);
}
} else {
prototypes.add(typeNode.getName());
}
}
}
types.put(queryTemplate.getName(), prototypes);
} catch (InvalidQueryException ex) {
log.error(MessageFormat.format("{0}: {1}", ex.getClass().getName(), ex.getMessage()), ex);
}
}
代码示例来源:origin: org.onehippo.cms7.essentials.sdk/implementation
private static void extractPrototype(final JcrMatcher matcher, final Map<String, Set<String>> types, final QueryManager qmgr, final Node queryTemplate) throws RepositoryException {
try {
Set<String> prototypes = new TreeSet<>();
if (queryTemplate.isNodeType("nt:query")) {
Query query = qmgr.getQuery(queryTemplate);
query = qmgr.createQuery(queryTemplate.getProperty("jcr:statement").getString(), query.getLanguage()); // HREPTWO-1266
QueryResult rs = query.execute();
for (NodeIterator iter = rs.getNodes(); iter.hasNext(); ) {
Node typeNode = iter.nextNode();
if (typeNode.getName().equals(EssentialConst.HIPPOSYSEDIT_PROTOTYPE)) {
String documentType = typeNode.getPrimaryNodeType().getName();
final boolean isTemplate = INTERNAL_TYPES_PREDICATE.apply(documentType);
if (isTemplate && (matcher == null || matcher.matches(typeNode))) {
prototypes.add(documentType);
}
} else {
prototypes.add(typeNode.getName());
}
}
}
types.put(queryTemplate.getName(), prototypes);
} catch (InvalidQueryException ex) {
log.error(MessageFormat.format("{0}: {1}", ex.getClass().getName(), ex.getMessage()), ex);
}
}
代码示例来源:origin: org.onehippo.cms7/hippo-repository-workflow
if (foldertype.isNodeType("nt:query")) {
Query query = qmgr.getQuery(foldertype);
query = qmgr.createQuery(foldertype.getProperty("jcr:statement").getString(), query.getLanguage()); // HREPTWO-1266
QueryResult rs = query.execute();
for (NodeIterator iter = rs.getNodes(); iter.hasNext();) {
代码示例来源:origin: apache/jackrabbit
/**
* Tests if a SQL query returns {@link Query#SQL} when calling
* {@link Query#getLanguage()}.
*/
public void testSQL() throws RepositoryException, NotExecutableException {
if (isSupportedLanguage(qsSQL)) {
String stmt = "select * from " + testNodeType;
Query q = session.getWorkspace().getQueryManager().createQuery(stmt, qsSQL);
assertEquals("Query returns wrong language.", qsSQL, q.getLanguage());
} else {
throw new NotExecutableException("SQL not supported");
}
}
代码示例来源:origin: apache/jackrabbit
String lang = q.getLanguage();
checkResult(q.execute(), new Node[]{n});
assertEquals("language of stored query does not match", lang, q.getLanguage());
checkResult(q.execute(), new Node[]{n});
stored.remove();
代码示例来源:origin: org.onehippo.cms7/hippo-repository-workflow
query = qmgr.createQuery(templateQuery.getProperty("jcr:statement").getString(), query.getLanguage());
QueryResult rs = query.execute();
代码示例来源:origin: org.onehippo.cms7/hippo-cms-editor-frontend
try {
Query query = qrm.getQuery(queryNode);
language = query.getLanguage();
statement = query.getStatement();
} catch (InvalidQueryException e) {
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldCreateQuery() throws Exception {
String statement = "SELECT * FROM [nt:unstructured]";
QueryManager queryManager = workspace.getQueryManager();
Query query = queryManager.createQuery(statement, Query.JCR_SQL2);
assertThat(query, is(notNullValue()));
assertThat(query.getLanguage(), is(Query.JCR_SQL2));
assertThat(query.getStatement(), is(statement));
}
代码示例来源:origin: ModeShape/modeshape
@Test
public void shouldLoadStoredQuery() throws Exception {
String statement = "SELECT * FROM [nt:unstructured]";
QueryManager queryManager = workspace.getQueryManager();
Query query = queryManager.createQuery(statement, Query.JCR_SQL2);
Node node = query.storeAsNode("/storedQuery");
Query loaded = queryManager.getQuery(node);
assertThat(loaded, is(notNullValue()));
assertThat(loaded.getLanguage(), is(Query.JCR_SQL2));
assertThat(loaded.getStatement(), is(statement));
assertThat(loaded.getStoredQueryPath(), is(node.getPath()));
}
内容来源于网络,如有侵权,请联系作者删除!