我现在开始使用Alfresco CMS。我需要在我的内容模型中创建一个aspect,它必须包含一些属性:
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中创建模型远离数据库。
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内容模型中创建一个方面
发布评论