3
votes

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.

1
Can any one please reply, whether it is possible to get aspect properties using CMIS or not? - Deepak Talape
did you see this two posts Link1 And Link 2 - Yagami Light
@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
@YagamiLight i hope you understood my question . please reply if you need more explanation. - Deepak Talape
@YagamiLight I also used doc.getProperty("cm:latitude").getValueAsString()); But its giving null pointer exception - Deepak Talape

1 Answers

2
votes

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()
  //…
}