cancel
Showing results for 
Search instead for 
Did you mean: 

Relationship

menza
Champ in-the-making
Champ in-the-making
Hello together,

I am trying to do some work using the CMIS interface. I stumbled upon the problem that programatically, I do not see any Relationships, even when the repository browser displays them:

Repository:
Relationship
Source Id   Target Id
workspace://SpacesStore/24c24588-39cb-48a6-b10f-3407590121df;1.0   workspace://SpacesStore/018675d0-7841-48af-9867-95f8471e9924;1.0
Properties
cmis:targetId   workspace://SpacesStore/018675d0-7841-48af-9867-95f8471e9924;1.0
cmis:objectTypeId   R:ws:primaryImage
cmis:lastModifiedBy   admin
cmis:sourceId   workspace://SpacesStore/24c24588-39cb-48a6-b10f-3407590121df;1.0
cmis:name   75714|workspace://SpacesStore/24c24588-39cb-48a6-b10f-3407590121df|workspace://SpacesStore/018675d0-7841-48af-9867-95f8471e9924|{http://www.alfresco.org/model/website/1.0}primaryImage
cmis:createdBy   admin
cmis:objectId   assoc:75714
cmis:creationDate   2010-05-01T00:00:00.000+02:00
cmis:changeToken   
cmis:baseTypeId   cmis:relationship
alfcmis:nodeRef   75714|workspace://SpacesStore/24c24588-39cb-48a6-b10f-3407590121df|workspace://SpacesStore/018675d0-7841-48af-9867-95f8471e9924|{http://www.alfresco.org/model/website/1.0}primaryImage
cmis:lastModificationDate   2010-05-01T00:00:00.000+02:00


I use the following java code:

                CmisObject doc = null;
      try {
          doc = ses.getObjectByPath("/Sites/wcmqs/documentLibrary/Alfresco Quick Start/Quick Start Editorial/root/news/global/article3.html",
                          context);
      }
      catch (Exception e) {
         System.err.println("not authorized");
      }
         
      System.out.println(doc.getAllowableActions().toString());
      
      // cast to document
      Document document = (Document) doc;
      
      System.out.println("————————————–");
      System.out.println("          Properties");
      System.out.println("————————————–");

      for (PropertyData<?> property : doc.getProperties()) {
          String queryName = property.getQueryName();
              Object value = property.getFirstValue();

              System.out.println(queryName + ": " + value);
      }
      
      System.out.println("————————————–");
      System.out.println("          Relationships");
      System.out.println("————————————–");

      for (Relationship rel : doc.getRelationships()) {
         System.out.println("Name: " + rel.getName());
         
         for (PropertyData<?> property : rel.getProperties()) {
             String queryName = property.getQueryName();
                 Object value = property.getFirstValue();

                 System.out.println(queryName + ": " + value);
         }

             
      }
      System.out.println("————————————–");


getting this result:

————————————–
          Properties
————————————–
cmis:contentStreamLength: 3247
cmis:objectTypeId: D:ws:article
cmis:versionSeriesCheckedOutBy: null
cmis:versionSeriesCheckedOutId: null
cmis:versionSeriesId: workspace://SpacesStore/24c24588-39cb-48a6-b10f-3407590121df
cmis:isLatestVersion: true
cmis:versionLabel: 0.0
cmis:isVersionSeriesCheckedOut: false
cmis:lastModifiedBy: admin
cmis:createdBy: admin
alfcmis:nodeRef: null
cmis:isLatestMajorVersion: false
cmis:contentStreamId: store://2012/11/6/14/44/bae919c5-6bf7-4f04-83e9-27fcca541943.bin
cmis:name: article3.html
cmis:contentStreamMimeType: text/html
cmis:creationDate: java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT+02:00",offset=7200000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=6,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=22,DAY_OF_YEAR=1,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=15,MINUTE=3,SECOND=42,MILLISECOND=222,ZONE_OFFSET=7200000,DST_OFFSET=0]
cmis:changeToken: null
cmis:checkinComment: null
cmis:objectId: workspace://SpacesStore/24c24588-39cb-48a6-b10f-3407590121df
cmis:isMajorVersion: false
cmis:isImmutable: false
cmis:baseTypeId: cmis:document
cmis:lastModificationDate: java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT+01:00",offset=3600000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2010,MONTH=10,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=10,DAY_OF_YEAR=1,DAY_OF_WEEK=5,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=8,MINUTE=46,SECOND=46,MILLISECOND=800,ZONE_OFFSET=3600000,DST_OFFSET=0]
cmis:contentStreamFileName: article3.html
————————————–
          Relationships
————————————–
————————————–


So from the ID you can see it is the same object but the relationships show up empty. What is wrong with my code?

Alex
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
Have you called setIncludeRelationships on your operation context?

Jeff

menza
Champ in-the-making
Champ in-the-making
Ah, that fixed it. I am still very new to CMIS, so sorry for asking dumb questions.