cancel
Showing results for 
Search instead for 
Did you mean: 

Custom properties for Alfresco nodes

santosh
Champ in-the-making
Champ in-the-making
Hi,

Currently Alfresco stores properties like node-uuid, modifier,
creator, store-identifier, store-protocol for each node.

I need to associate custom properties with content nodes.
The properties are like comments, authors, status. etc.

Is there any way I can store this custom properties for the node?

In Alfresco 1.2 I had tried storing the properties by passing them
at creation time and it worked fine as follows.

NamedValue[] properties = new NamedValue[]{
    ….
    ….
    new NamedValue("AUTHORS", "sam,andy,peter"),
    new NamedValue("STATUS", "COMPLETED"),
    ….
    ….
    …. }

CMLCreate create = new CMLCreate("1", parentReference, Constants.TYPE_CONTENT, properties);
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});

UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);

   
This code worked fine in Alfresco 1.2.
Recently I tried Alfresco 1.4 and it doesn't work.
I get the NamedValue for the custom properties but the value is NULL.

I am not sure if this is purposely done in version 1.4?

Is there any way I can associate custom properties in Alfresco nodes.

Regards,

Santosh Prabhu
2 REPLIES 2

rwetherall
Confirmed Champ
Confirmed Champ
Hi,

Yes this behaviour is still present in 1.4, but the NamedValue object has changed a little.

Make sure your web service client jar has also been updated to 1.4.

Cheers,
Roy

santosh
Champ in-the-making
Champ in-the-making
Thanks for the prompt reply.

I tried this out using Alfresco 1.4 with proper clint jars but the problem still persisted.
Then I discovered that we need to define the custom properties in model.
I added the following aspects in defaultCustomModel.xml
which is registered at the boot time.

   <aspects>
      <aspect name="cm:auditable">
         <title>Auditable</title>
         <properties>
            <property name="cmSmiley Tongueath">
               <title>Path</title>
               <type>d:text</type>
            </property>
            <property name="cm:authors">
               <title>AUTHORS</title>
               <type>d:text</type>
            </property>
         </properties>
      </aspect>
    </aspects>


With this I was able to get the custom properties.
In Alfresco 1.2 I didn't have this properties in the server but somehow it worked fine at that time.

Now I have one question
when I add such properties then this would be applicable to the entire Alfresco server.
Is there any way I can confine the scope of the properties to a specific store?

Because user might be having many stores in his installation.
We dont want this custom properties to disturb other stores.

Thanks in advance.

Santosh Prabhu