cancel
Showing results for 
Search instead for 
Did you mean: 

Metadata Creation

thaneshk
Champ in-the-making
Champ in-the-making
Hi,

We have created our own custom model for Alfresco and were wondering whether the Alfresco Engineers or anyone else for that matter can give us input on the implications if any on the scenario i am going to describe below or even whether it is feasible.

Suppose we create a jsp, which is able to write to the customModel.xml, customModel-context.xml. This is if say an administrator would want to add an extra property to the current model. What are the implications of this in the future? I know that in a production environment this would be hard to maintain since the server would need to be stopped andstarted again so that the datadictonary can be booted. Any other implciation? Anyone thinks we can pull it off?

Also was wondering what are the implications of storing all property values in one node -say for example we have a property node called "Everything" of data type String, and we store values in it separated by a delimeter such as ",". This might solve the problem posed in the previous paragraph. What are the implications of this in the long run? Maybe i should ask a db but hey let me put it across?

Just thoughts , opinions and feedback appreciated

Cheers.
7 REPLIES 7

davidc
Star Contributor
Star Contributor
We do have the beginnings of support for dynamically registering content models.  There's a content type called cm:dictionaryModel derived from cm:content.  Creating a node of type cm:dictionaryModel (and placing the content model xml in the content property) will register the model automatically with the data dictionary when it is saved or updated.  There's a cm:modelActive property too allowing the auto-registration to be switched.

There's no support for ensuring that model changes are compatible or break existing data, so you'd need to control that yourself.

thaneshk
Champ in-the-making
Champ in-the-making
David,

When i set the modelActive property to true in contentModel.xml seems like it fails to create a piece of content through Alfresco UI. Now do i need to extend contentModel.xml as well because i already have an example-content-Model.xml which describes my own custom model { an extension of dataDictionary type }.

So my question is

1.) Why is that property not working?
2.) Or do i need to extend contentModel.xml { the values of dataDictionary type} into my custom-model.xml and also include the properties of my own type?

Cheers! Appreciate the feedback mate.

thaneshk
Champ in-the-making
Champ in-the-making
David,

could you elobarate on this as well

(and placing the content model xml in the content property) .

Cheers

thaneshk
Champ in-the-making
Champ in-the-making
Even better if you can elobarate on this statement.. mayeb this is where i am faltering

"Creating a node of type cm:dictionaryModel (and placing the content model xml in the content property) will register the model automatically with the data dictionary when it is saved or updated."

Currently i havent changed the contentModel.xml and bought the modelActive attribute back to "false" since "true" was not working.

My custom-model.xml is like this



<?xml version="1.0" encoding="UTF-8"?>

<!– Custom Model –>

<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

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

   <!– Optional meta-data about the model –>  
   <description>XP Model</description>
   <author></author>
   <version>1.0</version>

   <imports>
        <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="xp.dam.model" prefix="xp"/>
   </namespaces>

   <types>
         <!– Definition of new Content Type: Image Type –>
         <type name="xp:asset">
            <title>Asset</title>
            <parent>cm:dictionaryModel</parent>
            <properties>
               <property name="xp:assettype">
                  <type>d:text</type>
               </property>
               <property name="xp:thumbnail">
                  <type>d:text</type>
               </property>
            <property name="xp:delete">
                  <type>d:text</type>
               </property>
                <property name="xp:testing">
                  <type>d:text</type>
               </property>
            </properties>
         </type>
    </types>
   
      <aspects>
          <!– Definition of new Content Aspect: Image Classification –>
          <aspect name="xp:imageClassification">
             <title>Image Classfication</title>
             <properties>
                <property name="xp:width">
                   <type>d:int</type>
                </property>
                <property name="xp:height">
                   <type>d:int</type>
                </property>
                <property name="xp:resolution">
                   <type>d:int</type>
                </property>
             </properties>
          </aspect>
   </aspects>
     
</model>


Cheers Mate.

jamen
Confirmed Champ
Confirmed Champ
Hi,

I'm currently in the process of creating a new content model with new aspects and data types.  In our specification we have the need to use a List object of sorts.  I was just wondering whether anyone could help me with creating a custom data type for use with a new content type.

I have checked the wiki and it doesn't go beyond using existing data types (eg. String, date, boolean, etc).  There is a type based on 'd:any'/java.lang.Object.  However I am not sure whether I should use this to implement a 'List' type based on a java class that implements the List or Enumeration interface.

Alternatively would I extend the existing model (dictionaryModel) and create a new type based on a List?  With this in mind, I assume I would have a model file (xml) like the one below?  The main part I need verification on is actually the <data-types> section I added below.  I haven't seen any examples of people customising their data types in a model file before.  I have only seen custom models much like what is in the wiki already.

<?xml version="1.0" encoding="UTF-8"?>

<!– Definition of Model –>

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

   <description>Lateral Minds Document Model</description>
   <author>Jamen</author>
   <version>1.0</version>

   <!– Imports are required to allow references to definitions in other models –>  
   <imports>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <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>

   <namespaces>
      <namespace uri="example.samplemodel" prefix="sm"/>
   </namespaces>
  
   <data-types>
        DATA TYPES go here
   </data-types>

   <types>
              SOME TYPES GO HERE
   </types>
  
   <aspects>
            SOME ASPECTS GO HERE
   </aspects>
</model>


Thanks in advanced

Jamen

thaneshk
Champ in-the-making
Champ in-the-making
Sorry MAte, I havent had the need to create any new data types thus far. It would be better if you posted your request on a new page. This page I have been checking for some time and not sure whether anyone else has taken a look at it.

Other than that your script seems fine. BTW when you extend from dictionaryModel, are you trying to implement dynamic properties. IF so, any ideas on how to go about that

rdanner
Champ in-the-making
Champ in-the-making
We do have the beginnings of support for dynamically registering content models.  There's a content type called cm:dictionaryModel derived from cm:content.  Creating a node of type cm:dictionaryModel (and placing the content model xml in the content property) will register the model automatically with the data dictionary when it is saved or updated.  There's a cm:modelActive property too allowing the auto-registration to be switched.

There's no support for ensuring that model changes are compatible or break existing data, so you'd need to control that yourself.


Is this what you hope to use as a kind of solution to custom properties (dynamic properties)?

I guess you could use that and a custom content type editor to give people an UI to create/update models.