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


Java ResultSet.getNodeRef方法代码示例

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


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

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

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

示例3: testDeleteDocs

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
@Test
public void testDeleteDocs() {
    AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER_NAME);

    String query = "+PATH:\"/app:company_home/app:dictionary/app:expirable_content_reports\"";
    ResultSet rs = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, query);

    NodeRef reportsFolder = rs.getNodeRef(0);


    String testFolderName = "testFolder-" + (new Date()).getTime();
    Map<QName, Serializable> contentProps = new HashMap<QName, Serializable>();
    contentProps.put(ContentModel.PROP_NAME, testFolderName);
    NodeRef testFolder = nodeService.createNode(reportsFolder,
            ContentModel.ASSOC_CONTAINS,
            QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, testFolderName),
            ContentModel.TYPE_FOLDER,
            contentProps).getChildRef();

    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.DATE, -1);
    Date yesterday = cal.getTime();

    createTestDoc(testFolder, "testDoc1", yesterday);
    createTestDoc(testFolder, "testDoc2", yesterday);
    createTestDoc(testFolder, "testDoc3", null); // does not expire

    List<ChildAssociationRef> children = nodeService.getChildAssocs(testFolder);
    assertEquals(3, children.size());

    Action deleteExpiredAction = actionService.createAction("delete-expired-content");
    actionService.executeAction(deleteExpiredAction, null);

    children = nodeService.getChildAssocs(testFolder);
    assertEquals(1, children.size());

    nodeService.deleteNode(testFolder);
}
 
开发者ID:Conexiam,项目名称:alfresco-expirable-content,代码行数:39,代码来源:DeleteExpiredDocumentsTest.java

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

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

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

示例7: getUsername

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
/**
 * Authenticate in Alfresco repository by sender's e-mail address.
 * 
 * @param from Sender's email address
 * @return User name or null if the user does not exist.
 * @throws EmailMessageException Exception will be thrown if authentication is failed.
 */
private String getUsername(String from)
{
    String userName = null;
    
    if(from == null || from.length()==0)
    {
        return null;
    }
    
    if(logger.isDebugEnabled())
    {
        logger.debug("getUsername from: " + from);
    }
    
    
    StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
    String query = "TYPE:cm\\:person AND [email protected]\\:email:\"" + from + "\"";

    ResultSet resultSet = searchService.query(storeRef, SearchService.LANGUAGE_FTS_ALFRESCO, query);
    try
    {
        if (resultSet == null || resultSet.length() == 0)
        {
            return null;
        }
        if (resultSet.length() > 1)
        {
            if(logger.isWarnEnabled())
            {
                logger.warn("found more as one result for email '" + from + "'. The first will be used");
            }
        }
        NodeRef userNode = resultSet.getNodeRef(0);
        if (nodeService.exists(userNode))
        {
            userName = DefaultTypeConverter.INSTANCE.convert(
                    String.class,
                    nodeService.getProperty(userNode, ContentModel.PROP_USERNAME));

            if(logger.isDebugEnabled())
            {
                logger.debug("found username: " + userName);
            }
        }
        else
        {
            // The Lucene index returned a dead result
            throw new EmailMessageException(ERR_UNKNOWN_SOURCE_ADDRESS, from);
        }
    }
    finally
    {
        if(resultSet != null)
        {
            resultSet.close();
        }
    }

    return userName;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:68,代码来源:EmailServiceImpl.java


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