本文整理汇总了Java中org.alfresco.service.cmr.search.ResultSet类的典型用法代码示例。如果您正苦于以下问题:Java ResultSet类的具体用法?Java ResultSet怎么用?Java ResultSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResultSet类属于org.alfresco.service.cmr.search包,在下文中一共展示了ResultSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decide
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
private QueryEngineResults decide(Authentication authentication, Object object, ConfigAttributeDefinition config, QueryEngineResults returnedObject)
throws AccessDeniedException
{
Map<Set<String>, ResultSet> map = returnedObject.getResults();
Map<Set<String>, ResultSet> answer = new HashMap<Set<String>, ResultSet>(map.size(), 1.0f);
for (Set<String> group : map.keySet())
{
ResultSet raw = map.get(group);
ResultSet permed;
if (PagingLuceneResultSet.class.isAssignableFrom(raw.getClass()))
{
permed = decide(authentication, object, config, (PagingLuceneResultSet)raw);
}
else
{
permed = decide(authentication, object, config, raw);
}
answer.put(group, permed);
}
return new QueryEngineResults(answer);
}
示例2: query
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
public ResultSet query(StoreRef store, QName queryId, QueryParameter[] queryParameters)
{
CannedQueryDef definition = queryRegister.getQueryDefinition(queryId);
// Do parameter replacement
// As lucene phrases are tokensied it is correct to just do straight
// string replacement.
// The string will be formatted by the tokeniser.
//
// For non phrase queries this is incorrect but string replacement is
// probably the best we can do.
// As numbers and text are indexed specially, direct term queries only
// make sense against textual data
checkParameters(definition, queryParameters);
String queryString = parameterise(definition.getQuery(), definition.getQueryParameterMap(), queryParameters, definition.getNamespacePrefixResolver());
return query(store, definition.getLanguage(), queryString, null);
}
示例3: resultSetToChildAssocCollection
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
private Collection<ChildAssociationRef> resultSetToChildAssocCollection(ResultSet resultSet)
{
List<ChildAssociationRef> collection = new LinkedList<ChildAssociationRef>();
if (resultSet != null)
{
for (ResultSetRow row : resultSet)
{
try
{
ChildAssociationRef car = nodeService.getPrimaryParent(row.getNodeRef());
collection.add(car);
}
catch(InvalidNodeRefException inre)
{
// keep going the node has gone beneath us just skip it
}
}
}
return collection;
// The caller closes the result set
}
示例4: getClassifications
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
public Collection<ChildAssociationRef> getClassifications(StoreRef storeRef)
{
ResultSet resultSet = null;
try
{
resultSet = indexerAndSearcher.getSearcher(storeRef, false).query(storeRef, "lucene", "PATH:\"//cm:categoryRoot/*\"", null);
return resultSetToChildAssocCollection(resultSet);
}
finally
{
if (resultSet != null)
{
resultSet.close();
}
}
}
示例5: query
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
@Override
public ResultSet query(StoreRef store, QName queryId, QueryParameter[] queryParameters)
{
CannedQueryDef definition = queryRegister.getQueryDefinition(queryId);
// Do parameter replacement
// As lucene phrases are tokensied it is correct to just do straight
// string replacement.
// The string will be formatted by the tokeniser.
//
// For non phrase queries this is incorrect but string replacement is
// probably the best we can do.
// As numbers and text are indexed specially, direct term queries only
// make sense against textual data
checkParameters(definition, queryParameters);
String queryString = parameterise(definition.getQuery(), definition.getQueryParameterMap(), queryParameters, definition.getNamespacePrefixResolver());
return query(store, definition.getLanguage(), queryString, null);
}
示例6: executeImpl
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
@Override
protected void executeImpl(NodeRef actionedUponNodeRef) {
final SearchParameters sp = new SearchParameters();
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
sp.setLanguage(SearchService.LANGUAGE_CMIS_ALFRESCO);
sp.setQuery(QUERY);
try {
final ResultSet rs = searchService.query(sp);
LOGGER.info("Actual number of sites: {}", rs.length());
final String message = rs.length() < 5000?"Count of sites is OK":"Count of sites exceed recomended limit";
setOutput(actionedUponNodeRef, new JSONSitesBuilder().setSitesCount(rs.length()).generateOutput());
updateStatus(actionedUponNodeRef, JobStatus.Status.FINISHED, message);
} catch (RuntimeException e) {
updateStatus(actionedUponNodeRef, JobStatus.Status.ERROR, "Error to get number of sites.");
}
}
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:18,代码来源:MonitorSitesCountAction.java
示例7: findTaggedNodes
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
/**
* @see org.alfresco.service.cmr.tagging.TaggingService#findTaggedNodes(StoreRef, java.lang.String)
*/
public List<NodeRef> findTaggedNodes(StoreRef storeRef, String tag)
{
// Lower the case of the tag
tag = tag.toLowerCase();
ResultSet resultSet= null;
try
{
// Do the search for nodes
resultSet = this.searchService.query(
storeRef,
SearchService.LANGUAGE_LUCENE,
"+PATH:\"/cm:taggable/cm:" + ISO9075.encode(tag) + "/member\"");
List<NodeRef> nodeRefs = resultSet.getNodeRefs();
return nodeRefs;
}
finally
{
if(resultSet != null) {resultSet.close();}
}
}
示例8: getLocks
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
/**
* Get the locks given a store and query string.
*
* @param storeRef the store reference
* @param query the query string
* @return the locked nodes
* @deprecated Uses search and does not report on ephemeral locks.
*/
@Deprecated
private List<NodeRef> getLocks(StoreRef storeRef, String query)
{
List<NodeRef> result = new ArrayList<NodeRef>();
ResultSet resultSet = null;
try
{
resultSet = this.searchService.query(
storeRef,
SearchService.LANGUAGE_LUCENE,
query);
result = resultSet.getNodeRefs();
}
finally
{
if (resultSet != null)
{
resultSet.close();
}
}
return result;
}
示例9: filterNotExistingNodes
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
private ResultSet filterNotExistingNodes(ResultSet resultSet)
{
if (resultSet instanceof PagingLuceneResultSet)
{
ResultSet wrapped = ((PagingLuceneResultSet)resultSet).getWrapped();
if (wrapped instanceof FilteringResultSet)
{
FilteringResultSet filteringResultSet = (FilteringResultSet)wrapped;
for (int i = 0; i < filteringResultSet.length(); i++)
{
NodeRef nodeRef = filteringResultSet.getNodeRef(i);
/* filter node if it does not exist */
if (!nodeService.exists(nodeRef))
{
filteringResultSet.setIncluded(i, false);
}
}
}
}
return resultSet;
}
示例10: mockResultset
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
private ResultSet mockResultset(List<Long> archivedNodes, List<Long> versionNodes) throws JSONException
{
NodeService nodeService = mock(NodeService.class);
when(nodeService.getNodeRef(any())).thenAnswer(new Answer<NodeRef>() {
@Override
public NodeRef answer(InvocationOnMock invocation) throws Throwable {
Object[] args = invocation.getArguments();
//If the DBID is in the list archivedNodes, instead of returning a noderef return achivestore noderef
if (archivedNodes.contains(args[0])) return new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, GUID.generate());
if (versionNodes.contains(args[0])) return new NodeRef(StoreMapper.STORE_REF_VERSION2_SPACESSTORE, GUID.generate()+args[0]);
return new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
}
});
SearchParameters sp = new SearchParameters();
sp.setBulkFetchEnabled(false);
JSONObject json = new JSONObject(new JSONTokener(JSON_REPONSE));
ResultSet results = new SolrJSONResultSet(json,sp,nodeService, null, LimitBy.FINAL_SIZE, 10);
return results;
}
示例11: testAuditSearchServiceQuery
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
/**
* Test for <a href="https://issues.alfresco.com/jira/browse/MNT-16748">MNT-16748</a> <br>
* Use {@link SearchService#query(StoreRef, String, String)} to perform a query.
*/
public void testAuditSearchServiceQuery() throws Exception
{
// Run as admin
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
// Perform a search
@SuppressWarnings("unused")
ResultSet rs = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<ResultSet>()
{
@Override
public ResultSet execute() throws Throwable
{
return searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_XPATH, "/app:company_home");
}
}, true, false);
// Check the audit entries
checkAuditEntries(APPLICATION_NAME_MNT_16748, SearchService.LANGUAGE_XPATH, "/app:company_home", 1);
}
示例12: testEphemeralLockIndexing
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
@Test
@Category(RedundantTests.class)
public void testEphemeralLockIndexing()
{
TestWithUserUtils.authenticateUser(GOOD_USER_NAME, PWD, rootNodeRef, authenticationService);
IndexerAndSearcher indexerAndSearcher = (IndexerAndSearcher)
applicationContext.getBean("indexerAndSearcherFactory");
SearcherComponent searcher = new SearcherComponent();
searcher.setIndexerAndSearcherFactory(indexerAndSearcher);
// Create a lock (owned by the current user)
lockService.lock(noAspectNode, LockType.WRITE_LOCK, 86400, Lifetime.EPHEMERAL);
// Query for the user's locks
final String query = String.format("[email protected]\\:lockOwner:\"%s\" [email protected]\\:lockType:\"WRITE_LOCK\"", GOOD_USER_NAME);
ResultSet rs = searcher.query(storeRef, "lucene", query);
assertTrue(rs.getNodeRefs().contains(noAspectNode));
// Unlock the node
lockService.unlock(noAspectNode);
// Perform a new search, the index should reflect that it is not locked.
rs = searcher.query(storeRef, "lucene", query);
assertFalse(rs.getNodeRefs().contains(noAspectNode));
}
示例13: findSolrResultSet
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
/**
* Gets SolrJSONResultSet class if there is one.
* @param results
* @return
*/
protected SolrJSONResultSet findSolrResultSet(ResultSet results)
{
ResultSet theResultSet = results;
if (results instanceof FilteringResultSet)
{
theResultSet = ((FilteringResultSet) results).getUnFilteredResultSet();
}
if (theResultSet instanceof SolrJSONResultSet)
{
return (SolrJSONResultSet) theResultSet;
}
return null;
}
示例14: getAclTemplate
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
private AclTemplate getAclTemplate(String templateId) throws AclTemplateServiceException {
// Find the JSON file with a name that matches the templateId by querying for the name
// and the folder where ACL Templates live
String query = "+PATH:\"" + aclTemplateFolderPath + "/*\" [email protected]\\:name:\"" + templateId + "\"";
ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, query);
if (results.length() <= 0) {
throw new AclTemplateServiceException("ACL template not found: " + templateId);
}
NodeRef aclTemplateNodeRef = results.getNodeRef(0);
logger.debug("Retrieved acl template nodeRef: " + aclTemplateNodeRef.getId());
// Get the ACL template's content input stream
ContentReader reader = contentService.getReader(aclTemplateNodeRef, ContentModel.PROP_CONTENT);
InputStream inputStream = reader.getContentInputStream();
// Read the JSON from the input stream into the POJO
AclTemplate template = null;
try {
template = mapper.readValue(inputStream, AclTemplate.class);
} catch (IOException ioe) {
throw new AclTemplateServiceException("IO exception reading ACL template JSON: " + templateId + "(" + aclTemplateNodeRef.getId() + ")");
}
logger.debug("Parsed the acl template JSON");
return template;
}
示例15: getAclTemplates
import org.alfresco.service.cmr.search.ResultSet; //导入依赖的package包/类
public Set<String> getAclTemplates() {
String query = "+PATH:\"" + aclTemplateFolderPath + "/*\"";
ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, query);
Set<String> aclTemplates = new HashSet<>();
for (int i = 0; i < results.length(); i++) {
NodeRef nodeRef = results.getNodeRef(i);
aclTemplates.add((String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME));
}
return aclTemplates;
}