1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
20
21 import java.math.BigInteger;
22 import java.util.Map;
23
24 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
25 import org.apache.chemistry.opencmis.client.bindings.spi.http.Response;
26 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
27 import org.apache.chemistry.opencmis.commons.data.ObjectList;
28 import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
29 import org.apache.chemistry.opencmis.commons.impl.Constants;
30 import org.apache.chemistry.opencmis.commons.impl.JSONConverter;
31 import org.apache.chemistry.opencmis.commons.impl.TypeCache;
32 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
33 import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
34
35
36
37
38 public class RelationshipServiceImpl extends AbstractBrowserBindingService implements RelationshipService {
39
40
41
42
43 public RelationshipServiceImpl(BindingSession session) {
44 setSession(session);
45 }
46
47 @Override
48 public ObjectList getObjectRelationships(String repositoryId, String objectId, Boolean includeSubRelationshipTypes,
49 RelationshipDirection relationshipDirection, String typeId, String filter, Boolean includeAllowableActions,
50 BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
51
52 UrlBuilder url = getObjectUrl(repositoryId, objectId, Constants.SELECTOR_RELATIONSHIPS);
53 url.addParameter(Constants.PARAM_SUB_RELATIONSHIP_TYPES, includeSubRelationshipTypes);
54 url.addParameter(Constants.PARAM_RELATIONSHIP_DIRECTION, relationshipDirection);
55 url.addParameter(Constants.PARAM_TYPE_ID, typeId);
56 url.addParameter(Constants.PARAM_FILTER, filter);
57 url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
58 url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
59 url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
60 url.addParameter(Constants.PARAM_SUCCINCT, getSuccinctParameter());
61 url.addParameter(Constants.PARAM_DATETIME_FORMAT, getDateTimeFormatParameter());
62
63
64 Response resp = read(url);
65 Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
66
67 TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this);
68
69 return JSONConverter.convertObjectList(json, typeCache, false);
70 }
71 }