cmis_server 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +51 -0
- data/app/assets/javascripts/cmis_server/application.js +13 -0
- data/app/assets/stylesheets/cmis_server/application.css +15 -0
- data/app/controllers/cmis_server/application_controller.rb +19 -0
- data/app/controllers/cmis_server/atom_pub/base_controller.rb +23 -0
- data/app/controllers/cmis_server/atom_pub/bulk_controller.rb +302 -0
- data/app/controllers/cmis_server/atom_pub/content_controller.rb +178 -0
- data/app/controllers/cmis_server/atom_pub/entries_controller.rb +41 -0
- data/app/controllers/cmis_server/atom_pub/folder_collection_controller.rb +70 -0
- data/app/controllers/cmis_server/atom_pub/query_controller.rb +138 -0
- data/app/controllers/cmis_server/atom_pub/repository_controller.rb +75 -0
- data/app/controllers/cmis_server/atom_pub/secondary_types_controller.rb +149 -0
- data/app/controllers/cmis_server/atom_pub/service_documents_controller.rb +34 -0
- data/app/controllers/cmis_server/atom_pub/types_controller.rb +229 -0
- data/app/controllers/cmis_server/atom_pub/uri_templates_controller.rb +58 -0
- data/app/controllers/concerns/cmis_server/atom_pub/repository_scopable.rb +18 -0
- data/app/helpers/cmis_server/application_helper.rb +31 -0
- data/app/models/cmis_server/application_record.rb +5 -0
- data/app/services/cmis_server/bulk_update_service.rb +69 -0
- data/app/services/cmis_server/content_stream_service.rb +75 -0
- data/app/services/cmis_server/discovery_service.rb +31 -0
- data/app/services/cmis_server/navigation_service.rb +43 -0
- data/app/services/cmis_server/object_service.rb +176 -0
- data/app/services/cmis_server/repository_service.rb +40 -0
- data/app/services/cmis_server/secondary_type_service.rb +120 -0
- data/app/services/cmis_server/type_management_service.rb +117 -0
- data/app/views/cmis_server/atom_pub/bulk_update_feed.atom.builder +47 -0
- data/app/views/cmis_server/atom_pub/entries/_cmis_document_links.atom_entry.builder +0 -0
- data/app/views/cmis_server/atom_pub/entries/_cmis_folder_links.atom_entry.builder +3 -0
- data/app/views/cmis_server/atom_pub/entries/_object_entry.atom_entry.builder +64 -0
- data/app/views/cmis_server/atom_pub/entries/_property.atom_entry.builder +8 -0
- data/app/views/cmis_server/atom_pub/entries/object_entry.atom_entry.builder +1 -0
- data/app/views/cmis_server/atom_pub/entries/type_entry.atom_entry.builder +59 -0
- data/app/views/cmis_server/atom_pub/feeds/_feed_entry.atom_feed.builder +1 -0
- data/app/views/cmis_server/atom_pub/feeds/feed.atom_feed.builder +30 -0
- data/app/views/cmis_server/atom_pub/service_documents/_uri_template.atom_service.builder +5 -0
- data/app/views/cmis_server/atom_pub/service_documents/_workspace.atom_service.builder +89 -0
- data/app/views/cmis_server/atom_pub/service_documents/service_document.atom_service.builder +1 -0
- data/app/views/cmis_server/atom_pub/shared/_collection.xml.builder +7 -0
- data/app/views/cmis_server/atom_pub/shared/atom_entry_layout.atom_entry.builder +0 -0
- data/app/views/cmis_server/atom_pub/type_entry.atom.builder +69 -0
- data/app/views/cmis_server/atom_pub/types_feed.atom.builder +91 -0
- data/app/views/layouts/cmis_server/application.atom_entry.builder +2 -0
- data/app/views/layouts/cmis_server/application.atom_feed.builder +3 -0
- data/app/views/layouts/cmis_server/application.atom_service.builder +10 -0
- data/app/views/layouts/cmis_server/application.html.erb +14 -0
- data/config/routes.rb +49 -0
- data/lib/cmis_server/atom_pub/entry_parser.rb +72 -0
- data/lib/cmis_server/base_objects/base_type.rb +128 -0
- data/lib/cmis_server/base_objects/document.rb +68 -0
- data/lib/cmis_server/base_objects/folder.rb +104 -0
- data/lib/cmis_server/base_objects/item.rb +25 -0
- data/lib/cmis_server/base_types.rb +123 -0
- data/lib/cmis_server/cmis_object.rb +190 -0
- data/lib/cmis_server/configuration.rb +43 -0
- data/lib/cmis_server/constants.rb +8 -0
- data/lib/cmis_server/content_stream.rb +52 -0
- data/lib/cmis_server/context.rb +11 -0
- data/lib/cmis_server/document_object.rb +12 -0
- data/lib/cmis_server/document_type.rb +67 -0
- data/lib/cmis_server/engine.rb +60 -0
- data/lib/cmis_server/exceptions.rb +185 -0
- data/lib/cmis_server/folder_object.rb +18 -0
- data/lib/cmis_server/folder_type.rb +34 -0
- data/lib/cmis_server/id.rb +18 -0
- data/lib/cmis_server/item_adapter.rb +26 -0
- data/lib/cmis_server/item_object.rb +15 -0
- data/lib/cmis_server/item_type.rb +7 -0
- data/lib/cmis_server/object_adapter.rb +79 -0
- data/lib/cmis_server/property.rb +29 -0
- data/lib/cmis_server/property_definition.rb +118 -0
- data/lib/cmis_server/query/parser.output +2250 -0
- data/lib/cmis_server/query/parser.racc +222 -0
- data/lib/cmis_server/query/parser.racc.rb +1039 -0
- data/lib/cmis_server/query/parser.rex +114 -0
- data/lib/cmis_server/query/parser.rex.rb +238 -0
- data/lib/cmis_server/query/statement.rb +395 -0
- data/lib/cmis_server/query.rb +2 -0
- data/lib/cmis_server/renderable_collection.rb +45 -0
- data/lib/cmis_server/renderable_object.rb +49 -0
- data/lib/cmis_server/repository.rb +91 -0
- data/lib/cmis_server/secondary_type.rb +11 -0
- data/lib/cmis_server/type.rb +62 -0
- data/lib/cmis_server/type_registry.rb +115 -0
- data/lib/cmis_server/version.rb +4 -0
- data/lib/cmis_server.rb +22 -0
- data/lib/tasks/cmis_server_tasks.rake +4 -0
- data/test/cmis_server_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/to_time_preserves_timezone.rb +10 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/services/bulk_update_service_test.rb +121 -0
- data/test/services/content_stream_service_test.rb +176 -0
- data/test/services/secondary_type_service_test.rb +174 -0
- data/test/services/type_management_service_test.rb +146 -0
- data/test/test_helper.rb +16 -0
- metadata +326 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
module CmisServer
|
|
2
|
+
|
|
3
|
+
module Query
|
|
4
|
+
|
|
5
|
+
module Statement
|
|
6
|
+
|
|
7
|
+
class Node
|
|
8
|
+
|
|
9
|
+
# def accept(visitor)
|
|
10
|
+
# klass = self.class.ancestors.find do |ancestor|
|
|
11
|
+
# visitor.respond_to?("visit_#{demodulize(ancestor.name)}")
|
|
12
|
+
# end
|
|
13
|
+
#
|
|
14
|
+
# if klass
|
|
15
|
+
# visitor.__send__("visit_#{demodulize(klass.name)}", self)
|
|
16
|
+
# else
|
|
17
|
+
# raise "No visitor for #{self.class.name}"
|
|
18
|
+
# end
|
|
19
|
+
# end
|
|
20
|
+
#
|
|
21
|
+
# def to_sql
|
|
22
|
+
# SQLVisitor.new.visit(self)
|
|
23
|
+
# end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def demodulize(str)
|
|
28
|
+
str.split('::')[-1]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class CmisQuery < Node
|
|
34
|
+
def initialize(query_expression, order_by)
|
|
35
|
+
@query_expression = query_expression
|
|
36
|
+
@order_by = order_by
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
attr_reader :query_expression
|
|
40
|
+
attr_reader :order_by
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class Select < Node
|
|
44
|
+
def initialize(select_list,from,where)
|
|
45
|
+
@select_list=select_list
|
|
46
|
+
@from=from
|
|
47
|
+
@where=where
|
|
48
|
+
end
|
|
49
|
+
attr_reader :select_list, :from, :where
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class All < Node
|
|
53
|
+
|
|
54
|
+
def initialize(table=nil)
|
|
55
|
+
@column=table
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
attr_reader :table
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class SelectList < Node
|
|
62
|
+
|
|
63
|
+
def initialize(columns)
|
|
64
|
+
@columns = Array(columns)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
attr_reader :columns
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
class As < Node
|
|
72
|
+
|
|
73
|
+
def initialize(value, column)
|
|
74
|
+
@value = value
|
|
75
|
+
@column = column
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
attr_reader :value
|
|
79
|
+
attr_reader :column
|
|
80
|
+
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
class QualifiedColumn < Node
|
|
84
|
+
|
|
85
|
+
def initialize(column, table, secondary_table=nil)
|
|
86
|
+
@table = table
|
|
87
|
+
@column = column
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
attr_reader :table
|
|
91
|
+
attr_reader :column
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
class FromClause < Node
|
|
96
|
+
|
|
97
|
+
def initialize(tables)
|
|
98
|
+
@tables = Array(tables)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
attr_reader :tables
|
|
102
|
+
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
class WhereClause < Node
|
|
106
|
+
|
|
107
|
+
def initialize(search_condition)
|
|
108
|
+
@search_condition = search_condition
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
attr_reader :search_condition
|
|
112
|
+
|
|
113
|
+
def to_h
|
|
114
|
+
search_condition.to_h
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
class OrderBy < Node
|
|
120
|
+
|
|
121
|
+
def initialize(sort_specification)
|
|
122
|
+
@sort_specification = Array(sort_specification)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
attr_reader :sort_specification
|
|
126
|
+
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
class JoinedTable < Node
|
|
130
|
+
|
|
131
|
+
def initialize(left, right)
|
|
132
|
+
@left = left
|
|
133
|
+
@right = right
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
attr_reader :left
|
|
137
|
+
attr_reader :right
|
|
138
|
+
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
class QualifiedJoin < JoinedTable
|
|
142
|
+
|
|
143
|
+
def initialize(left, right, search_condition)
|
|
144
|
+
super(left, right)
|
|
145
|
+
@search_condition = search_condition
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
attr_reader :search_condition
|
|
149
|
+
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
class InnerJoin < QualifiedJoin
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
class LeftJoin < QualifiedJoin
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
class LeftOuterJoin < QualifiedJoin
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
class ComparisonPredicate < Node
|
|
162
|
+
|
|
163
|
+
def initialize(left, right)
|
|
164
|
+
@left = left
|
|
165
|
+
@right = right
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
attr_reader :left
|
|
169
|
+
attr_reader :right
|
|
170
|
+
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
class Is < ComparisonPredicate
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
class Like < ComparisonPredicate
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
class In < ComparisonPredicate
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
class QuantifiedIn < ComparisonPredicate
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
class InValueList < Node
|
|
186
|
+
|
|
187
|
+
def initialize(values)
|
|
188
|
+
@values = values
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
attr_reader :values
|
|
192
|
+
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
class FolderPredicate
|
|
196
|
+
|
|
197
|
+
def initialize(folder_id, qualifier=nil)
|
|
198
|
+
@folder_id = folder_id
|
|
199
|
+
@qualifier = qualifier
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
attr_reader :folder_id
|
|
203
|
+
attr_reader :qualifier
|
|
204
|
+
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
class InFolder < FolderPredicate
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
class InTree < FolderPredicate
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
class InColumnList < Node
|
|
214
|
+
|
|
215
|
+
def initialize(columns)
|
|
216
|
+
@columns = columns
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
attr_reader :columns
|
|
220
|
+
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
class Between < Node
|
|
224
|
+
|
|
225
|
+
def initialize(left, min, max)
|
|
226
|
+
@left = left
|
|
227
|
+
@min = min
|
|
228
|
+
@max = max
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
attr_reader :left
|
|
232
|
+
attr_reader :min
|
|
233
|
+
attr_reader :max
|
|
234
|
+
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
class SearchCondition < Node
|
|
238
|
+
|
|
239
|
+
def initialize(left, right)
|
|
240
|
+
@left = left
|
|
241
|
+
@right = right
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
attr_reader :left
|
|
245
|
+
attr_reader :right
|
|
246
|
+
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
class Or < SearchCondition
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
class And < SearchCondition
|
|
253
|
+
|
|
254
|
+
def to_h
|
|
255
|
+
self.left.to_h.merge(self.right.to_h)
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
class GreaterOrEquals < ComparisonPredicate
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
class LessOrEquals < ComparisonPredicate
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
class Greater < ComparisonPredicate
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
class Less < ComparisonPredicate
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
class Equals < ComparisonPredicate
|
|
274
|
+
def to_h
|
|
275
|
+
{self.left.to_cmis_where_key => self.right.value}
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
class QuantifiedComparison < ComparisonPredicate
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
class Identifier < Node
|
|
284
|
+
|
|
285
|
+
def initialize(name)
|
|
286
|
+
@name = name
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def to_cmis_where_key
|
|
290
|
+
CmisServer::Id.new(self.name).to_method_name.to_sym
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
attr_reader :name
|
|
294
|
+
alias_method :value, :name
|
|
295
|
+
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
class Table < Identifier
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
class Column < Identifier
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
class FolderId < Identifier
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
class Score < Node
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
class True < Node
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
class False < Node
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
class Null < Node
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
class Literal < Node
|
|
321
|
+
|
|
322
|
+
def initialize(value)
|
|
323
|
+
@value = value
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
attr_reader :value
|
|
327
|
+
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
class DateTime < Literal
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
class Date < Literal
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
class String < Literal
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
class ApproximateFloat < Node
|
|
340
|
+
|
|
341
|
+
def initialize(mantissa, exponent)
|
|
342
|
+
@mantissa = mantissa
|
|
343
|
+
@exponent = exponent
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
attr_reader :mantissa
|
|
347
|
+
attr_reader :exponent
|
|
348
|
+
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
class Float < Literal
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
class Integer < Literal
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
class Unary < Node
|
|
358
|
+
|
|
359
|
+
def initialize(value)
|
|
360
|
+
@value = value
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
attr_reader :value
|
|
364
|
+
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
class Not < Unary
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
class UnaryPlus < Unary
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
class UnaryMinus < Unary
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
class OrderSpecification < Node
|
|
377
|
+
|
|
378
|
+
def initialize(column)
|
|
379
|
+
@column = column
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
attr_reader :column
|
|
383
|
+
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
class Ascending < OrderSpecification
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
class Descending < OrderSpecification
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
end
|
|
395
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'securerandom'
|
|
2
|
+
|
|
3
|
+
module CmisServer
|
|
4
|
+
class RenderableCollection
|
|
5
|
+
|
|
6
|
+
attr_reader :base_object
|
|
7
|
+
attr_reader :items
|
|
8
|
+
|
|
9
|
+
def initialize(base_object:, items:, atompub_properties: nil)
|
|
10
|
+
@base_object=base_object
|
|
11
|
+
@items =items
|
|
12
|
+
if atompub_properties
|
|
13
|
+
@atompub_properties={
|
|
14
|
+
id: atompub_properties[:id]||SecureRandom.uuid,
|
|
15
|
+
title: atompub_properties[:title]||'Collection',
|
|
16
|
+
edited: atompub_properties[:edited]||DateTime.now,
|
|
17
|
+
updated: atompub_properties[:updated]||DateTime.now,
|
|
18
|
+
author: atompub_properties[:author]||'Unknown',
|
|
19
|
+
}
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def filter_properties!(filter)
|
|
24
|
+
@properties=@properties.slice(*filter)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def atompub_properties
|
|
28
|
+
return @atompub_properties if @atompub_properties
|
|
29
|
+
if @base_object
|
|
30
|
+
{
|
|
31
|
+
id: @base_object.cmis_object_id,
|
|
32
|
+
title: @base_object.cmis_name,
|
|
33
|
+
edited: DateTime.now,
|
|
34
|
+
updated: DateTime.now,
|
|
35
|
+
author: 'unknown',
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def total_items_count
|
|
41
|
+
nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module CmisServer
|
|
2
|
+
class RenderableObject
|
|
3
|
+
|
|
4
|
+
attr_reader :base_object
|
|
5
|
+
attr_reader :properties
|
|
6
|
+
|
|
7
|
+
def initialize(base_object:, properties: nil, include_relationships: :none, include_policies: false, rendition_filter: "cmis:none", include_acl: false, include_allowable_actions: false)
|
|
8
|
+
@base_object=base_object
|
|
9
|
+
@properties =properties||@base_object.properties.values
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def filter_properties!(filter)
|
|
13
|
+
@properties.slice!(*filter)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def atompub_entry_properties
|
|
17
|
+
{
|
|
18
|
+
id: @base_object.cmis_object_id,
|
|
19
|
+
title: @base_object.cmis_name,
|
|
20
|
+
summary: @base_object.cmis_description,
|
|
21
|
+
edited: @base_object.cmis_creation_date,
|
|
22
|
+
updated: @base_object.cmis_last_modification_date,
|
|
23
|
+
author: @base_object.cmis_created_by,
|
|
24
|
+
content: @base_object.try(:content_stream)
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def policies
|
|
29
|
+
nil
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def relastionships
|
|
33
|
+
nil
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def renditions
|
|
37
|
+
nil
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def acl
|
|
41
|
+
nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def allowable_actions
|
|
45
|
+
nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
module CmisServer
|
|
2
|
+
class Repository
|
|
3
|
+
|
|
4
|
+
class Capabitilies
|
|
5
|
+
|
|
6
|
+
attr_reader :acl, :all_versions_searchable, :changes, :content_stream_updatability, :get_descendants, :get_folder_tree, :multifiling, :pwc_searchable, :pwc_updatable, :query, :renditions, :unfiling, :version_specific_filing, :join, :secondary_types
|
|
7
|
+
|
|
8
|
+
# CMIS 1.1 capabilities
|
|
9
|
+
attr_reader :create_type, :bulk_update, :append_content_stream, :update_type, :delete_type
|
|
10
|
+
|
|
11
|
+
def initialize(attrs={})
|
|
12
|
+
@acl = attrs.fetch(:acl, :none)
|
|
13
|
+
@all_versions_searchable = attrs.fetch(:all_versions_searchable, :false)
|
|
14
|
+
@changes = attrs.fetch(:changes, :none)
|
|
15
|
+
@content_stream_updatability= attrs.fetch(:content_stream_updatability, :none)
|
|
16
|
+
@get_descendants = attrs.fetch(:get_descendants, :false)
|
|
17
|
+
@get_folder_tree = attrs.fetch(:get_folder_tree, :false)
|
|
18
|
+
@multifiling = attrs.fetch(:multifiling, :false)
|
|
19
|
+
@pwc_searchable = attrs.fetch(:pwc_searchable, :false)
|
|
20
|
+
@pwc_updatable = attrs.fetch(:pwc_updatable, :false)
|
|
21
|
+
@query = attrs.fetch(:query, :metadataonly)
|
|
22
|
+
@renditions = attrs.fetch(:renditions, :none)
|
|
23
|
+
@unfiling = attrs.fetch(:unfiling, :true)
|
|
24
|
+
@version_specific_filing = attrs.fetch(:version_specific_filing, :false)
|
|
25
|
+
@join = attrs.fetch(:join, :none)
|
|
26
|
+
@secondary_types = attrs.fetch(:secondary_types, :true)
|
|
27
|
+
|
|
28
|
+
# CMIS 1.1 capabilities
|
|
29
|
+
@create_type = attrs.fetch(:create_type, false)
|
|
30
|
+
@bulk_update = attrs.fetch(:bulk_update, false)
|
|
31
|
+
@append_content_stream = attrs.fetch(:append_content_stream, false)
|
|
32
|
+
@update_type = attrs.fetch(:update_type, false)
|
|
33
|
+
@delete_type = attrs.fetch(:delete_type, false)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def [](attr)
|
|
37
|
+
self.send(attr)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
attr_accessor :id, :name, :description, :vendor_name, :product_name, :product_version, :root_folder_id, :capabilities, :latest_change_log_token, :cmis_version_supported, :capabilities
|
|
43
|
+
|
|
44
|
+
alias_method :repository_id, :id
|
|
45
|
+
alias_method :repository_name, :name
|
|
46
|
+
alias_method :repository_description, :description
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def initialize(attrs={})
|
|
50
|
+
attrs.to_h.each do |property, value|
|
|
51
|
+
self.send(property.to_s+"=", value)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def self.find(id)
|
|
57
|
+
#Todo this is a mockup
|
|
58
|
+
repo=self.new(id: id,
|
|
59
|
+
name: "My Repo",
|
|
60
|
+
description: "This is my repo !",
|
|
61
|
+
vendor_name: "AGSI",
|
|
62
|
+
product_name: "Plugandwork",
|
|
63
|
+
product_version: "CmisServer Gem v#{CmisServer::VERSION}",
|
|
64
|
+
root_folder_id: CmisServer::FolderObject.root_folder.cmis_object_id,
|
|
65
|
+
latest_change_log_token: 0,
|
|
66
|
+
cmis_version_supported: CmisServer::CMIS_VERSION_SUPPORTED,
|
|
67
|
+
capabilities: Capabitilies.new(
|
|
68
|
+
# Activer les capacités CMIS 1.1 par défaut
|
|
69
|
+
create_type: true,
|
|
70
|
+
bulk_update: true,
|
|
71
|
+
append_content_stream: true,
|
|
72
|
+
update_type: true,
|
|
73
|
+
delete_type: true
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
repo
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def infos
|
|
80
|
+
[:repository_id, :repository_name, :repository_description, :vendor_name, :product_name, :product_version, :root_folder_id, :cmis_version_supported].map { |p| [p.to_s.camelize(:lower), self.send(p)] }.to_h
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Méthode pour récupérer un objet CMIS par son ID
|
|
84
|
+
def get_object(object_id)
|
|
85
|
+
# À implémenter selon votre système de stockage
|
|
86
|
+
# Cette méthode devrait retourner l'objet CMIS correspondant à l'ID ou nil
|
|
87
|
+
nil
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module CmisServer
|
|
2
|
+
class Type
|
|
3
|
+
|
|
4
|
+
attr_accessor :id,
|
|
5
|
+
:local_name,
|
|
6
|
+
:local_namespace,
|
|
7
|
+
:query_name,
|
|
8
|
+
:display_name,
|
|
9
|
+
:base_id,
|
|
10
|
+
:parent_type,
|
|
11
|
+
:description,
|
|
12
|
+
:creatable,
|
|
13
|
+
:fileable,
|
|
14
|
+
:queryable,
|
|
15
|
+
:controllable_policy,
|
|
16
|
+
:controllable_acl,
|
|
17
|
+
:fulltext_indexed,
|
|
18
|
+
:included_in_supertype_query,
|
|
19
|
+
:self_property_definitions
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def initialize(attrs={})
|
|
23
|
+
@id = CmisServer::Id.new(attrs.fetch(:id).to_s)
|
|
24
|
+
@parent_type = attrs.fetch(:parent_type)
|
|
25
|
+
@local_name = attrs.fetch(:local_name, id)
|
|
26
|
+
@local_namespace = attrs.fetch(:local_namespace, 'local')
|
|
27
|
+
@query_name = attrs.fetch(:query_name, id)
|
|
28
|
+
@display_name = attrs.fetch(:display_name, id)
|
|
29
|
+
@description = attrs.fetch(:description, 'No description provided')
|
|
30
|
+
@creatable = attrs.fetch(:creatable, false)
|
|
31
|
+
@fileable = attrs.fetch(:fileable, false)
|
|
32
|
+
@queryable = attrs.fetch(:queryable, false)
|
|
33
|
+
@controllable_policy = attrs.fetch(:controllable_policy, false)
|
|
34
|
+
@controllable_acl = attrs.fetch(:controllable_acl, false)
|
|
35
|
+
@fulltext_indexed = attrs.fetch(:fulltext_indexed, false)
|
|
36
|
+
@included_in_supertype_query = attrs.fetch(:included_in_supertype_query, false)
|
|
37
|
+
|
|
38
|
+
@self_property_definitions = attrs.fetch(:property_definitions, [])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def parent_id
|
|
42
|
+
self.parent_type&.id
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def base_type
|
|
46
|
+
self.parent_type ? self.parent_type.base_type : self
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def base_id
|
|
50
|
+
self.parent_type ? self.parent_type.base_id : self.id
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def property_definitions
|
|
54
|
+
@self_property_definitions.to_a+parent_property_definitions
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def parent_property_definitions
|
|
58
|
+
#Decorate parent property_definitions as inherited
|
|
59
|
+
self.parent_type&.property_definitions.to_a.map { |pd| InheritedDecorator.new(pd) }
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|