AnsweredAssumed Answered

Get properties from custom model

Question asked by luisg on Jul 24, 2009
Latest reply on Jul 28, 2009 by luisg
Hi there.

I created a custom model in Alfresco. With this model I can create Alfresco documents with specific properties:

 <types>
                <!– Enterprise-wide generic document type –>
                <type name="sp:myDocument">
                        <title>My Document</title>
                        <parent>cm:content</parent>
                        <properties>
                                <property name="sp:identifier">
                                        <title>ID</title>
                                        <type>d:text</type>
                                        <mandatory>true</mandatory>
                                </property>
                                <property name="sp:CreatedDate">
                                        <title>Creation Date</title>
                                        <type>d:text</type>
                                        <mandatory>true</mandatory>
                                </property>
                                <property name="sp:DocumentType">
                                        <title>Document type</title>
                                        <type>d:text</type>
                                        <mandatory>true</mandatory>
                                </property>
                        </properties>
                </type>
        </types>

This is working fine. I can create this type of documents through a Web Services.
But my problem is, I can't access to the 'My Document' properties. I do a lucene search(using my type, and the ID property), I get the result, but I can see the custom properties…
Here is my code:

try{
   RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();

   Query query = new Query(Constants.QUERY_LANG_LUCENE,
         "TYPE:\"{http://www.sigpoa.com/model/content/1.0}myDocument\" AND @sp\\:identifier:\""+idDocument+"\"");
   
   QueryResult queryResult = repositoryService.query(STORE, query, false);
   ResultSet result = queryResult.getResultSet();
   ResultSetRow[] rows = result.getRows();

if I do a search for a normal Alfresco document, I access the property X like this: row[0].column[X Position].getValue(); But in my custom model, I only have 1 column.

Can Any of you tell me what I'm doing wrong?

Thanks in advance

Outcomes