This project has retired. For details please refer to its
Attic page.
NavigationServiceImpl xref
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.List;
23 import java.util.Map;
24
25 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
26 import org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils;
27 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
28 import org.apache.chemistry.opencmis.commons.data.ObjectData;
29 import org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer;
30 import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
31 import org.apache.chemistry.opencmis.commons.data.ObjectList;
32 import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
33 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
34 import org.apache.chemistry.opencmis.commons.impl.Constants;
35 import org.apache.chemistry.opencmis.commons.impl.JSONConverter;
36 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
37 import org.apache.chemistry.opencmis.commons.spi.NavigationService;
38
39
40
41
42 public class NavigationServiceImpl extends AbstractBrowserBindingService implements NavigationService {
43
44
45
46
47 public NavigationServiceImpl(BindingSession session) {
48 setSession(session);
49 }
50
51 public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
52 Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
53 Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
54
55 UrlBuilder url = getObjectUrl(repositoryId, folderId, Constants.SELECTOR_CHILDREN);
56 url.addParameter(Constants.PARAM_FILTER, filter);
57 url.addParameter(Constants.PARAM_ORDER_BY, orderBy);
58 url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
59 url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
60 url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
61 url.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
62 url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
63 url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
64
65
66 HttpUtils.Response resp = read(url);
67 Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
68
69 return JSONConverter.convertObjectInFolderList(json);
70 }
71
72 public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId, BigInteger depth,
73 String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
74 String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
75
76 UrlBuilder url = getObjectUrl(repositoryId, folderId, Constants.SELECTOR_DESCENDANTS);
77 url.addParameter(Constants.PARAM_DEPTH, depth);
78 url.addParameter(Constants.PARAM_FILTER, filter);
79 url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
80 url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
81 url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
82 url.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
83
84
85 HttpUtils.Response resp = read(url);
86 List<Object> json = parseArray(resp.getStream(), resp.getCharset());
87
88 return JSONConverter.convertDescendants(json);
89 }
90
91 public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId, BigInteger depth,
92 String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
93 String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
94
95 UrlBuilder url = getObjectUrl(repositoryId, folderId, Constants.SELECTOR_FOLDER_TREE);
96 url.addParameter(Constants.PARAM_DEPTH, depth);
97 url.addParameter(Constants.PARAM_FILTER, filter);
98 url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
99 url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
100 url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
101 url.addParameter(Constants.PARAM_PATH_SEGMENT, includePathSegment);
102
103
104 HttpUtils.Response resp = read(url);
105 List<Object> json = parseArray(resp.getStream(), resp.getCharset());
106
107 return JSONConverter.convertDescendants(json);
108 }
109
110 public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
111 Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
112 Boolean includeRelativePathSegment, ExtensionsData extension) {
113
114 UrlBuilder url = getObjectUrl(repositoryId, objectId, Constants.SELECTOR_PARENTS);
115 url.addParameter(Constants.PARAM_FILTER, filter);
116 url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
117 url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
118 url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
119 url.addParameter(Constants.PARAM_RELATIVE_PATH_SEGMENT, includeRelativePathSegment);
120
121
122 HttpUtils.Response resp = read(url);
123 List<Object> json = parseArray(resp.getStream(), resp.getCharset());
124
125 return JSONConverter.convertObjectParents(json);
126 }
127
128 public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension) {
129
130 UrlBuilder url = getObjectUrl(repositoryId, folderId, Constants.SELECTOR_PARENT);
131 url.addParameter(Constants.PARAM_FILTER, filter);
132
133
134 HttpUtils.Response resp = read(url);
135 Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
136
137 return JSONConverter.convertObject(json);
138 }
139
140 public ObjectList getCheckedOutDocs(String repositoryId, String folderId, String filter, String orderBy,
141 Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
142 BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
143
144 UrlBuilder url = (folderId != null ? getObjectUrl(repositoryId, folderId, Constants.SELECTOR_CHECKEDOUT)
145 : getRepositoryUrl(repositoryId, Constants.SELECTOR_CHECKEDOUT));
146 url.addParameter(Constants.PARAM_FILTER, filter);
147 url.addParameter(Constants.PARAM_ORDER_BY, orderBy);
148 url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
149 url.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
150 url.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
151 url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
152 url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
153
154
155 HttpUtils.Response resp = read(url);
156 Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
157
158 return JSONConverter.convertObjectList(json, false);
159 }
160 }