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


Java NodeService.getChildByName方法代码示例

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


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

示例1: addTopicNode

import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
/**
 * Adds topic node into Alfresco repository
 * 
 * @param parentNode        Parent node
 * @param name              Topic name
 * @return                  Reference to created node
 */
protected NodeRef addTopicNode(NodeRef parentNode, String name)
{
    String workingName = encodeSubject(name);
    
    NodeService nodeService = getNodeService();
    Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
    properties.put(ContentModel.PROP_NAME, workingName);

    NodeRef topicNode = nodeService.getChildByName(parentNode, ContentModel.ASSOC_CONTAINS, workingName);
    if (topicNode == null)
    {
        ChildAssociationRef association = nodeService.createNode(
                parentNode,
                ContentModel.ASSOC_CONTAINS,
                QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, workingName),
                ForumModel.TYPE_TOPIC,
                properties);
        topicNode = association.getChildRef();
    }

    // Add necessary aspects
    properties.clear();
    properties.put(ApplicationModel.PROP_ICON, "topic");
    getNodeService().addAspect(topicNode, ApplicationModel.ASPECT_UIFACETS, properties);

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

示例2: setUp

import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
    super.setUp();
    ApplicationContext appContext = getServer().getApplicationContext();

    nodeService = (NodeService)appContext.getBean("NodeService");
    replicationService = (ReplicationService)appContext.getBean("ReplicationService");
    actionTrackingService = (ActionTrackingService)appContext.getBean("actionTrackingService");
    repositoryHelper = (Repository)appContext.getBean("repositoryHelper");
    transactionService = (TransactionService)appContext.getBean("transactionService");
    
    MutableAuthenticationService authenticationService = (MutableAuthenticationService)appContext.getBean("AuthenticationService");
    PersonService personService = (PersonService)appContext.getBean("PersonService");
    personManager = new TestPersonManager(authenticationService, personService, nodeService);

    UserTransaction txn = transactionService.getUserTransaction();
    txn.begin();
    
    personManager.createPerson(USER_NORMAL);
    
    // Ensure we start with no replication definitions
    // (eg another test left them behind)
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
    for(ReplicationDefinition rd : replicationService.loadReplicationDefinitions()) {
       replicationService.deleteReplicationDefinition(rd);
    }
    txn.commit();
    
    // Grab a reference to the data dictionary
    dataDictionary = nodeService.getChildByName(
             repositoryHelper.getCompanyHome(),
             ContentModel.ASSOC_CONTAINS,
             "Data Dictionary"
    );
    
    AuthenticationUtil.clearCurrentSecurityContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:39,代码来源:ReplicationRestApiTest.java

示例3: addPostNode

import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
/**
 * Posts content
 * 
 * @param nodeRef   Reference to node
 * @param message    Mail parser
 * @return          Returns the new post node
 */
protected NodeRef addPostNode(NodeRef nodeRef, EmailMessage message)
{
    NodeService nodeService = getNodeService();
    Date now = new Date();
    String nodeName = "posted-" + new SimpleDateFormat("dd-MM-yyyy-hh-mm-ss").format(now) + ".html";

    PropertyMap properties = new PropertyMap(3);
    properties.put(ContentModel.PROP_NAME, nodeName);

    NodeRef postNodeRef = nodeService.getChildByName(nodeRef, ContentModel.ASSOC_CONTAINS, nodeName);
    if (postNodeRef == null)
    {
        ChildAssociationRef childAssoc = nodeService.createNode(
                nodeRef,
                ContentModel.ASSOC_CONTAINS,
                QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName),
                ForumModel.TYPE_POST,
                properties);
        postNodeRef = childAssoc.getChildRef();
    }

    // Add necessary aspects
    properties.clear();
    properties.put(ContentModel.PROP_TITLE, nodeName);
    nodeService.addAspect(postNodeRef, ContentModel.ASPECT_TITLED, properties);
    properties.clear();
    properties.put(ApplicationModel.PROP_EDITINLINE, true);
    nodeService.addAspect(postNodeRef, ApplicationModel.ASPECT_INLINEEDITABLE, properties);

    // Write content
    if (message.getBody() != null)
    {
        writeContent(
                postNodeRef,
                message.getBody().getContent(),
                message.getBody().getContentType(),
                message.getBody().getEncoding());
    }
    else
    {
        writeContent(postNodeRef, "<The message was empty>", MimetypeMap.MIMETYPE_TEXT_PLAIN);
    }
    addEmailedAspect(postNodeRef, message);
    
    // Done
    return postNodeRef;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:55,代码来源:AbstractForumEmailMessageHandler.java

示例4: setUp

import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
    applicationContext = ApplicationContextHelper.getApplicationContext();
    repositoryHelper = (Repository)this.applicationContext.getBean("repositoryHelper");
    ApplicationContextFactory fileServers = (ApplicationContextFactory) this.applicationContext.getBean("fileServers");
    cifsHelper = (CifsHelper) fileServers.getApplicationContext().getBean("cifsHelper");
    driver = (ExtendedDiskInterface)this.applicationContext.getBean("contentDiskDriver");
    mlAwareNodeService = (NodeService) this.applicationContext.getBean("mlAwareNodeService"); 
    nodeService = (NodeService)applicationContext.getBean("nodeService");
    transactionService = (TransactionService)applicationContext.getBean("transactionService");
    contentService = (ContentService)applicationContext.getBean("contentService");
    ruleService = (RuleService)applicationContext.getBean("ruleService");
    actionService = (ActionService)this.applicationContext.getBean("actionService");
    personService = (PersonService) this.applicationContext.getBean("personService");
    authenticationService = (MutableAuthenticationService) this.applicationContext.getBean("authenticationService");
    permissionService = (PermissionService) this.applicationContext.getBean("permissionService");
    ownableService = (OwnableService) this.applicationContext.getBean("ownableService");
    fileFolderService = (FileFolderService) this.applicationContext.getBean("fileFolderService");
    checkOutCheckInService = (CheckOutCheckInService) this.applicationContext.getBean("checkOutCheckInService");
    
    assertNotNull("content disk driver is null", driver);
    assertNotNull("repositoryHelper is null", repositoryHelper);
    assertNotNull("mlAwareNodeService is null", mlAwareNodeService);
    assertNotNull("nodeService is null", nodeService);
    assertNotNull("transactionService is null", transactionService);
    assertNotNull("contentService is null", contentService);
    assertNotNull("ruleService is null", ruleService);
    assertNotNull("actionService is null", actionService);
    assertNotNull("cifsHelper", cifsHelper);
    assertNotNull("checkOutCheckInService", checkOutCheckInService);
    
    AuthenticationUtil.setRunAsUserSystem();
    
    // remove our test root 
    RetryingTransactionCallback<Void> removeRootCB = new RetryingTransactionCallback<Void>() {

        @Override
        public Void execute() throws Throwable
        {
            NodeRef companyHome = repositoryHelper.getCompanyHome();
            NodeRef rootNode = nodeService.getChildByName(companyHome, ContentModel.ASSOC_CONTAINS, TEST_ROOT_PATH);
            if(rootNode != null)
            {
                logger.debug("Clean up test root node");
                nodeService.deleteNode(rootNode);
            }
            return null;
        }
    };
    final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
    
    tran.doInTransaction(removeRootCB, false, true);
    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:56,代码来源:ContentDiskDriverTest.java

示例5: setUp

import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void setUp() throws Exception
{
    super.setUp();
    ApplicationContext appContext = getServer().getApplicationContext();

    nodeService = (NodeService)appContext.getBean("NodeService");
    replicationService = (ReplicationService)appContext.getBean("ReplicationService");
    actionTrackingService = (ActionTrackingService)appContext.getBean("actionTrackingService");
    repositoryHelper = (Repository)appContext.getBean("repositoryHelper");
    transactionService = (TransactionService)appContext.getBean("transactionService");
    executingActionsCache = (SimpleCache<String, ExecutionDetails>)appContext.getBean("executingActionsCache");
    
    MutableAuthenticationService authenticationService = (MutableAuthenticationService)appContext.getBean("AuthenticationService");
    PersonService personService = (PersonService)appContext.getBean("PersonService");
    personManager = new TestPersonManager(authenticationService, personService, nodeService);

    UserTransaction txn = transactionService.getUserTransaction();
    txn.begin();
    
    personManager.createPerson(USER_NORMAL);
    
    // Ensure we start with no replication definitions
    // (eg another test left them behind)
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
    for(ReplicationDefinition rd : replicationService.loadReplicationDefinitions())
    {
       replicationService.deleteReplicationDefinition(rd);
    }
    txn.commit();
    
    // Grab a reference to the data dictionary
    dataDictionary = nodeService.getChildByName(
             repositoryHelper.getCompanyHome(),
             ContentModel.ASSOC_CONTAINS,
             "Data Dictionary"
    );
    
    AuthenticationUtil.clearCurrentSecurityContext();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:42,代码来源:RunningActionRestApiTest.java


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