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


Java NodeService.createAssociation方法代碼示例

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


在下文中一共展示了NodeService.createAssociation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: updateAssociations

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@Override
protected void updateAssociations(NodeService nodeService)
{
    List<AssociationRef> existingAssocs = nodeService.getTargetAssocs(sourceNodeRef, assocQName);
    for (AssociationRef assoc : existingAssocs)
    {
        if (assoc.getTargetRef().equals(targetNodeRef))
        {
            if (logger.isWarnEnabled())
            {
                logger.warn("Attempt to add existing association prevented. " + assoc);
            }
            return;
        }
    }
    nodeService.createAssociation(sourceNodeRef, targetNodeRef, assocQName);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:ContentModelFormProcessor.java

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


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