1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.document.modules.cmis.service;
35
36 import fr.paris.lutece.portal.service.util.AppLogService;
37
38 import org.apache.chemistry.opencmis.commons.data.*;
39 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
40 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
41 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
42 import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
43 import org.apache.chemistry.opencmis.commons.server.CallContext;
44
45 import java.math.BigInteger;
46
47 import java.util.ArrayList;
48 import java.util.List;
49
50
51
52
53
54 public class DocumentCmisService extends AbstractCmisService
55 {
56 private static DocumentRepository _repository = new DocumentRepository( );
57 private CallContext _context;
58
59
60
61
62
63 public void setCallContext( CallContext context )
64 {
65 _context = context;
66 }
67
68
69
70
71 @Override
72 public List<RepositoryInfo> getRepositoryInfos( ExtensionsData extension )
73 {
74 AppLogService.info( "getRepositoryInfos" );
75
76 List<RepositoryInfo> list = new ArrayList<RepositoryInfo>( );
77 list.add( _repository.getInfos( ) );
78
79 return list;
80 }
81
82
83
84
85 @Override
86 public RepositoryInfo getRepositoryInfo( String repositoryId, ExtensionsData extension )
87 {
88 AppLogService.info( "getRepositoryInfo" );
89
90 return _repository.getInfos( );
91 }
92
93
94
95
96 @Override
97 public TypeDefinitionList getTypeChildren( String repositoryId, String typeId, Boolean includePropertyDefinitions,
98 BigInteger maxItems, BigInteger skipCount, ExtensionsData extension )
99 {
100 AppLogService.info( "getTypeChildren" );
101
102 return _repository.getTypesChildren( _context, typeId, true, maxItems, skipCount );
103 }
104
105
106
107
108 @Override
109 public TypeDefinition getTypeDefinition( String repositoryId, String typeId, ExtensionsData extension )
110 {
111 AppLogService.info( "getTypeDefinition" );
112
113 return _repository.getTypeDefinition( _context, typeId );
114 }
115
116
117
118
119 @Override
120 public ObjectInFolderList getChildren( String repositoryId, String folderId, String filter, String orderBy,
121 Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
122 Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension )
123 {
124 AppLogService.info( "getChildren" );
125
126 return _repository.getChildren( _context, folderId, filter, orderBy, includeAllowableActions,
127 includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension, this );
128 }
129
130
131
132
133 @Override
134 public List<ObjectParentData> getObjectParents( String repositoryId, String objectId, String filter,
135 Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
136 Boolean includeRelativePathSegment, ExtensionsData extension )
137 {
138 throw new UnsupportedOperationException( "Not supported yet." );
139 }
140
141
142
143
144 @Override
145 public ObjectData getObject( String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
146 IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
147 Boolean includeAcl, ExtensionsData extension )
148 {
149 AppLogService.info( "getObject : repositoryId=" + repositoryId + " objectId=" + objectId );
150
151 return _repository.getObject( _context, objectId, filter, includeAllowableActions, includeRelationships,
152 renditionFilter, includePolicyIds, includeAcl, extension, this );
153 }
154
155
156
157
158 @Override
159 public ObjectData getObjectByPath( String repositoryId, String path, String filter,
160 Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
161 Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension )
162 {
163 return _repository.getObjectByPath( _context, path, filter, includeAllowableActions, includeAcl, this );
164 }
165
166
167
168
169 @Override
170 public ContentStream getContentStream( String repositoryId, String objectId, String streamId, BigInteger offset,
171 BigInteger length, ExtensionsData extension )
172 {
173 return _repository.getContentStream( _context, objectId, offset, length );
174 }
175
176
177
178
179 @Override
180 public List<ObjectInFolderContainer> getDescendants( String repositoryId, String folderId, BigInteger depth,
181 String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
182 String renditionFilter, Boolean includePathSegment, ExtensionsData extension )
183 {
184 return _repository.getDescendants( _context, folderId, depth, filter, includeAllowableActions,
185 includePathSegment, this, false );
186 }
187 }