本文整理匯總了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;
}
示例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);
}
示例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";
}