Hi,
I am in the process of adding relationship functionality to my repository
connector and am running into an issue while trying to retrieve relationships
with my OpenCMIS client using the AtomPub binding. If I use the Webservice
binding, everything is working correctly. I was initially using the
0.1.0-incubating release of OpenCMIS, but have also repeated the tests using
the 0.3.0 release.
On the server side repository connector I have overridden the
getObjectRelationships method and the getObject method and have setup DEBUG
breakpoints at the start of each method so that I can inspect the data being
passed. I have two different client test cases, the first one invokes the
getObject method on the server and the second one should invoke the
getObjectRelationships method on the server. I have found that when I run Test
#1 with an AtomPub binding that the includeRelationships parameter is null when
it hits my breakpoint. If I switch to a Webservice binding, the
includeRelationships parameter is set correctly. If I run Test #2 with an
AtomPub binding the breakpoint on getObjectRelationships is never hit. If I
switch to a Webservice binding, the breakpoint is reached and the
relationshipDirection parameter is set correctly.
I am thinking that there may be an issue in the OpenCMIS client code with the
AtomPub binding when retrieving relationships. However I wanted to pass on
snippets of my client side tests in case the issue may be with my client side
setup. In the code snippets below, the CmisUtils reference is a simple class I
wrote that handles the boilerplate setup of a session.
/*
Client Side Test Case #1
Expect that the getObject method should be invoked and
the includeRelationships parameter should be set to SOURCE
*/
Session session = CmisUtils.getSession(restUrl, repository, username, password);
OperationContext context = session.getDefaultContext();
context.setIncludeRelationships(IncludeRelationships.SOURCE);
ObjectType peerRelation = session.getTypeDefinition("peer");
CmisObject baseDoc = session.getObject(new
ObjectIdImpl("0901e19680002873"),context);
ItemIterable<Relationship> relatedItems =
baseDoc.getRelationships(false,RelationshipDirection.SOURCE,
peerRelation,context);
/*
Client Test Case #2
Expect that the getObjectRelationships method should be invoked
and the relationshipDirection parameter should be set to SOURCE
*/
Session session = CmisUtils.getSession(restUrl, repository, username, password);
RelationshipService rService = session.getBinding().getRelationshipService();
ObjectList objList = rService.getObjectRelationships(repository,
"0901e19680002873", false, RelationshipDirection.SOURCE, "peer", null, false,
null, null, null);
Thanks,
Randy