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


Java ContentModel.ASSOC_CONTAINS屬性代碼示例

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


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

示例1: getAssocTypeQName

/**
 * Get the type of child association that should be created.
 * 
 * @param parentNodeRef the parent
 * @return Returns the appropriate child association type qualified name for the type of the
 *      parent.  Null will be returned if it can't be determined.
 */
private QName getAssocTypeQName(NodeRef parentNodeRef)
{
    // check the parent node's type to determine which association to use
    QName parentNodeTypeQName = nodeService.getType(parentNodeRef);
    QName assocTypeQName = null;
    if (dictionaryService.isSubClass(parentNodeTypeQName, ContentModel.TYPE_CONTAINER))
    {
        // it may be a root node or something similar
        assocTypeQName = ContentModel.ASSOC_CHILDREN;
    }
    else if (dictionaryService.isSubClass(parentNodeTypeQName, ContentModel.TYPE_FOLDER))
    {
        // more like a directory
        assocTypeQName = ContentModel.ASSOC_CONTAINS;
    }
    return assocTypeQName;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:24,代碼來源:FileImporterImpl.java

示例2: moveNode

/**
 * move transfer node to new parent.
 * @param childNode
 * @param newParent
 */
private void moveNode(TransferManifestNormalNode childNode, TransferManifestNormalNode newParent)
{
    List<ChildAssociationRef> currentParents = childNode.getParentAssocs();
    List<ChildAssociationRef> newParents = new ArrayList<ChildAssociationRef>();

    for (ChildAssociationRef parent : currentParents)
    {
        if (!parent.isPrimary())
        {
            newParents.add(parent);
        }
        else
        {
            ChildAssociationRef newPrimaryAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, newParent
                    .getNodeRef(), parent.getQName(), parent.getChildRef(), true, -1);
            newParents.add(newPrimaryAssoc);
            childNode.setPrimaryParentAssoc(newPrimaryAssoc);
            Path newParentPath = new Path();
            newParentPath.append(newParent.getParentPath());
            newParentPath.append(new Path.ChildAssocElement(newParent.getPrimaryParentAssoc()));
            childNode.setParentPath(newParentPath);
        }
    }
    childNode.setParentAssocs(newParents);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:30,代碼來源:RepoTransferReceiverImplTest.java

示例3: moveOldRendition

/**
 * This method moves the old rendition to the required location giving it the correct parent-assoc type and
 * the specified association name.
 * 
 * @param renditionName the name to put on the newly created association.
 * @return the ChildAssociationRef of the moved nodeRef.
 */
private ChildAssociationRef moveOldRendition(QName renditionName)
{
    NodeRef parent = location.getParentRef();
    QName assocName = getAssociationName(parent.equals(sourceNode), renditionName);
    QName assocType = sourceNode.equals(parent) ? RenditionModel.ASSOC_RENDITION : ContentModel.ASSOC_CONTAINS;
    ChildAssociationRef result = nodeService.moveNode(existingLinkedRendition, parent, assocType, assocName);
    
    if (logger.isDebugEnabled())
    {
        logger.debug("The old rendition was moved to " + result);
    }
    return result;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:20,代碼來源:RenditionNodeManager.java

示例4: createContentNode

/**
 * @return
 */
private TransferManifestNormalNode createContentNode(/*String transferId*/) throws Exception
{
    TransferManifestNormalNode node = new TransferManifestNormalNode();
    String uuid = GUID.generate();
    NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, uuid);
    node.setNodeRef(nodeRef);
    node.setUuid(uuid);
    byte[] dummyContent = "This is some dummy content.".getBytes("UTF-8");

    node.setType(ContentModel.TYPE_CONTENT);
    
    /**
     * Get guest home
     */
    NodeRef parentFolder = guestHome;

    String nodeName = uuid + ".testnode" + getNameSuffix();

    List<ChildAssociationRef> parents = new ArrayList<ChildAssociationRef>();
    ChildAssociationRef primaryAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parentFolder, QName
            .createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName), node.getNodeRef(), true, -1);
    parents.add(primaryAssoc);
    node.setParentAssocs(parents);
    node.setParentPath(nodeService.getPath(parentFolder));
    node.setPrimaryParentAssoc(primaryAssoc);

    Map<QName, Serializable> props = new HashMap<QName, Serializable>();
    props.put(ContentModel.PROP_NODE_UUID, uuid);
    props.put(ContentModel.PROP_NAME, nodeName);
    ContentData contentData = new ContentData("/" + uuid, "text/plain", dummyContent.length, "UTF-8");
    props.put(ContentModel.PROP_CONTENT, contentData);
    node.setProperties(props);

    return node;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:38,代碼來源:RepoTransferReceiverImplTest.java

示例5: createFolderNode

private TransferManifestNormalNode createFolderNode(String folderName) throws Exception
{
    TransferManifestNormalNode node = new TransferManifestNormalNode();
    String uuid = GUID.generate();
    NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, uuid);
    node.setNodeRef(nodeRef);
    node.setUuid(uuid);

    node.setType(ContentModel.TYPE_FOLDER);
    
    NodeRef parentFolder = repositoryHelper.getGuestHome();

    String nodeName = folderName == null ? uuid + ".folder" + getNameSuffix() : folderName;

    List<ChildAssociationRef> parents = new ArrayList<ChildAssociationRef>();
    ChildAssociationRef primaryAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parentFolder, QName
            .createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName), node.getNodeRef(), true, -1);
    parents.add(primaryAssoc);
    node.setParentAssocs(parents);
    node.setParentPath(nodeService.getPath(parentFolder));
    node.setPrimaryParentAssoc(primaryAssoc);

    Map<QName, Serializable> props = new HashMap<QName, Serializable>();
    props.put(ContentModel.PROP_NODE_UUID, uuid);
    props.put(ContentModel.PROP_NAME, nodeName);
    node.setProperties(props);

    return node;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:29,代碼來源:RepoTransferReceiverImplTest.java

示例6: childAssoc

private ChildAssociationRef childAssoc(String id)
{
    return new ChildAssociationRef(
        ContentModel.ASSOC_CONTAINS,
        new NodeRef("test://store/parentRef"),
        ContentModel.TYPE_CONTENT,
        new NodeRef("test://store/" + id)
    );
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:9,代碼來源:DbOrIndexSwitchingQueryLanguageTest.java

示例7: createContentNode

/**
 * @return TransferManifestNormalNode
 */
private TransferManifestNormalNode createContentNode(NodeRef parentFolder, String nodeName) throws Exception
{
    TransferManifestNormalNode node = new TransferManifestNormalNode();
    String uuid = GUID.generate();
    NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, uuid);
    node.setNodeRef(nodeRef);
    node.setUuid(uuid);
    byte[] dummyContent = "This is some dummy content.".getBytes("UTF-8");

    node.setType(ContentModel.TYPE_CONTENT);
    node.setAncestorType(ContentModel.TYPE_CONTENT);

    /**
     * Get guest home
     */

    List<ChildAssociationRef> parents = new ArrayList<ChildAssociationRef>();
    ChildAssociationRef primaryAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parentFolder, QName
            .createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName), node.getNodeRef(), true, -1);
    parents.add(primaryAssoc);
    node.setParentAssocs(parents);
    node.setParentPath(null);
    node.setPrimaryParentAssoc(primaryAssoc);

    Map<QName, Serializable> props = new HashMap<QName, Serializable>();
    props.put(ContentModel.PROP_NODE_UUID, uuid);
    props.put(ContentModel.PROP_NAME, nodeName);
    ContentData contentData = new ContentData("/" + uuid, "text/plain", dummyContent.length, "UTF-8");
    props.put(ContentModel.PROP_CONTENT, contentData);
    node.setProperties(props);

    return node;
}
 
開發者ID:Alfresco,項目名稱:alfresco-file-transfer-receiver,代碼行數:36,代碼來源:FileTransferReceiverTest.java

示例8: createFolderNode

/**
 * @return TransferManifestNormalNode
 */
private TransferManifestNormalNode createFolderNode(NodeRef parentFolder, String nodeName) throws Exception
{
    TransferManifestNormalNode node = new TransferManifestNormalNode();
    String uuid = GUID.generate();
    NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, uuid);
    node.setNodeRef(nodeRef);
    node.setUuid(uuid);
    node.setType(ContentModel.TYPE_FOLDER);
    node.setAncestorType(ContentModel.TYPE_FOLDER);

    /**
     * Get guest home
     */

    List<ChildAssociationRef> parents = new ArrayList<ChildAssociationRef>();
    ChildAssociationRef primaryAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parentFolder, QName
            .createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName), node.getNodeRef(), true, -1);
    parents.add(primaryAssoc);
    node.setParentAssocs(parents);
    node.setParentPath(null);
    node.setPrimaryParentAssoc(primaryAssoc);

    Map<QName, Serializable> props = new HashMap<QName, Serializable>();
    props.put(ContentModel.PROP_NODE_UUID, uuid);
    props.put(ContentModel.PROP_NAME, nodeName);
    node.setProperties(props);

    return node;
}
 
開發者ID:Alfresco,項目名稱:alfresco-file-transfer-receiver,代碼行數:32,代碼來源:FileTransferReceiverTest.java

示例9: modifyParentNode

private void modifyParentNode(NodeRef parentFolder, TransferManifestNormalNode nodeToMove ) throws Exception
{

    String nodeName = (String)nodeToMove.getProperties().get(ContentModel.PROP_NAME);


    List<ChildAssociationRef> parents = new ArrayList<ChildAssociationRef>();
    ChildAssociationRef primaryAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parentFolder, QName
            .createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName), nodeToMove.getNodeRef(), true, -1);
    parents.add(primaryAssoc);
    nodeToMove.setParentAssocs(parents);
    nodeToMove.setParentPath(null);
    nodeToMove.setPrimaryParentAssoc(primaryAssoc);

}
 
開發者ID:Alfresco,項目名稱:alfresco-file-transfer-receiver,代碼行數:15,代碼來源:FileTransferReceiverTest.java

示例10: makeChildNode

private NodeRef makeChildNode(NodeRef parent, QName type)
{
    QName qName = QName.createQName("", GUID.generate());
    QName contains = ContentModel.ASSOC_CONTAINS;
    ChildAssociationRef result = nodeService.createNode(parent, contains, qName, type);
    return result.getChildRef();
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:7,代碼來源:NodeLocatorWebScriptTest.java

示例11: a_non_exisiting_target_for_an_association_can_be_asserted

@Test
public void a_non_exisiting_target_for_an_association_can_be_asserted() {
    final NodeRef nonExistingTarget = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "1");
    final QName assoc = ContentModel.ASSOC_CONTAINS;
    nodeService.createAssociation(nodeRef, nodeRef, assoc);
    assertThat(nodeRef).doesNotHaveTargetAssociationTo(assoc, nonExistingTarget);
}
 
開發者ID:ixxus,項目名稱:alfresco-test-assertions,代碼行數:7,代碼來源:NodeAssertTest.java

示例12: getParentAssocs

@Override
public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern,
            QNamePattern qnamePattern)
{
    NodeServiceTrait theTrait = getTrait();
    Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference != null)
    {
        Reference parent = reference.execute(new GetParentReferenceMethod());
        if (parent == null)
        {
            return theTrait.getParentAssocs(reference.execute(new GetActualNodeRefMethod(environment)),
                                            typeQNamePattern,
                                            qnamePattern);
        }
        else
        {
            if (typeQNamePattern.isMatch(ContentModel.ASSOC_CONTAINS))
            {
                Reference parentsParent = parent.execute(new GetParentReferenceMethod());

                NodeRef parentNodeRef = parent.toNodeRef();
                if (parentsParent == null)
                {
                    parentNodeRef = parent.execute(new GetActualNodeRefMethod(environment));

                }

                NodeRef referenceNodeRef = reference.toNodeRef();
                Map<QName, Serializable> properties = smartStore.getProperties(reference);
                Serializable name = properties.get(ContentModel.PROP_NAME);
                QName assocChildName = QName
                            .createQNameWithValidLocalName(VirtualContentModel.VIRTUAL_CONTENT_MODEL_1_0_URI,
                                                           name.toString());
                if (qnamePattern.isMatch(assocChildName))
                {
                    ChildAssociationRef assoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS,
                                                                        parentNodeRef,
                                                                        assocChildName,
                                                                        referenceNodeRef);
                    return Arrays.asList(assoc);
                }
                else
                {
                    return Collections.emptyList();
                }
            }
            else
            {
                return Collections.emptyList();
            }
        }
    }
    else
    {
        return theTrait.getParentAssocs(nodeRef,
                                        typeQNamePattern,
                                        qnamePattern);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:60,代碼來源:VirtualNodeServiceExtension.java

示例13: getPrimaryParent

@Override
public ChildAssociationRef getPrimaryParent(NodeRef nodeRef)
{
	Reference reference = Reference.fromNodeRef(nodeRef);
    if (reference != null)
    {  
        Reference parent = reference.execute(new GetParentReferenceMethod());
        if (parent == null)
        {
            return getTrait().getPrimaryParent(reference.execute(new GetActualNodeRefMethod(environment)));
        }
        else
        {
            Reference parentsParent = parent.execute(new GetParentReferenceMethod());

            NodeRef parentNodeRef = parent.toNodeRef();
            if (parentsParent == null)
            {
                parentNodeRef = parent.execute(new GetActualNodeRefMethod(environment));

            }

            NodeRef referenceNodeRef = reference.toNodeRef();
            Map<QName, Serializable> refProperties = smartStore.getProperties(reference);
            Serializable childName = refProperties.get(ContentModel.PROP_NAME);
            QName childAssocQName = QName
                        .createQNameWithValidLocalName(VirtualContentModel.VIRTUAL_CONTENT_MODEL_1_0_URI,
                                                       childName.toString());
            ChildAssociationRef assoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS,
                                                                parentNodeRef,
                                                                childAssocQName,
                                                                referenceNodeRef,
                                                                true,
                                                                -1);
            return assoc;
        }
    }
    else
    {
        return getTrait().getPrimaryParent(nodeRef);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:42,代碼來源:VirtualNodeServiceExtension.java

示例14: execute

@Override
public List<ChildAssociationRef> execute(VirtualProtocol virtualProtocol, Reference reference)
            throws ProtocolMethodException
{
    if (typeQNamePattern.isMatch(ContentModel.ASSOC_CONTAINS))
    {
        List<ChildAssociationRef> childAssocs = new LinkedList<>();
        List<Reference> children = smartStore.list(reference);
        NodeRef nodeRefReference = reference.toNodeRef();
        int count = 0;
        for (Reference child : children)
        {
            if (count >= maxResults)
            {
                break;
            }

            NodeRef childNodeRef = child.toNodeRef();
            Serializable childName = environment.getProperty(childNodeRef,
                                                             ContentModel.PROP_NAME);
            QName childAssocQName = QName
                        .createQNameWithValidLocalName(VirtualContentModel.VIRTUAL_CONTENT_MODEL_1_0_URI,
                                                       childName.toString());
            if (qnamePattern.isMatch(childAssocQName))
            {

                ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS,
                                                                         nodeRefReference,
                                                                         childAssocQName,
                                                                         childNodeRef,
                                                                         true,
                                                                         -1);
                childAssocs.add(childAssoc);
                count++;
            }
        }

        return childAssocs;
    }
    else
    {
        return Collections.emptyList();
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:44,代碼來源:GetChildAssocsMethod.java

示例15: createThumbnailPassesParametersToActionService

/**
 * This test method ensures that the parameters on thumbnail-create are
 * passed through the RenditionService to the ActionService
 */
@Test
public void createThumbnailPassesParametersToActionService()
{
    // As most of the services are mocked out, the actual values used here
    // don't matter.
    final Map<String, Serializable> parametersUnderTest = new HashMap<String, Serializable>();
    parametersUnderTest.put(ImageRenderingEngine.PARAM_RESIZE_WIDTH, new Integer(42));
    parametersUnderTest.put(ImageRenderingEngine.PARAM_RESIZE_HEIGHT, new Integer(93));
    parametersUnderTest.put(ImageRenderingEngine.PARAM_COMMAND_OPTIONS, "foo");
    parametersUnderTest.put(ImageRenderingEngine.PARAM_MAINTAIN_ASPECT_RATIO, Boolean.TRUE);
    parametersUnderTest.put(ImageRenderingEngine.PARAM_RESIZE_TO_THUMBNAIL, Boolean.FALSE);
    parametersUnderTest.put(ImageRenderingEngine.PARAM_ALLOW_ENLARGEMENT, Boolean.TRUE);
    parametersUnderTest.put(AbstractRenderingEngine.PARAM_TARGET_CONTENT_PROPERTY, ContentModel.PROP_CONTENT);
    parametersUnderTest.put(RenditionService.PARAM_DESTINATION_NODE, dummyNodeRef2);
    parametersUnderTest.put(PagedSourceOptionsSerializer.PARAM_SOURCE_START_PAGE, new Integer(2));
    parametersUnderTest.put(PagedSourceOptionsSerializer.PARAM_SOURCE_END_PAGE, new Integer(2));
    parametersUnderTest.put(TemporalSourceOptionsSerializer.PARAM_SOURCE_TIME_OFFSET, "00:00:00.5");
    

    ImageTransformationOptions imageTransOpts = new ImageTransformationOptions();
    imageTransOpts.setTargetNodeRef(dummyNodeRef2);
    
    imageTransOpts.setTargetContentProperty((QName) parametersUnderTest.get(ImageRenderingEngine.PARAM_TARGET_CONTENT_PROPERTY));
    imageTransOpts.setCommandOptions((String) parametersUnderTest.get(ImageRenderingEngine.PARAM_COMMAND_OPTIONS));

    ImageResizeOptions resizeOptions = new ImageResizeOptions();
    resizeOptions.setHeight((Integer) parametersUnderTest.get(ImageRenderingEngine.PARAM_RESIZE_HEIGHT));
    resizeOptions.setWidth((Integer) parametersUnderTest.get(ImageRenderingEngine.PARAM_RESIZE_WIDTH));
    resizeOptions.setMaintainAspectRatio((Boolean) parametersUnderTest.get(ImageRenderingEngine.PARAM_MAINTAIN_ASPECT_RATIO));
    resizeOptions.setResizeToThumbnail((Boolean) parametersUnderTest.get(ImageRenderingEngine.PARAM_RESIZE_TO_THUMBNAIL));
    resizeOptions.setAllowEnlargement((Boolean) parametersUnderTest.get(ImageRenderingEngine.PARAM_ALLOW_ENLARGEMENT));
    imageTransOpts.setResizeOptions(resizeOptions);
    
    PagedSourceOptions pagedSourceOptions = new PagedSourceOptions();
    pagedSourceOptions.setStartPageNumber((Integer) parametersUnderTest.get(PagedSourceOptionsSerializer.PARAM_SOURCE_START_PAGE));
    pagedSourceOptions.setEndPageNumber((Integer) parametersUnderTest.get(PagedSourceOptionsSerializer.PARAM_SOURCE_END_PAGE));
    imageTransOpts.addSourceOptions(pagedSourceOptions);
    
    TemporalSourceOptions temporalSourceOptions = new TemporalSourceOptions();
    temporalSourceOptions.setOffset((String) parametersUnderTest.get(TemporalSourceOptionsSerializer.PARAM_SOURCE_TIME_OFFSET));
    imageTransOpts.addSourceOptions(temporalSourceOptions);
    
    ThumbnailParentAssociationDetails assocDetails = new ThumbnailParentAssociationDetails(dummyNodeRef3,
                ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
                            "homerSimpson"));
    
    // Now request the creation of the the thumbnail.
    thumbnailService.createThumbnail(dummyNodeRef1, ContentModel.PROP_CONTENT, MimetypeMap.MIMETYPE_IMAGE_JPEG,
                imageTransOpts, "bartSimpson", assocDetails);

    
    ArgumentCaptor<Action> argument = ArgumentCaptor.forClass(Action.class);
    verify(mockActionService).executeAction(argument.capture(), any(NodeRef.class), anyBoolean(), anyBoolean());
    final Action action = argument.getValue();
    final RenditionDefinition renditionDefn = (RenditionDefinition)action;
    Map<String, Serializable> parameters = renditionDefn.getParameterValues();
    
    for (String s : parametersUnderTest.keySet())
    {
        if (parameters.keySet().contains(s) == false || parameters.get(s) == null || parameters.get(s).toString().length() == 0)
        {
            fail("Missing parameter " + s);
        }
        assertEquals("Parameter " + s + " had wrong value.",
                parametersUnderTest.get(s), parameters.get(s));
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:71,代碼來源:ThumbnailServiceImplParameterTest.java


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