retrieve properties type

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2006 06:35 AM
<type name="custom:advancedFile"> <title>Advanced File</title> <parent>cm:content</parent> <properties> <property name="custom:client"> <type>d:text</type> </property> <property name="custom:techno"> <type>d:text</type> </property> <property name="custom:typeProjet"> <type>d:text</type> </property> </properties></type>
in edit document mode i set this properties to value.
this code in java bean
Map<QName, Serializable> properties = this.nodeService.getProperties(createdNode);
retrieve all properties of the data.but i want to retrieve only the properties defined in the type custom:advancedFile
what can i do ?
- Labels:
-
Archive

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2006 04:40 AM
However, you can get individual properties with:
Serializable prop = this.nodeService(nodeRef, QName.createQName("your-uri", "prop-name");
Alternatively you could use the data dictionary to get the properties of the type and retrieve them using the node service (useful if you don't know what the properties may be).
Hope that helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2006 05:06 AM
i have a other question
i look the classe QName.In this classe there is a function called toPrefixString() .
im my code i retrieve a property in a QName but this function toPrefixString() retrieve only the name but not the prefix .
i dont understand why.
i would like to use this function to do the difference between all the properties and only the custom type property but it don't work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2006 05:11 AM
<type name="custom:advancedFolder"> <title>Advanced Folder</title> <parent>cm:folder</parent> <properties> <property name="custom:customClient"> <type>d:text</type> </property> <property name="custom:customTechno"> <type>d:text</type> </property> <property name="custom:customTypeProjet"> <type>d:text</type> </property> </properties> </type>
and to do the diffference in the code
if(qname.getLocalName().indexOf("custom") == 0)
but it's not very lovely
:wink:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2006 08:18 AM
toPrefixString() should give you back the short form of your URI plus the local name i.e. "custom:client" this is as opposed to the full form using the URL such as "http://your.custom.uri:client".
getLocalName() returns the part after the : so you should get back "client".
If the toPrefixString() method is not returning the first part it may be because you don't have a namespace prefix resolver. Try using the following:
toPrefixString(NamespacePrefixResolver prefixResolver)
You can pass in an instance of the namespace service as the prefix resolver.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2006 08:29 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2006 10:02 AM
i add:
FacesContext context = FacesContext.getCurrentInstance();NamespaceService nameSpace = Repository.getServiceRegistry(context).getNamespaceService();if(qname.toPrefixString(nameSpace).indexOf("custom:") == 0){}
thanks
regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2006 07:28 AM
what can i do to retrieve the properties of a type by using the data dictionary ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2006 10:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2006 11:50 AM
TypeDefinition typeDef = dictionaryService.getType(typeQName);Map<QName, PropertyDef> propertyDefs = typeDef.getProperties();
