3

I am doing content migration activity. in that i am able to migrate actual content from one repository to other. but i also want to migrate meta-date for same.

I have some aspect's associated with my content and every aspect is having some properties. So i want to get those aspect specific properties from old repository. but i am not finding any useful code to get aspect properties. I am able to add aspect and properties in new repository.

    AlfrescoDocument alfDoc = (AlfrescoDocument) dc;

    alfDoc.addAspect("P:test:publishDate");
    if (alfDoc.hasAspect("P:test:publishDate")) {
        Map<String, GregorianCalendar> properties1 = new HashMap<String, GregorianCalendar>();
        properties1.put("test:pubDate", dc.getCreationDate());
        alfDoc.updateProperties(properties1);
    }

But in same way i want to fetch aspect specific properties from old repository. Can anyone please help me.

Thanks in Advance.

Deepak Talape
  • 997
  • 1
  • 9
  • 35
  • Can any one please reply, whether it is possible to get aspect properties using CMIS or not? – Deepak Talape Apr 21 '17 at 08:45
  • did you see this two posts [Link1](http://docs.alfresco.com/5.1/pra/1/concepts/opencmis-ext-creating-aspects.html) And [Link 2](https://gist.github.com/jpotts/7242070) – Yagami Light Apr 21 '17 at 09:26
  • @YagamiLight yes, i saw these posts. but in my case i am able to add new aspect in the new repository. now i just want to fetch all aspect properties from old repository. i already have that document object. but using that i am unable to fetch its type and aspect properties. – Deepak Talape Apr 21 '17 at 09:37
  • @YagamiLight i hope you understood my question . please reply if you need more explanation. – Deepak Talape Apr 21 '17 at 09:38
  • @YagamiLight I also used doc.getProperty("cm:latitude").getValueAsString()); But its giving null pointer exception – Deepak Talape Apr 21 '17 at 09:54

1 Answers1

2

There is an answer here, this might relate to your question?

https://community.alfresco.com/thread/201527-not-able-to-read-aspect-properties-using-cmis

Basically, make sure to use the proper CMIS 1.1 service URL http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser Then something like this:

ItemIterable<QueryResult> queryResults = cmisSession.query(cmisQuery, false);
for (QueryResult queryResult:queryResults) {
  PropertyData<?> abcProperty = queryResult.getPropertyById("abc");
  String abcValue = abcProperty.getFirstValue().toString()
  //…
}
prignony
  • 121
  • 6