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


Java ChildAssociationRef.getChildRef方法代码示例

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


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

示例1: createVersionHistory

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * Creates a new version history node, applying the root version aspect is required
 *
 * @param nodeRef   the node ref
 * @return          the version history node reference
 */
protected NodeRef createVersionHistory(NodeRef nodeRef)
{
    long start = System.currentTimeMillis();
    
    HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
    props.put(ContentModel.PROP_NAME, nodeRef.getId());
    props.put(Version2Model.PROP_QNAME_VERSIONED_NODE_ID, nodeRef.getId());

    // Create a new version history node
    ChildAssociationRef childAssocRef = this.dbNodeService.createNode(
            getRootNode(),
            Version2Model.CHILD_QNAME_VERSION_HISTORIES,
            QName.createQName(Version2Model.NAMESPACE_URI, nodeRef.getId()),
            Version2Model.TYPE_QNAME_VERSION_HISTORY,
            props);
    
    if (logger.isTraceEnabled())
    {
        logger.trace("created version history nodeRef: " + childAssocRef.getChildRef() + " for " + nodeRef + " in "+(System.currentTimeMillis()-start)+" ms");
    }
    
    return childAssocRef.getChildRef();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:Version2ServiceImpl.java

示例2: makePackageContainer

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
private NodeRef makePackageContainer()
{
    NodeRef packages = findOrCreatePackagesFolder();
    String packageId = "pkg_" + GUID.generate();
    QName packageName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, packageId);
    
    try {
    	policyBehaviourFilter.disableBehaviour(packages, ContentModel.ASPECT_AUDITABLE); 
    	ChildAssociationRef packageAssoc = nodeService.createNode(packages, ContentModel.ASSOC_CONTAINS, packageName,
    			WorkflowModel.TYPE_PACKAGE);
    	NodeRef packageContainer = packageAssoc.getChildRef();
    	// TODO: For now, grant full access to everyone
    	permissionService.setPermission(packageContainer, PermissionService.ALL_AUTHORITIES,
    			PermissionService.ALL_PERMISSIONS, true);
    	return packageContainer;
    }
    finally
    {
    	 policyBehaviourFilter.enableBehaviour(packages, ContentModel.ASPECT_AUDITABLE); 
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:WorkflowPackageImpl.java

示例3: getSurfConfigNodeRef

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * Return the "surf-config" noderef under the given root. Optionally create the
 * folder if it does not exist yet. NOTE: must only be set to create if within a
 * WRITE transaction context.
 * <p>
 * Adds the "isIndexed = false" property to the surf-config folder node.
 * 
 * @param rootRef   Root node reference where the "surf-config" folder should live
 * @param create    True to create the folder if missing, false otherwise
 * 
 * @return surf-config folder ref if found, null otherwise if not creating
 */
protected NodeRef getSurfConfigNodeRef(final NodeRef rootRef, final boolean create)
{
    NodeRef surfConfigRef = this.unprotNodeService.getChildByName(
            rootRef, ContentModel.ASSOC_CONTAINS, SURF_CONFIG);
    if (create && surfConfigRef == null)
    {
        if (logger.isDebugEnabled())
            logger.debug("'surf-config' folder not found under path, creating...");
        QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, SURF_CONFIG);
        Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1, 1.0f);
        properties.put(ContentModel.PROP_NAME, (Serializable) SURF_CONFIG);
        ChildAssociationRef ref = this.unprotNodeService.createNode(
                rootRef, ContentModel.ASSOC_CONTAINS, assocQName, ContentModel.TYPE_FOLDER, properties);
        surfConfigRef = ref.getChildRef();
        // surf-config needs to be hidden - applies index control aspect as part of the hidden aspect
        hiddenAspect.hideNode(ref.getChildRef(), false, false, false);

        // MNT-16371: Revoke inherited permission
        permissionService.setInheritParentPermissions(surfConfigRef, false);
        String siteName = siteService.getSiteShortName(rootRef);
        if (siteName != null)
        {
            // Revoke ownership privileges for surf-config folder, to tighten access for former SiteManagers.
            ownableService.setOwner(surfConfigRef, AuthenticationUtil.getAdminUserName());
            // Set site manager group permission
            String siteManagerGroup = siteService.getSiteRoleGroup(siteName, SiteModel.SITE_MANAGER);
            permissionService.setPermission(surfConfigRef, siteManagerGroup, SiteModel.SITE_MANAGER, true);
        }
    }
    return surfConfigRef;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:44,代码来源:ADMRemoteStore.java

示例4: addContent

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
private NodeRef addContent(NodeRef spaceRef, String name, InputStream is, String mimeType)
{
    Map<QName, Serializable> contentProps = new HashMap<QName, Serializable>();
    contentProps.put(ContentModel.PROP_NAME, name);
    
    ChildAssociationRef association = nodeService.createNode(spaceRef,
            ContentModel.ASSOC_CONTAINS, 
            QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), 
            ContentModel.TYPE_CONTENT,
            contentProps);
    
    NodeRef content = association.getChildRef();
    
    // add titled aspect (for Web Client display)
    Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>();
    titledProps.put(ContentModel.PROP_TITLE, name);
    titledProps.put(ContentModel.PROP_DESCRIPTION, name);
    this.nodeService.addAspect(content, ContentModel.ASPECT_TITLED, titledProps);
    
    ContentWriter writer = contentService.getWriter(content, ContentModel.PROP_CONTENT, true);
    
    writer.setMimetype(mimeType);
    writer.setEncoding("UTF-8");
    
    writer.putContent(is);
    
    return content;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:MultiTDemoTest.java

示例5: createNode

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
private NodeRef createNode(String cmName, NodeRef parentNode, QName nodeType)
{
    final NodeService nodeService = (NodeService) appContextRule.getApplicationContext().getBean("nodeService");
    
    Map<QName, Serializable> props = new HashMap<QName, Serializable>();
    props.put(ContentModel.PROP_NAME, cmName);
    ChildAssociationRef childAssoc = nodeService.createNode(parentNode,
                ContentModel.ASSOC_CONTAINS,
                ContentModel.ASSOC_CONTAINS,
                nodeType,
                props);
    
    return childAssoc.getChildRef();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:TemporaryNodes.java

示例6: makeAvatar

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的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

示例7: createContentWithCategories

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * @param storeRef StoreRef
 * @param rootNode NodeRef
 * @return ChildAssociationRef
 */
private ChildAssociationRef createContentWithCategories(StoreRef storeRef, NodeRef rootNode)
{   
    Collection<ChildAssociationRef> assocRefs = categoryService.
        getRootCategories(storeRef, ContentModel.ASPECT_GEN_CLASSIFIABLE);
    assertTrue("Pre-condition failure: not enough categories", assocRefs.size() >= 2);
    Iterator<ChildAssociationRef> it = assocRefs.iterator();
    NodeRef softwareDocCategoryNode = it.next().getChildRef();
    it.next(); // skip one
    NodeRef regionsCategoryNode = it.next().getChildRef();        
    
    
    // Create a content node to categorise
    FileInfo exportFileInfo = fileFolderService.create(rootNode, "Export Folder", ContentModel.TYPE_FOLDER);
    Map<QName, Serializable> properties = Collections.singletonMap(ContentModel.PROP_NAME, (Serializable)"test.txt");
    ChildAssociationRef contentChildAssocRef = nodeService.createNode(
                exportFileInfo.getNodeRef(),
                ContentModel.ASSOC_CHILDREN,
                ContentModel.ASSOC_CHILDREN,
                ContentModel.TYPE_CONTENT,
                properties);
    
    NodeRef contentNodeRef = contentChildAssocRef.getChildRef();

    // Attach categories
    ArrayList<NodeRef> categories = new ArrayList<NodeRef>(2);
    categories.add(softwareDocCategoryNode);
    categories.add(regionsCategoryNode);
    if(!nodeService.hasAspect(contentNodeRef, ContentModel.ASPECT_GEN_CLASSIFIABLE))
    {
        HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
        props.put(ContentModel.PROP_CATEGORIES, categories);
        nodeService.addAspect(contentNodeRef, ContentModel.ASPECT_GEN_CLASSIFIABLE, props);
    }
    else
    {
        nodeService.setProperty(contentNodeRef, ContentModel.PROP_CATEGORIES, categories);
    }
    return contentChildAssocRef;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:45,代码来源:ExporterComponentTest.java

示例8: beforeDeleteChildAssociation

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * Make sure that the child is no longer a translation and that the
 * associated container is cleaned up, if required.
 */
@Override
public void beforeDeleteChildAssociation(ChildAssociationRef childAssocRef)
{
    NodeRef childNodeRef = childAssocRef.getChildRef();
    // This will remove the aspect and take care of the translation container, as required
    multilingualContentService.unmakeTranslation(childNodeRef);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:MultilingualDocumentAspect.java

示例9: makeNode

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * @param parent NodeRef
 * @param nodeType QName
 * @return
 */
private NodeRef makeNode(NodeRef parent, QName nodeType)
{
    String uuid = GUID.generate();
    Map<QName, Serializable> props = new HashMap<QName, Serializable>();
    props.put(ContentModel.PROP_NAME, uuid);
    ChildAssociationRef assoc = nodeService.createNode(parent, ContentModel.ASSOC_CONTAINS, QName.createQName(
            NamespaceService.APP_MODEL_1_0_URI, uuid), nodeType, props);
    return assoc.getChildRef();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:NodeCrawlerTest.java

示例10: buildCategoryNodes

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * Build category nodes.
 * 
 * @param cars  list of associations to category nodes
 * @return {@link Object}[] array of category nodes
 */
private Object[] buildCategoryNodes(Collection<ChildAssociationRef> cars)
{
    Object[] categoryNodes = new Object[cars.size()];
    int i = 0;
    for (ChildAssociationRef car : cars)
    {
        categoryNodes[i++] = new CategoryNode(car.getChildRef(), this.services, getScope());
    }
    return categoryNodes;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:Classification.java

示例11: createOrUpdateRendition

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * 
 * @param sourceNode The node that has been rendered
 * @param tempRendition The relationship between the node and its rendition
 * @param renditionDefinition The definition of the rendition that has just been performed.
 *                            In the case of a composite rendition, this parameter refers
 *                            to that CompositeRendition and not to any of its component renditions.
 * @return ChildAssociationRef
 */
private ChildAssociationRef createOrUpdateRendition(NodeRef sourceNode, ChildAssociationRef tempRendition,
            RenditionDefinition renditionDefinition)
{
    NodeRef tempRenditionNode = tempRendition.getChildRef();
    RenditionLocation renditionLocation = resolveRenditionLocation(sourceNode, renditionDefinition, tempRenditionNode);

    QName renditionQName = renditionDefinition.getRenditionName();

    RenditionNodeManager renditionNodeManager = new RenditionNodeManager(sourceNode, tempRenditionNode,
            renditionLocation, renditionDefinition, nodeService, renditionService, behaviourFilter);
    ChildAssociationRef renditionNode = renditionNodeManager.findOrCreateRenditionNode();

    // Set the name property on the rendition if it has not already been
    // set.
    String renditionName = getRenditionName(tempRenditionNode, renditionLocation, renditionDefinition);
    nodeService.setProperty(renditionNode.getChildRef(), ContentModel.PROP_NAME, renditionName); // to manager

    // Add temporary aspect for temporary rendition node
    // When this node id deleted, will not appear in user's trashcan
    nodeService.addAspect(tempRendition.getChildRef(), ContentModel.ASPECT_TEMPORARY, null);
    // Delete the temporary rendition.
    nodeService.removeChildAssociation(tempRendition);
    if (logger.isDebugEnabled())
    {
        logger.debug("Removed temporary child-association " + tempRendition);
    }

    // Handle the rendition aspects
    manageRenditionAspects(sourceNode, renditionNode);
    
    // Verify that everything has gone to plan, and nothing got lost on the way!
    ChildAssociationRef renditionAssoc = renditionService.getRenditionByName(sourceNode, renditionQName);
    if (renditionAssoc == null)
    {
        String msg = "A rendition of name: " + renditionQName + " should have been created for source node: "
                    + sourceNode;
        throw new RenditionServiceException(msg);
    }
    // Return the link between the source and the new, final rendition
    return renditionAssoc;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:51,代码来源:AbstractRenderingEngine.java

示例12: testCreateVersion

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
@Test
public void testCreateVersion() throws Exception
{

    ChildAssociationRef contentWithVersionsAssocRef = createContent(node2_1,
                                                                    "ContentWithVersions");
    NodeRef contentWithVersionsNodeRef = contentWithVersionsAssocRef.getChildRef();
    Reference reference = Reference.fromNodeRef(contentWithVersionsNodeRef);
    assertNotNull(reference);
    NodeRef actualContentWithVersionsNodeRef = 
                    reference.execute(new GetActualNodeRefMethod(environment));

    VersionHistory versionHistory = versionService.getVersionHistory(contentWithVersionsNodeRef);
    assertNull(versionHistory);
    VersionHistory actualVersionHistory = versionService.getVersionHistory(actualContentWithVersionsNodeRef);
    assertNull(actualVersionHistory);

    Version newVersion = versionService.createVersion(contentWithVersionsNodeRef,
                                                      null);

    NodeRef newVersionNodeRef = newVersion.getVersionedNodeRef();
    assertNotNull(Reference.fromNodeRef(newVersionNodeRef));

    versionHistory = versionService.getVersionHistory(newVersionNodeRef);
    assertNotNull(versionHistory);

    Collection<Version> allVersions = versionHistory.getAllVersions();
    assertEquals(1,
                 allVersions.size());

    actualVersionHistory = versionService.getVersionHistory(actualContentWithVersionsNodeRef);
    assertNotNull(actualVersionHistory);

    Collection<Version> allActualVersions = versionHistory.getAllVersions();
    assertEquals(1,
                 allActualVersions.size());

    Version actualVersion = actualVersionHistory.getHeadVersion();

    NodeRef newActualVersionNodeRef = actualVersion.getVersionedNodeRef();
    assertNull(Reference.fromNodeRef(newActualVersionNodeRef));

    assertEquals(newActualVersionNodeRef,
                 actualContentWithVersionsNodeRef);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:46,代码来源:VirtualVersionServiceExtensionTest.java

示例13: addTextContent

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
private NodeRef addTextContent(NodeRef folderRef, String name, String textData)
{
    Map<QName, Serializable> contentProps = new HashMap<QName, Serializable>();
    contentProps.put(ContentModel.PROP_NAME, name);

    ChildAssociationRef association = nodeService.createNode(folderRef, ContentModel.ASSOC_CONTAINS,
            QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), ContentModel.TYPE_CONTENT, contentProps);

    NodeRef content = association.getChildRef();

    ContentWriter writer = contentService.getWriter(content, ContentModel.PROP_CONTENT, true);

    writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
    writer.setEncoding("UTF-8");

    writer.putContent(textData);

    return content;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:20,代码来源:PersonServiceTest.java

示例14: onCreateNode

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
/**
 * @see PropertiesIntegrityEvent
 * @see AssocTargetRoleIntegrityEvent
 * @see AssocTargetMultiplicityIntegrityEvent
 */
public void onCreateNode(ChildAssociationRef childAssocRef)
{
    NodeRef childRef = childAssocRef.getChildRef(); 
    if (! storesToIgnore.contains(tenantService.getBaseName(childRef.getStoreRef()).toString()))
    {
        IntegrityEvent event = null;
        // check properties on child node
        event = new PropertiesIntegrityEvent(
                nodeService,
                dictionaryService,
                childRef);
        save(event);
        
        // check that the multiplicity and other properties of the new association are allowed
        onCreateChildAssociation(childAssocRef, false);
        
        // check mandatory aspects
        event = new AspectsIntegrityEvent(nodeService, dictionaryService, childRef);
        save(event);
        
        // check for associations defined on the new node (child)
        QName childNodeTypeQName = nodeService.getType(childRef);
        ClassDefinition nodeTypeDef = dictionaryService.getClass(childNodeTypeQName);
        if (nodeTypeDef == null)
        {
            throw new DictionaryException("The node type is not recognized: " + childNodeTypeQName);
        }
        Map<QName, AssociationDefinition> childAssocDefs = nodeTypeDef.getAssociations();
        
        // check the multiplicity of each association with the node acting as a source
        for (AssociationDefinition assocDef : childAssocDefs.values())
        {
            QName assocTypeQName = assocDef.getName();
            // check target multiplicity
            event = new AssocTargetMultiplicityIntegrityEvent(
                    nodeService,
                    dictionaryService,
                    childRef,
                    assocTypeQName,
                    false);
            save(event);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:50,代码来源:IntegrityChecker.java

示例15: setUpTestAssociations

import org.alfresco.service.cmr.repository.ChildAssociationRef; //导入方法依赖的package包/类
private void setUpTestAssociations(NodeRef actualNodeRef)
{
    rootChildrenQNames = new QName[13];
    rootChildrenQNames[0] = QName.createQNameWithValidLocalName(VirtualContentModel.VIRTUAL_CONTENT_MODEL_1_0_URI,
                                                                "Node2");
    rootChildrenQNames[1] = QName.createQNameWithValidLocalName(VirtualContentModel.VIRTUAL_CONTENT_MODEL_1_0_URI,
                                                                "Node1");

    NodeRef node2 = nodeService.getChildByName(virtualFolder1NodeRef,
                                               ContentModel.ASSOC_CONTAINS,
                                               "Node2");

    String node2ChildNameString = "test1_2.txt";
    ChildAssociationRef node2ChildAssoc = createContent(node2,
                                                        node2ChildNameString);
    node2Test1_2_TXTNodeRef = node2ChildAssoc.getChildRef();
    rootChildrenQNames[2] = QName.createQNameWithValidLocalName(NamespaceService.CONTENT_MODEL_1_0_URI,
                                                                node2ChildNameString);

    nodeService.setProperty(node2ChildAssoc.getChildRef(),
                            ContentModel.PROP_TITLE,
                            NODE2TEST1_2_TXT);

    node2ChildrenQNames = new QName[2];
    node2ChildrenQNames[0] = QName.createQNameWithValidLocalName(VirtualContentModel.VIRTUAL_CONTENT_MODEL_1_0_URI,
                                                                 "Node2_1");
    node2ChildrenQNames[1] = node2ChildAssoc.getQName();

    NodeRef node2_1 = nodeService.getChildByName(node2,
                                                 ContentModel.ASSOC_CONTAINS,
                                                 "Node2_1");

    node2_1ChildrenQNames = new QName[10];
    for (int i = 1; i <= 10; i++)
    {
        ChildAssociationRef childAssoc = createContent(node2_1,
                                                       "test" + i + "_2_1.txt");
        rootChildrenQNames[2 + i] = QName.createQNameWithValidLocalName(NamespaceService.CONTENT_MODEL_1_0_URI,
                                                                        childAssoc.getQName().getLocalName());
        node2_1ChildrenQNames[i - 1] = childAssoc.getQName();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:43,代码来源:VirtualNodeServiceExtensionTest.java


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