AnsweredAssumed Answered

set new aspect to a node

Question asked by rulo on Nov 2, 2007
Hi…
I created a new content model…here are some lines of it:

[myModel.xml]


<!–  Definition of new Model   –>
<model name="wd:mymodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

<!–  This is the namespace uri   –>
<namespaces>
  <namespace uri="extension.mymodel" prefix="wd" />
</namespaces>

<aspects>
  <aspect name="wd:methodology">
   <title>Methodology</title>
   <properties>
     <property name="wd:type">
      <type>d:text</type>
      <mandatory>true</mandatory>
    </property>
   </properties>
  </aspect>

Then, using Alfresco Web Services Client, I want to set an aspect to an existing node. I got this:

[Java Code]

String uuid="6df5dc39-7e8d-11dc-a5ed-6378f37154ce";
Reference reference = new Reference(STORE, uuid, null);
// Setting a property
NamedValue[] specificationProps = new NamedValue[1];
// Is it possible to not set at all and still add aspect?
specificationProps[0] =
Utils.createNamedValue(MYPROPERTY,"DDD");           //<—-
CMLAddAspect addAspect = new
CMLAddAspect("{extension.mymodel}methodology",  //<—-
specificationProps,new Predicate(new
Reference[]{reference}, null, null), "1");
// Construct CML Block
CML aspect_cml = new CML();
aspect_cml.setAddAspect(new CMLAddAspect[] {addAspect});
repositoryService.update(aspect_cml);

So my questions are:
1. What goes in MYPROPERTY?, i know it goes the propertie defined in the aspect of my newmodel.xml, but what's the format ?
2. {extension.mymodel}methodology, is this the correct format to reference the aspect i created.
3. Is this the corretc way to add an aspect to a node?

I'll appreciate your help.

Outcomes