當前位置: 首頁>>代碼示例>>Java>>正文


Java NodeService.addAspect方法代碼示例

本文整理匯總了Java中org.alfresco.service.cmr.repository.NodeService.addAspect方法的典型用法代碼示例。如果您正苦於以下問題:Java NodeService.addAspect方法的具體用法?Java NodeService.addAspect怎麽用?Java NodeService.addAspect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.alfresco.service.cmr.repository.NodeService的用法示例。


在下文中一共展示了NodeService.addAspect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addAttachment

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
/**
 * Adds new node into Alfresco repository and mark its as an attachment.
 * 
 * @param nodeService Alfresco Node Service.
 * @param folder Space/Folder to add.
 * @param mainContentNode Main content node. Any mail is added into Alfresco as one main content node and several its attachments. Each attachment related with its main node.
 * @param fileName File name for the attachment.
 * @return Reference to created node.
 */
protected NodeRef addAttachment(NodeService nodeService, NodeRef folder, NodeRef mainContentNode, String fileName)
{
    
    if (log.isDebugEnabled())
    {
        log.debug("Adding attachment node (name=" + fileName + ").");
    }
    
    NodeRef attachmentNode = addContentNode(nodeService, folder, fileName, false);
    
    // Add attached aspect
    nodeService.addAspect(mainContentNode, ContentModel.ASPECT_ATTACHABLE, null);
    // Add the association
    nodeService.createAssociation(mainContentNode, attachmentNode, ContentModel.ASSOC_ATTACHMENTS);
    
    if (log.isDebugEnabled())
    {
        log.debug("Attachment has been added.");
    }
    return attachmentNode;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:31,代碼來源:AbstractEmailMessageHandler.java

示例2: addForumNode

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
/**
     * Adds forum node
     * 
     * @param nodeRef Paren node
     * @return Reference to created node
     */
    private NodeRef addForumNode(NodeRef nodeRef)
    {
        NodeService nodeService = getNodeService();
        
//        //Add discussable aspect to content node
//        if (!nodeService.hasAspect(nodeRef, ForumModel.ASPECT_DISCUSSABLE))
//        {
//            nodeService.addAspect(nodeRef, ForumModel.ASPECT_DISCUSSABLE, null);
//        }

        //Create forum node and associate it with content node
        Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
        properties.put(ContentModel.PROP_NAME, forumNodeName);
        ChildAssociationRef childAssoc = nodeService.createNode(nodeRef, ForumModel.ASSOC_DISCUSSION, ForumModel.ASSOC_DISCUSSION, ForumModel.TYPE_FORUM, properties);
        NodeRef forumNode = childAssoc.getChildRef();        

        //Add necessary aspects to forum node
        properties.clear();
        properties.put(ApplicationModel.PROP_ICON, "forum");
        nodeService.addAspect(forumNode, ApplicationModel.ASPECT_UIFACETS, properties);
        
        return forumNode;
    }
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:30,代碼來源:DocumentEmailMessageHandler.java

示例3: buildMessageInternal

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@Override
public void buildMessageInternal() throws MessagingException
{
    setMessageHeaders();
    // Add Imap Content Aspect with properties
    NodeService nodeService = serviceRegistry.getNodeService();
    nodeService.addAspect(this.messageFileInfo.getNodeRef(), ImapModel.ASPECT_IMAP_CONTENT, null);
    imapService.setFlags(messageFileInfo, flags, true);
    // Write content
    writeContent();
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:12,代碼來源:IncomingImapMessage.java

示例4: makeAvatar

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
public static String makeAvatar(final NodeService nodeService, final NodeRef person)
{
    nodeService.addAspect(person, ContentModel.ASPECT_PREFERENCES, null);
    ChildAssociationRef assoc = nodeService.createNode(person, ContentModel.ASSOC_PREFERENCE_IMAGE, avatarQName,
                ContentModel.TYPE_CONTENT);
    NodeRef avatar = assoc.getChildRef();
    nodeService.createAssociation(person, avatar, ContentModel.ASSOC_AVATAR);
    return "api/node/" + avatar + "/content/thumbnails/avatar";
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:10,代碼來源:InvitationWebScriptTest.java

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


注:本文中的org.alfresco.service.cmr.repository.NodeService.addAspect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。