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


Java NodeService.getPrimaryParent方法代碼示例

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


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

示例1: getPrimaryParent

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@Override
public ChildAssociationRef getPrimaryParent(NodeRef nodeRef)
{
    NodeService nodeService = apiFacet.getNodeService();
    return nodeService.getPrimaryParent(nodeRef);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:7,代碼來源:AlfrescoEnviroment.java

示例2: getAssociationCopyInfo

import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
/**
 * Calculates {@link QName} type of target association, which will be created after copying
 * 
 * @param sourceNodeRef             the node that will be copied (never <tt>null</tt>)
 * @param sourceParentRef           the parent of the node being copied (may be <tt>null</tt>)
 * @param newName                   the planned new name of the node
 * @param nameChanged               <tt>true</tt> if the name of the node is being changed
 * @return                          Returns the path part for a new association and the effective
 *                                  primary parent association that was used
 */
protected AssociationCopyInfo getAssociationCopyInfo(
        NodeService nodeService,
        NodeRef sourceNodeRef,
        NodeRef sourceParentRef,
        String newName, boolean nameChanged)
{
    // we need the current association type
    ChildAssociationRef primaryAssocRef = nodeService.getPrimaryParent(sourceNodeRef);

    // Attempt to find a template association reference for the new association
    ChildAssociationRef sourceParentAssocRef = primaryAssocRef;
    if (sourceParentRef != null)
    {
        // We have been given a source parent node
        boolean copyingFromPrimaryParent = sourceParentRef.equals(primaryAssocRef.getParentRef());
        if (!copyingFromPrimaryParent)
        {
            // We are not copying from the primary parent.
            // Find a random association to the source parent to use as a template
            List<ChildAssociationRef> assocList = nodeService.getParentAssocs(sourceNodeRef);
            for (ChildAssociationRef assocListEntry : assocList)
            {
                if (sourceParentRef.equals(assocListEntry.getParentRef()))
                {
                    sourceParentAssocRef = assocListEntry;
                    break;
                }
            }
        }
    }

    QName targetAssocQName = null;
    QName existingQName = sourceParentAssocRef.getQName();
    if (nameChanged && !systemNamespaces.contains(existingQName.getNamespaceURI()))
    {
        // Change the localname to match the new name
        targetAssocQName = QName.createQName(sourceParentAssocRef.getQName().getNamespaceURI(), QName.createValidLocalName(newName));
    }
    else
    {
        // Keep the localname
        targetAssocQName = existingQName;
    }

    return new AssociationCopyInfo(targetAssocQName, sourceParentAssocRef);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:57,代碼來源:AbstractBaseCopyService.java


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