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


Java ResultSet.length方法代码示例

本文整理汇总了Java中org.alfresco.service.cmr.search.ResultSet.length方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.length方法的具体用法?Java ResultSet.length怎么用?Java ResultSet.length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.service.cmr.search.ResultSet的用法示例。


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

示例1: getClassificationNodes

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
private Set<NodeRef> getClassificationNodes(StoreRef storeRef, QName qname)
{
    ResultSet resultSet = null;
    try
    {
        resultSet = indexerAndSearcher.getSearcher(storeRef, false).query(storeRef, "lucene",
                "PATH:\"/" + getPrefix(qname.getNamespaceURI()) + ISO9075.encode(qname.getLocalName()) + "\"", null);
        
        Set<NodeRef> nodeRefs = new HashSet<NodeRef>(resultSet.length());
        for (ResultSetRow row : resultSet)
        {
            nodeRefs.add(row.getNodeRef());
        }
        
        return nodeRefs;
    }
    finally
    {
        if (resultSet != null)
        {
            resultSet.close();
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:LuceneCategoryServiceImpl.java

示例2: 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

示例3: AbstractResultSetRowIterator

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
/**
 * Create an iterator over the result set. Follows stadard ListIterator
 * conventions
 * 
 * @param resultSet ResultSet
 */
public AbstractResultSetRowIterator(ResultSet resultSet)
{
    super();
    this.resultSet = resultSet;
    this.max = resultSet.length();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:AbstractResultSetRowIterator.java

示例4: DetachedResultSet

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
/**
 * Detached result set based on that provided
 * @param resultSet ResultSet
 */
public DetachedResultSet(ResultSet resultSet)
{
    super();
    rsmd = resultSet.getResultSetMetaData();
    rows = new ArrayList<ResultSetRow>(resultSet.length());
    for (ResultSetRow row : resultSet)
    {
        rows.add(new DetachedResultSetRow(this, row));
    }
    numberFound = resultSet.getNumberFound();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:DetachedResultSet.java

示例5: isTxnIdPresentInIndex

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
/**
 * @return                  Returns true if the given transaction is present in the index
 */
private boolean isTxnIdPresentInIndex(StoreRef storeRef, Transaction txn)
{
    long txnId = txn.getId();
    String changeTxnId = txn.getChangeTxnId();
    // do the most update check, which is most common
    ResultSet results = null;
    try
    {
        SearchParameters sp = new SearchParameters();
        sp.addStore(storeRef);
        // search for it in the index, sorting with youngest first, fetching only 1
        sp.setLanguage(SearchService.LANGUAGE_LUCENE);
        sp.setQuery("TX:" + SearchLanguageConversion.escapeLuceneQuery(changeTxnId));
        sp.setLimit(1);
        
        results = searcher.query(sp);
        
        if (results.length() > 0)
        {
            if (logger.isTraceEnabled())
            {
                logger.trace("Index has results for txn " + txnId + " for store " + storeRef);
            }
            return true;        // there were updates/creates and results for the txn were found
        }
        else
        {
            if (logger.isTraceEnabled())
            {
                logger.trace("Transaction " + txnId + " not in index for store " + storeRef + ".  Possibly out of date.");
            }
            return false;
        }
    }
    finally
    {
        if (results != null) { results.close(); }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:43,代码来源:AbstractReindexComponent.java

示例6: checkNodes

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
/**
 * Check the nodes to be indexed
 * 
 * @param nodes
 * @throws Exception
 */
private void checkNodes(List<FileInfo> nodes) throws Exception
{
    SearchService searchService = registry.getSearchService();
    
    boolean notFound = false;
    for (int i = 1; i <= 40; i++)
    {
        notFound = false;
        for (FileInfo fileInfo : nodes)
        {
            ResultSet resultSet = searchService.query(storeRef, SearchService.LANGUAGE_LUCENE, "PATH:\"/app:company_home//cm:" + TEST_FOLDER_NAME + "//cm:" + fileInfo.getName() + "\"");
            if (resultSet.length() == 0)
            {
                notFound = true;
                break;
            }
        }
        if (notFound)
        {
            Thread.sleep(500);
        }
        else
        {
            break;
        }
    }
    assertFalse("The content was not created or indexed correctly.", notFound);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:CronScheduledQueryBasedTemplateActionDefinitionTest.java

示例7: getReportFolderNode

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
private NodeRef getReportFolderNode(String folderPath) {
    String query = "PATH:\"" + folderPath + "\"";
    ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, query);
    if (results.length() <= 0) {
        return null;
    }
    return results.getNodeRef(0);
}
 
开发者ID:Conexiam,项目名称:alfresco-expirable-content,代码行数:9,代码来源:ExpiredContentReportWriter.java

示例8: executeImpl

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
@Override
public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) {
    List<ReportData> reportDataList = new ArrayList<ReportData>();
    ResultSet expiredDocs = getExpiredContent();
    for (int i = 0; i < expiredDocs.length(); i++) {
        NodeRef expiredDoc = expiredDocs.getNodeRef(i);

        if (nodeService.exists(expiredDoc)) {
            ReportData reportData = new ReportData();
            reportData.setName((String) nodeService.getProperty(expiredDoc, ContentModel.PROP_NAME));
            String nodeRefStr = expiredDoc.toString();
            reportData.setNodeRef(nodeRefStr);
            reportData.setExpirationDate((Date) nodeService.getProperty(expiredDoc, ExpirableContentModel.PROP_EXPIRATION_DATE));
            reportData.setPath(nodeService.getPath(expiredDoc).toString());

            try {
                nodeService.deleteNode(expiredDoc);
            } catch (InvalidNodeRefException inre) {
                LOG.warn("Tried to delete an invalid node, skipping: " + nodeRefStr);
                continue;
            }

            reportDataList.add(reportData);
        }
    }
    if (reportDataList.size() > 0) {
        LOG.info("Delete expired content action deleted: " + reportDataList.size() + " documents.");
        reportWriter.save(reportDataList);
    } else {
        LOG.info("Delete expired content action found nothing to delete.");
    }
}
 
开发者ID:Conexiam,项目名称:alfresco-expirable-content,代码行数:33,代码来源:DeleteExpiredContent.java

示例9: 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;
}
 
开发者ID:Conexiam,项目名称:alfresco-acl-templates,代码行数:11,代码来源:AclTemplateServiceImpl.java

示例10: 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;
    }
 
开发者ID:Conexiam,项目名称:alfresco-acl-templates,代码行数:28,代码来源:AclTemplateServiceImpl.java

示例11: getNodeFromPathName

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
public NodeRef getNodeFromPathName(String pathName) {
	StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
	ResultSet rs = searchService.query(storeRef, SearchService.LANGUAGE_XPATH, String.format("/app:%s", pathName));

	NodeRef sourceNameNodeRef = null;
	try {
		if (rs.length() == 0) {
			throw new AlfrescoRuntimeException(String.format("Didn't find %s", pathName));
		}
		sourceNameNodeRef = rs.getNodeRef(0);
	} finally {
		rs.close();
	}
	return sourceNameNodeRef;
}
 
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:16,代码来源:NodesHierarchyJobImpl.java

示例12: findLinks

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
public CollectionWithPagingInfo<QuickShareLink> findLinks(Parameters parameters)
{
    checkEnabled();

    String queryString =
            "ASPECT:\"" + QuickShareModel.ASPECT_QSHARE.toString() + "\"";

    SearchParameters sp = new SearchParameters();

    // note: REST API query parameter (ie. where clause filter) - not to be confused with search query ;-)
    Query q = parameters.getQuery();
    if (q != null)
    {
        // filtering via "where" clause
        MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(FIND_SHARED_LINKS_QUERY_PROPERTIES, null);
        QueryHelper.walk(q, propertyWalker);

        String sharedByUserId = propertyWalker.getProperty(PARAM_SHAREDBY, WhereClauseParser.EQUALS, String.class);

        if (sharedByUserId != null)
        {
            if (People.DEFAULT_USER.equalsIgnoreCase(sharedByUserId))
            {
                sharedByUserId =  AuthenticationUtil.getFullyAuthenticatedUser();
            }

            QueryParameterDefinition qpd = new QueryParameterDefImpl(QuickShareModel.PROP_QSHARE_SHAREDBY, dictionaryService.getDataType(DataTypeDefinition.TEXT),
                    true, sharedByUserId);
            sp.addQueryParameterDefinition(qpd);

            String qsharedBy = QuickShareModel.PROP_QSHARE_SHAREDBY.toPrefixString(namespaceService);
            queryString += " [email protected]"+SearchLanguageConversion.escapeLuceneQuery(qsharedBy)+":\"${"+qsharedBy+"}\"";
        }
    }

    sp.setLanguage(SearchService.LANGUAGE_LUCENE);
    sp.setQuery(queryString);
    sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);

    Paging paging = parameters.getPaging();
    PagingRequest pagingRequest = Util.getPagingRequest(paging);

    sp.setSkipCount(pagingRequest.getSkipCount());
    sp.setMaxItems(pagingRequest.getMaxItems());

    sp.addSort("@" + ContentModel.PROP_MODIFIED, false);

    ResultSet results = searchService.query(sp);

    List<QuickShareLink> qsLinks = new ArrayList<>(results.length());

    List<String> includeParam = parameters.getInclude();

    for (ResultSetRow row : results)
    {
        NodeRef nodeRef = row.getNodeRef();
        qsLinks.add(getQuickShareInfo(nodeRef, false, includeParam));
    }

    results.close();

    return CollectionWithPagingInfo.asPaged(paging, qsLinks, results.hasMore(), new Long(results.getNumberFound()).intValue());
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:64,代码来源:QuickShareLinksImpl.java

示例13: FilteringResultSet

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
public FilteringResultSet(ResultSet unfiltered)
{
    super();
    this.unfiltered = unfiltered;
    inclusionMask = new BitSet(unfiltered.length());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:7,代码来源:FilteringResultSet.java

示例14: findSites

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
@Override
public List<SiteInfo> findSites(String filter, String sitePresetFilter, int size)
{
    List<SiteInfo> result;
    
    NodeRef siteRoot = getSiteRoot();
    if (siteRoot == null)
    {
        result = Collections.emptyList();
    }
    else
    {
        // get the sites that match the specified names
        StringBuilder query = new StringBuilder(128);
        query.append("+PARENT:\"").append(siteRoot.toString()).append('"');

        final boolean filterIsPresent = filter != null && filter.length() > 0;
        // The filter string is only used in the Lucene query if it restricts results.
        // A search for name/title/description = "*" does not need to be put into the Lucene query.
        // This allows users to search for "*" in the site-finder.
        final boolean filterIsPresentAndNecessary = filterIsPresent && !filter.equals("*");
        final boolean sitePresetFilterIsPresent = sitePresetFilter != null && sitePresetFilter.length() > 0;
        
        if (filterIsPresentAndNecessary || sitePresetFilterIsPresent)
        {
            query.append(" +(");
            if (filterIsPresentAndNecessary)
            {
                String escNameFilter = SearchLanguageConversion.escapeLuceneQuery(filter.replace('"', ' '));
                
                query.append(" @cm\\:name:\"*" + escNameFilter + "*\"")
                     .append(" @cm\\:title:\"" + escNameFilter + "\"")
                     .append(" @cm\\:description:\"" + escNameFilter + "\"");
            }
            if (sitePresetFilterIsPresent)
            {
                String escPresetFilter = SearchLanguageConversion.escapeLuceneQuery(sitePresetFilter.replace('"', ' '));
                query.append(" @st\\:sitePreset:\"" + escPresetFilter + "\"");
            }
            
            query.append(")");
        }
        
        SearchParameters sp = new SearchParameters();
        sp.addStore(siteRoot.getStoreRef());
        sp.setLanguage(SearchService.LANGUAGE_LUCENE);
        sp.setQuery(query.toString());
        if (size > 0)
        {
            sp.setLimit(size);
            sp.setLimitBy(LimitBy.FINAL_SIZE);
        }
        ResultSet results = this.searchService.query(sp);
        try
        {
            result = new ArrayList<SiteInfo>(results.length());
            for (NodeRef site : results.getNodeRefs())
            {
                // Ignore any node type that is not a "site"
                QName siteClassName = this.nodeService.getType(site);
                if (this.dictionaryService.isSubClass(siteClassName, SiteModel.TYPE_SITE))
                {
                    result.add(createSiteInfo(site));
                }
            }
        }
        finally
        {
            results.close();
        }
    }
    
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:75,代码来源:SiteServiceImpl.java

示例15: contains

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
/**
 * @return Returns true if the pattern is present, otherwise false.
 */
public boolean contains(NodeRef nodeRef, QName propertyQName, String googleLikePattern, SearchParameters.Operator defaultOperator)
{
    ResultSet resultSet = null;
    try
    {
        // build Lucene search string specific to the node
        StringBuilder sb = new StringBuilder();
        sb.append("+ID:\"").append(nodeRef.toString()).append("\" +(TEXT:(").append(googleLikePattern.toLowerCase()).append(") ");
        if (propertyQName != null)
        {
            sb.append(" OR @").append(SearchLanguageConversion.escapeLuceneQuery(QName.createQName(propertyQName.getNamespaceURI(), ISO9075.encode(propertyQName.getLocalName())).toString()));
            sb.append(":(").append(googleLikePattern.toLowerCase()).append(")");
        }
        else
        {
            for (QName key : nodeService.getProperties(nodeRef).keySet())
            {
                sb.append(" OR @").append(SearchLanguageConversion.escapeLuceneQuery(QName.createQName(key.getNamespaceURI(), ISO9075.encode(key.getLocalName())).toString()));
                sb.append(":(").append(googleLikePattern.toLowerCase()).append(")");
            }
        }
        sb.append(")");

        SearchParameters sp = new SearchParameters();
        sp.setLanguage(SearchService.LANGUAGE_LUCENE);
        sp.setQuery(sb.toString());
        sp.setDefaultOperator(defaultOperator);
        sp.addStore(nodeRef.getStoreRef());

        resultSet = this.query(sp);
        boolean answer = resultSet.length() > 0;
        return answer;
    }
    finally
    {
        if (resultSet != null)
        {
            resultSet.close();
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:45,代码来源:ADMLuceneSearcherImpl.java


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