Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Creating and deploying Custom Content types

Avatar

Former Community Member

Hi,

I have installed LiveCycle ES2 with ContentSpace module. I need to create my own content type, which includes custom metadata fields to be defined as string, date, integer, document..etc type. I could not find a way to do it, could anyone help on the same please ?

thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi Rudi,

For a detailed understanding on how to create new custom types you can take a look at:- http://wiki.alfresco.com/wiki/Step-By-Step:_Creating_A_Custom_Model

Also  find below an example of custom Content Model (OrganizationModel.xml).

Example creates a new type "employee". This new type derives from the existing cm:folder type in Content Services (<parent>cm:folder</parent>). In case you want the objects of your custom types to be visible in the content space UI you should derive them from either cm:folder or cm:cmcontent. Also, this type defines 2 properties namely employeeCode and designation both of them of text type.

To deploy this custom type

1.       Go to ContentServices UI @ http://<LCServer>:<Port>/contentspace    .

2.       Browse to Company Home -> Data Dictionary -> Models.

3.       Add Content.

4.       Make sure Modify all properties when page closes is checked.

5.       Select Activate Model.

ContentServicesImage.JPG

Once your model is activated you can see it from Workbench in the list of nodeTypes for operations like StoreContent (see image).

Here is the text of OrganizationModel.xml for your ease.

<model name="org:OrganizationModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
</imports>

<!--Introduction of new namespaces defined by this model -->
<namespaces>
     <namespace uri="http://www.adobe.com/lc/organization/1.0" prefix="org" />
</namespaces>

<data-types/>
<constraints/>

<types>
     <!--<type name="org:company">
           <parent>cm:folder</parent>
           <archive>false</archive>
          <properties>
            <property name="org:CompanyName">
                <title>CompanyName</title>
                <description>CompanyName</description>
                <type>d:text</type>
                <mandatory>true</mandatory>
                <multiple>false</multiple>
                <index enabled="true">
                <atomic>true</atomic>
                </index>
                <constraints/>
            </property>
            <property name="org:cmmLevel">
                 <title>cmmLevel</title>
                <description>cmmLevel</description>
                <type>d:text</type>
                <mandatory>true</mandatory>
               <multiple>false</multiple>
            </property>
          </properties>
          <associations/>
          <overrides/>
          <mandatory-aspects/>
     </type>-->
     <type name="org:employee">
           <parent>cm:folder</parent>
           <archive>false</archive>
          <properties>
            <property name="org:employeeCode">
                <title>employeeCode</title>
                <description>employeeCode</description>
                <type>d:text</type>
                <mandatory>true</mandatory>
                <multiple>false</multiple>
                <index enabled="true">
                <atomic>true</atomic>
                </index>
                <constraints/>
            </property>
            <property name="org:designation">
                 <title>designation</title>
                <description>designation</description>
                <type>d:text</type>
                <mandatory>true</mandatory>
               <multiple>true</multiple>
            </property>
          </properties>
          <associations>
          <!--<association name="org:employedBy">
               <target>
                  <class>org:company</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
          </association>-->
           </associations>
          <overrides/>
          <mandatory-aspects/>
     </type>
</types>
<aspects/>
</model>

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Hi Rudi,

For a detailed understanding on how to create new custom types you can take a look at:- http://wiki.alfresco.com/wiki/Step-By-Step:_Creating_A_Custom_Model

Also  find below an example of custom Content Model (OrganizationModel.xml).

Example creates a new type "employee". This new type derives from the existing cm:folder type in Content Services (<parent>cm:folder</parent>). In case you want the objects of your custom types to be visible in the content space UI you should derive them from either cm:folder or cm:cmcontent. Also, this type defines 2 properties namely employeeCode and designation both of them of text type.

To deploy this custom type

1.       Go to ContentServices UI @ http://<LCServer>:<Port>/contentspace    .

2.       Browse to Company Home -> Data Dictionary -> Models.

3.       Add Content.

4.       Make sure Modify all properties when page closes is checked.

5.       Select Activate Model.

ContentServicesImage.JPG

Once your model is activated you can see it from Workbench in the list of nodeTypes for operations like StoreContent (see image).

Here is the text of OrganizationModel.xml for your ease.

<model name="org:OrganizationModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
</imports>

<!--Introduction of new namespaces defined by this model -->
<namespaces>
     <namespace uri="http://www.adobe.com/lc/organization/1.0" prefix="org" />
</namespaces>

<data-types/>
<constraints/>

<types>
     <!--<type name="org:company">
           <parent>cm:folder</parent>
           <archive>false</archive>
          <properties>
            <property name="org:CompanyName">
                <title>CompanyName</title>
                <description>CompanyName</description>
                <type>d:text</type>
                <mandatory>true</mandatory>
                <multiple>false</multiple>
                <index enabled="true">
                <atomic>true</atomic>
                </index>
                <constraints/>
            </property>
            <property name="org:cmmLevel">
                 <title>cmmLevel</title>
                <description>cmmLevel</description>
                <type>d:text</type>
                <mandatory>true</mandatory>
               <multiple>false</multiple>
            </property>
          </properties>
          <associations/>
          <overrides/>
          <mandatory-aspects/>
     </type>-->
     <type name="org:employee">
           <parent>cm:folder</parent>
           <archive>false</archive>
          <properties>
            <property name="org:employeeCode">
                <title>employeeCode</title>
                <description>employeeCode</description>
                <type>d:text</type>
                <mandatory>true</mandatory>
                <multiple>false</multiple>
                <index enabled="true">
                <atomic>true</atomic>
                </index>
                <constraints/>
            </property>
            <property name="org:designation">
                 <title>designation</title>
                <description>designation</description>
                <type>d:text</type>
                <mandatory>true</mandatory>
               <multiple>true</multiple>
            </property>
          </properties>
          <associations>
          <!--<association name="org:employedBy">
               <target>
                  <class>org:company</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
          </association>-->
           </associations>
          <overrides/>
          <mandatory-aspects/>
     </type>
</types>
<aspects/>
</model>

Avatar

Former Community Member

Hi Raghu,

I tried the solution and it works fine... thank you very much

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----