AnsweredAssumed Answered

Retrieve custom aspect using CMIS

Question asked by narayana.giri on Aug 13, 2014
Latest reply on Aug 20, 2014 by narayana.giri
Hi,

Defined aspect per link - http://wiki.alfresco.com/wiki/IngresTutorial_Alfresco_Web_Service_API_for_Java

Attaching the aspect(unique id) for each uploaded document through Java Script as below:
LastDocID = parseInt(space.properties["my:uId"]);

NewDocID = LastDocID + 1;

space.properties["my:uId"] = NewDocID;
space.save();

document.properties["my:uId"] = NewDocID;
document.save();

The above aspect(<aspect name="my:uAspect">  <property name="my:uId">) is defined in the customModel.xml and customModel.xml is included in the custom-model-context.xml.

The above Java Script is added to space as a rule to attach unique id for each upload.

Was able to upload attachment using RepositoryServiceSoapBindingStub and ContentServiceSoapBindingStub and also retrieve the aspect as soon as upload is completed as below:

Store spacesStore = new Store(Constants.WORKSPACE_STORE,"SpacesStore");
         
         String luceneQuery = "PATH:\"/app:company_home/cm:maindir/cm:subdir\" ";
         
         Query query = new Query(Constants.QUERY_LANG_LUCENE, luceneQuery);
         QueryResult queryResult = getRepositoryService().query(spacesStore,   query, false);
         ResultSet resultSet = queryResult.getResultSet();
         ResultSetRow[] results1 = resultSet.getRows();
         
         for (ResultSetRow resultRow : results1) {
            ResultSetRowNode nodeResult = resultRow.getNode();

            String[] aspects = nodeResult.getAspects();
            for(int i=0; i< aspects.length ;i++){
            }
            NamedValue[] aspect_properties1 = resultRow.getColumns();
            for (NamedValue str : aspect_properties1) {
               
               if( str.getName().contains("uId")){
                  aspectId =str.getValue();
                  
               }
            }
      }

Migrated upload code to CMIS(per link -http://forums.alfresco.com/forum/developer-discussions/web-scripts/trouble-creating-folder-web-script-11202008-1721#p77968).

Can you please suggest the equivalent code(to get the aspect)-QueryResult queryResult = getRepositoryService().query(spacesStore,query, false);

Is it possible to use same Lucene Query without using getRepositoryService as it looks for again authentication/login ticket or is it possible to use CMIS query to get the already defined custom aspect?

Any samples/links will be appreciated.


Thanks.

Outcomes