cancel
Showing results for 
Search instead for 
Did you mean: 

retrieve properties type

abichet
Champ in-the-making
Champ in-the-making
i add on a document this type :

<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 ?
10 REPLIES 10

gavinc
Champ in-the-making
Champ in-the-making
We don't have the ability to retrieve a subset of properties at the moment.

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.

abichet
Champ in-the-making
Champ in-the-making
thanks
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.

abichet
Champ in-the-making
Champ in-the-making
so when i declare my properties type i add an other prefix in the name:
<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:

gavinc
Champ in-the-making
Champ in-the-making
Hi,

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.

abichet
Champ in-the-making
Champ in-the-making
i dont understand very well what is the NamespacePrefixResolver

abichet
Champ in-the-making
Champ in-the-making
oki it  work
i add:

 FacesContext context = FacesContext.getCurrentInstance();
NamespaceService nameSpace = Repository.getServiceRegistry(context).getNamespaceService();
if(qname.toPrefixString(nameSpace).indexOf("custom:") == 0){}

thanks
regards

abichet
Champ in-the-making
Champ in-the-making
other question
what can i do to retrieve the properties of a type by using the data dictionary ?

abichet
Champ in-the-making
Champ in-the-making
i have look all the function of DictionaryService class but i not found …

davidc
Star Contributor
Star Contributor
You can try this…

TypeDefinition typeDef = dictionaryService.getType(typeQName);
Map<QName, PropertyDef> propertyDefs = typeDef.getProperties();
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.