我目前开始使用 Alfresco CMS.我需要在我的内容模型中创建一个方面",它必须包含许多属性:
I am starting currently using Alfresco CMS. I need to create an "aspect" in my content model which must contains a number of properties as:
Aspect: property 1 : String property 2 : int property 3 : int property 4 : long此外,它必须包含另外两个属性,这些属性由以下任一属性组成:
Moreover it must contains two more properties which are composed either of number of properties as:
Format: FormatProperty1: int FormatProperty2: int FormatProperty3: int Metadata: list1: List<String> list2: List<String> MetadataProperty 3: boolean我尚未在 Alfresco 中创建简单的内容模型或方面.根据我之前在关系数据库中的知识,我认为上述结构是表之间的关联.如何在具有方面或更多方面的 Alfresco 内容模型中执行该操作?
I have not yet created neither a simple content model nor an aspect in Alfresco. Based on my previous knowledge in Relational Databases I perceive the above structure as association between tables. How can I carry out that in Alfresco content model with an aspect or more?
推荐答案你应该看看 这里 首先.在 Alfresco 中创建模型与 DB 相去甚远.
You should take a look here first. Creating a model in Alfresco is far away from a DB.
它只是一个定义良好的 XML.您必须先编写 XML,然后通过引导程序对其进行初始化.
it's just an XML well defined. You have to write the XML first, then initialize it through bootstrap.
示例 XML 模型 cmodModel.xml:
Example XML Model cmodModel.xml:
<?xml version="1.0" encoding="UTF-8"?> <!-- Definition of new Model --> <model name="custom:custommodel" xmlns="www.alfresco/model/dictionary/1.0"> <!-- Optional meta-data about the model --> <description>Custom Model</description> <author>Whatever</author> <version>1.0</version> <!-- Imports are required to allow references to definitions in other models --> <imports> <!-- Import Alfresco Dictionary Definitions --> <import uri="www.alfresco/model/dictionary/1.0" prefix="d" /> <!-- Import Alfresco Content Domain Model Definitions --> <import uri="www.alfresco/model/content/1.0" prefix="cm" /> <import uri="www.alfresco/model/system/1.0" prefix="sys" /> </imports> <!-- Introduction of new namespaces defined by this model --> <namespaces> <namespace uri="custom.model" prefix="cmod" /> </namespaces> <!-- Lists <String> --> <constraints> <constraint name="cmod:liststring1" type="LIST"> <parameter name="allowedValues"> <list> <value>value 1</value> <value>value 2</value> </list> </parameter> </constraint> <constraint name="cmod:liststring2" type="LIST"> <parameter name="allowedValues"> <list> <value>value 1</value> <value>value 2</value> </list> </parameter> </constraint> </constraints> <types> <!-- Document Type --> <type name="cmod:customDoc"> <title>Document</title> <description>Document</description> <parent>cm:content</parent> <mandatory-aspects> <aspect>cmod:aspectBase</aspect> <aspect>cmod:aspectFormat</aspect> <aspect>cmod:aspectMetadata</aspect> </mandatory-aspects> </type> </types> <!-- Definition of custom aspects --> <aspects> <aspect name="cmod:aspectBase"> <title>Aspect base properties</title> <properties> <property name="cmod:property1"> <title>p1</title> <description>p1</description> <type>d:text</type> </property> <property name="cmod:property2"> <title>p2</title> <description>p2</description> <type>d:int</type> </property> <property name="cmod:property3"> <title>p3</title> <description>p3</description> <type>d:int</type> </property> <property name="cmod:property4"> <title>p4</title> <description>p4</description> <type>d:text</type> </property> </properties> </aspect> <aspect name="cmod:aspectFormat"> <title>Aspect Format</title> <properties> <property name="cmod:formatProperty1"> <title>fp1</title> <description>fp1</description> <type>d:int</type> </property> <property name="cmod:formatProperty2"> <title>fp2</title> <description>fp2</description> <type>d:int</type> </property> <property name="cmod:formatProperty3"> <title>fp3</title> <description>fp3</description> <type>d:int</type> </property> </properties> </aspect> <aspect name="cmod:aspectMetadata"> <title>Aspetto Metadata</title> <properties> <property name="cmod:metadataProperty1"> <title>mp1</title> <description>mp1</description> <type>d:text</type> <constraints> <constraint ref="cmod:liststring1" /> </constraints> </property> <property name="cmod:metadataProperty2"> <title>mp2</title> <description>mp2</description> <type>d:text</type> <constraints> <constraint ref="cmod:liststring2" /> </constraints> </property> <property name="cmod:metadataProperty3"> <title>mp3</title> <description>mp3</description> <type>d:boolean</type> </property> </properties> </aspect> </aspects> </model>名为 cmod-model-context.xml 的模型上下文
model context named cmod-model-context.xml
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'www.springframework/dtd/spring-beans.dtd'> <beans> <!-- Registration of new models --> <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap"> <property name="models"> <list> <value>alfresco/extension/model/cmodModel.xml</value> </list> </property> </bean> </beans>希望有帮助.
更多推荐
在 Alfresco 内容模型中创建一个方面
发布评论