cancel
Showing results for 
Search instead for 
Did you mean: 

Problem getting properties list

robby
Champ in-the-making
Champ in-the-making
Hi all,
i have many types of content..
In my web script I have a html select with the list of all types.
I want to display the form where the user insert the information associated to a particular selected Types.
Es: Invoice
<type name="cm:invoice">
         <title>Invoice</title>
        <parent>cm:content</parent>
        <properties>
            <property name="ecm:invoiceType">
               <title>Type</title>
                  <type>d:text</type>
            </property>
        <mandatory-aspects>
            <aspect>cm:myAspect</aspect>
        </mandatory-aspects>
      </type>
With a ajax call i get the property:
TypeDefinition typeDef = dictionaryService.getType(QName.createQName(contentType));
Map<QName, PropertyDefinition> propertyDefs = typeDef.getProperties();

In this map aren't present all properties… eg. The property of cm:myAspect….

How i get All property of a particular content type?


Best regards

Robert.
5 REPLIES 5

gavinc
Champ in-the-making
Champ in-the-making
That's correct, you will only get the properties for the type, by their nature aspects are dynamic so the type will never know what aspects, and therefore what properties, are going to be present.

To get all properties for a node you can use the getAnonymousType() method on the DictionaryService. Given a type and a list of aspects the definitions for all properties will be returned.

robby
Champ in-the-making
Champ in-the-making
(Maybe) I've found the solution…
To get all list of aspect:
-    List<AspectDefinition> listAspect = typeDef.getDefaultAspects();
Now i have all list of applicable aspetcs.
This is the correct mode???

Robert.

gavinc
Champ in-the-making
Champ in-the-making
Not quite, that will give you the list of default aspects defined for that type in the model.

To get the list of aspects applied to a node use nodeService.getAspects(nodeRef);

robby
Champ in-the-making
Champ in-the-making
The problem of your solution is quite simple…
I don't have the nodeRef because the node dosn't exists…
I want the list of applicable aspect of a particular content type.
In my template I have a select with the list of all content type defined in the system.
The user select a particular type, after the page are dispayied in base at this choice.
Well at this point is possible get the list of aspects with the contentType??
Smth like:
nodeService.getAspects(ContentType);

Best regards

Robert

gavinc
Champ in-the-making
Champ in-the-making
OK, apologies I misunderstood what you were asking.

In that case you were right with typeDef.getDefaultAspects(), that will give you all the aspects that will be there when a node is created. As for other aspects, you'll never know, any aspect can be applied at runtime.