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


Java ContentModel.TYPE_CONTENT屬性代碼示例

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


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

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

示例2: testCreateRenditionNodeAssoc

@SuppressWarnings({"unchecked" , "rawtypes"})
public void testCreateRenditionNodeAssoc() throws Exception
{
    QName assocType = RenditionModel.ASSOC_RENDITION;
    when(nodeService.exists(source)).thenReturn(true);
    QName nodeType = ContentModel.TYPE_CONTENT;
    ChildAssociationRef renditionAssoc = makeRenditionAssoc();
    RenditionDefinition definition = makeRenditionDefinition(renditionAssoc);

    // Stub the createNode() method to return renditionAssoc.
    when(nodeService.createNode(eq(source), eq(assocType), any(QName.class), any(QName.class), anyMap()))
        .thenReturn(renditionAssoc);
    engine.execute(definition, source);

    // Check the createNode method was called with the correct parameters.
    // Check the nodeType defaults to cm:content.
    ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
    verify(nodeService).createNode(eq(source), eq(assocType), any(QName.class), eq(nodeType), captor.capture());
    Map<String, Serializable> props = captor.getValue();

    // Check the node name is set to match teh rendition name local name.
    assertEquals(renditionAssoc.getQName().getLocalName(), props.get(ContentModel.PROP_NAME));

    // Check content property name defaults to cm:content
    assertEquals(ContentModel.PROP_CONTENT, props.get(ContentModel.PROP_CONTENT_PROPERTY_NAME));

    // Check the returned result is the association created by the call to
    // nodeServcie.createNode().
    Serializable result = definition.getParameterValue(ActionExecuter.PARAM_RESULT);
    assertEquals("The returned rendition association is not the one created by the node service!", renditionAssoc,
                result);

    // Check that setting the default content property and default node type
    // on the rendition engine works.
    nodeType = QName.createQName("url", "someNodeType");
    QName contentPropName = QName.createQName("url", "someContentProp");
    engine.setDefaultRenditionContentProp(contentPropName.toString());
    engine.setDefaultRenditionNodeType(nodeType.toString());
    engine.execute(definition, source);
    verify(nodeService).createNode(eq(source), eq(assocType), any(QName.class), eq(nodeType), captor.capture());
    props = captor.getValue();
    assertEquals(contentPropName, props.get(ContentModel.PROP_CONTENT_PROPERTY_NAME));

    // Check that setting the rendition node type param works.
    nodeType = ContentModel.TYPE_THUMBNAIL;
    contentPropName = ContentModel.PROP_CONTENT;
    definition.setParameterValue(RenditionService.PARAM_RENDITION_NODETYPE, nodeType);
    definition.setParameterValue(AbstractRenderingEngine.PARAM_TARGET_CONTENT_PROPERTY, contentPropName);
    engine.execute(definition, source);
    verify(nodeService).createNode(eq(source), eq(assocType), any(QName.class), eq(nodeType), captor.capture());
    props = captor.getValue();
    assertEquals(contentPropName, props.get(ContentModel.PROP_CONTENT_PROPERTY_NAME));
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:53,代碼來源:AbstractRenderingEngineTest.java


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