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,117 @@
|
|
1
|
+
module CmisServer
|
2
|
+
class TypeManagementService
|
3
|
+
class DeleteTypeError < StandardError; end
|
4
|
+
|
5
|
+
attr_reader :context
|
6
|
+
|
7
|
+
def initialize(context = {})
|
8
|
+
@context = context
|
9
|
+
end
|
10
|
+
|
11
|
+
def repository
|
12
|
+
context[:repository]
|
13
|
+
end
|
14
|
+
|
15
|
+
# Crée un nouveau type dans le repository
|
16
|
+
# @param type [Type] le type à créer
|
17
|
+
# @return [Type] le type créé
|
18
|
+
def create_type(type)
|
19
|
+
# Vérifier que le repository supporte la création de types
|
20
|
+
unless repository.capabilities[:create_type]
|
21
|
+
raise CapabilityError.new("Repository does not support type creation")
|
22
|
+
end
|
23
|
+
|
24
|
+
# Vérifier que le type parent existe
|
25
|
+
parent_type = repository.type(type.parent_id)
|
26
|
+
if parent_type.nil?
|
27
|
+
raise TypeNotFoundError.new("Parent type '#{type.parent_id}' not found")
|
28
|
+
end
|
29
|
+
|
30
|
+
# Vérifier que le type n'existe pas déjà
|
31
|
+
if repository.type(type.id)
|
32
|
+
raise DuplicateTypeError.new("Type '#{type.id}' already exists")
|
33
|
+
end
|
34
|
+
|
35
|
+
# Valider le type
|
36
|
+
unless type.valid?
|
37
|
+
raise ValidationError.new("Type validation failed: #{type.errors.full_messages.join(', ')}")
|
38
|
+
end
|
39
|
+
|
40
|
+
# Créer le type
|
41
|
+
repository.add_type(type)
|
42
|
+
|
43
|
+
# Retourner le type créé
|
44
|
+
repository.type(type.id)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Met à jour un type existant dans le repository
|
48
|
+
# @param type [Type] le type avec les modifications
|
49
|
+
# @return [Type] le type mis à jour
|
50
|
+
def update_type(type)
|
51
|
+
# Vérifier que le repository supporte la mise à jour de types
|
52
|
+
unless repository.capabilities[:update_type]
|
53
|
+
raise CapabilityError.new("Repository does not support type update")
|
54
|
+
end
|
55
|
+
|
56
|
+
# Vérifier que le type existe
|
57
|
+
existing_type = repository.type(type.id)
|
58
|
+
if existing_type.nil?
|
59
|
+
raise TypeNotFoundError.new("Type '#{type.id}' not found")
|
60
|
+
end
|
61
|
+
|
62
|
+
# Valider les modifications
|
63
|
+
unless type.valid?
|
64
|
+
raise ValidationError.new("Type validation failed: #{type.errors.full_messages.join(', ')}")
|
65
|
+
end
|
66
|
+
|
67
|
+
# Mettre à jour le type
|
68
|
+
repository.update_type(type)
|
69
|
+
|
70
|
+
# Retourner le type mis à jour
|
71
|
+
repository.type(type.id)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Supprime un type du repository
|
75
|
+
# @param type_id [String] l'identifiant du type à supprimer
|
76
|
+
# @return [Boolean] true si la suppression a réussi
|
77
|
+
def delete_type(type_id)
|
78
|
+
# Vérifier que le repository supporte la suppression de types
|
79
|
+
unless repository.capabilities[:delete_type]
|
80
|
+
raise CapabilityError.new("Repository does not support type deletion")
|
81
|
+
end
|
82
|
+
|
83
|
+
# Vérifier que le type existe
|
84
|
+
type = repository.type(type_id)
|
85
|
+
if type.nil?
|
86
|
+
raise TypeNotFoundError.new("Type '#{type_id}' not found")
|
87
|
+
end
|
88
|
+
|
89
|
+
# Vérifier qu'aucun objet n'utilise ce type
|
90
|
+
if has_instances?(type_id)
|
91
|
+
raise DeleteTypeError.new("Cannot delete type '#{type_id}' because it has instances")
|
92
|
+
end
|
93
|
+
|
94
|
+
# Supprimer le type
|
95
|
+
repository.delete_type(type_id)
|
96
|
+
|
97
|
+
true
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
|
102
|
+
# Vérifie si un type est utilisé par des objets
|
103
|
+
# @param type_id [String] l'identifiant du type
|
104
|
+
# @return [Boolean] true si des objets utilisent ce type
|
105
|
+
def has_instances?(type_id)
|
106
|
+
# Parcourir tous les objets du repository pour vérifier s'ils utilisent ce type
|
107
|
+
repository.all_objects.any? do |object|
|
108
|
+
object.type.id == type_id || (object.respond_to?(:secondary_type_ids) && object.secondary_type_ids.include?(type_id))
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
class CapabilityError < StandardError; end
|
113
|
+
class TypeNotFoundError < StandardError; end
|
114
|
+
class DuplicateTypeError < StandardError; end
|
115
|
+
class ValidationError < StandardError; end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<feed xmlns="http://www.w3.org/2005/Atom"
|
3
|
+
xmlns:app="http://www.w3.org/2007/app"
|
4
|
+
xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
|
5
|
+
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
|
6
|
+
|
7
|
+
<author>
|
8
|
+
<n><%= CmisServer.configuration.repository_info[:vendor_name] %></n>
|
9
|
+
</author>
|
10
|
+
|
11
|
+
<title>Bulk Update Results</title>
|
12
|
+
<id><%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/bulk', :action => 'update_properties', :repository_id => params[:repository_id]) %></id>
|
13
|
+
<updated><%= Time.now.iso8601 %></updated>
|
14
|
+
|
15
|
+
<link rel="self" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/bulk', :action => 'update_properties', :repository_id => params[:repository_id]) %>"/>
|
16
|
+
<link rel="service" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/service_documents', :action => 'index', :repository_id => params[:repository_id]) %>"/>
|
17
|
+
|
18
|
+
<cmisra:numItems><%= results.count %></cmisra:numItems>
|
19
|
+
|
20
|
+
<% results.each do |result| %>
|
21
|
+
<entry>
|
22
|
+
<id><%= result[:id] %></id>
|
23
|
+
<title><%= result[:status] == "success" ? "Success" : "Error" %></title>
|
24
|
+
<updated><%= Time.now.iso8601 %></updated>
|
25
|
+
|
26
|
+
<content type="text/plain">
|
27
|
+
<cmisra:object>
|
28
|
+
<cmis:properties>
|
29
|
+
<cmis:propertyId propertyDefinitionId="cmis:objectId">
|
30
|
+
<cmis:value><%= result[:id] %></cmis:value>
|
31
|
+
</cmis:propertyId>
|
32
|
+
<cmis:propertyString propertyDefinitionId="cmis:bulkUpdateStatus">
|
33
|
+
<cmis:value><%= result[:status] %></cmis:value>
|
34
|
+
</cmis:propertyString>
|
35
|
+
<% if result[:message] %>
|
36
|
+
<cmis:propertyString propertyDefinitionId="cmis:bulkUpdateMessage">
|
37
|
+
<cmis:value><%= result[:message] %></cmis:value>
|
38
|
+
</cmis:propertyString>
|
39
|
+
<% end %>
|
40
|
+
</cmis:properties>
|
41
|
+
</cmisra:object>
|
42
|
+
</content>
|
43
|
+
|
44
|
+
<link rel="self" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/entries', :action => 'show', :id => result[:id], :repository_id => params[:repository_id]) %>"/>
|
45
|
+
</entry>
|
46
|
+
<% end %>
|
47
|
+
</feed>
|
File without changes
|
@@ -0,0 +1,64 @@
|
|
1
|
+
xml.tag!('entry', 'xmlns:atom' => 'http://www.w3.org/2005/Atom',
|
2
|
+
'xmlns:cmis' => 'http://docs.oasis-open.org/ns/cmis/core/200908/',
|
3
|
+
'xmlns:cmisra' => 'http://docs.oasis-open.org/ns/cmis/restatom/200908/',
|
4
|
+
'xmlns' => 'http://www.w3.org/2005/Atom',
|
5
|
+
'xmlns:app' => 'http://www.w3.org/2007/app') do
|
6
|
+
xml.id object.atompub_entry_properties[:id]
|
7
|
+
xml.title object.atompub_entry_properties[:title]
|
8
|
+
xml.summary object.atompub_entry_properties[:summary]
|
9
|
+
xml.updated object.atompub_entry_properties[:updated]
|
10
|
+
xml.author do
|
11
|
+
xml.name object.atompub_entry_properties[:author]
|
12
|
+
end
|
13
|
+
|
14
|
+
if cs=object.atompub_entry_properties[:content]
|
15
|
+
xml.content type: cs.media_type.to_s, src: atom_pub_content_url(id: cs.id)
|
16
|
+
end
|
17
|
+
xml.link(rel: 'service', href: atom_pub_url, type: 'application/atomsvc+xml')
|
18
|
+
xml.link(rel: 'self', href: atom_pub_entry_url(id: object.base_object.cmis_object_id), type: 'application/atomsvc+xml')
|
19
|
+
xml<<links_for(object.base_object)
|
20
|
+
|
21
|
+
|
22
|
+
# Non-AtomPub elements must be put at the end to validate XSD schema
|
23
|
+
|
24
|
+
xml.tag!("app:edited", object.atompub_entry_properties[:edited])
|
25
|
+
|
26
|
+
xml.tag!('cmisra:object') do
|
27
|
+
xml.tag!('cmis:properties') do
|
28
|
+
object.properties.each do |property|
|
29
|
+
unless property.value.nil?
|
30
|
+
xml << render(partial: 'cmis_server/atom_pub/entries/property', locals: {property: property})
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# CMIS 1.1: Ajouter les types secondaires
|
36
|
+
if object.base_object.respond_to?(:secondary_types) && !object.base_object.secondary_types.empty?
|
37
|
+
xml.tag!('cmis:secondaryObjectTypes') do
|
38
|
+
object.base_object.secondary_types.each do |secondary_type|
|
39
|
+
xml.tag!('cmis:secondaryType') do
|
40
|
+
xml.tag!('cmis:id', secondary_type.id)
|
41
|
+
xml.tag!('cmis:displayName', secondary_type.display_name)
|
42
|
+
xml.tag!('cmis:description', secondary_type.description)
|
43
|
+
|
44
|
+
# Inclure les propriétés spécifiques au type secondaire
|
45
|
+
xml.tag!('cmis:properties') do
|
46
|
+
secondary_type.self_property_definitions.each do |prop_def|
|
47
|
+
property = object.base_object.properties[prop_def.id]
|
48
|
+
if property && !property.value.nil?
|
49
|
+
xml << render(partial: 'cmis_server/atom_pub/entries/property', locals: {property: property})
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
if try(:with_path_segment)
|
60
|
+
xml.tag!('cmisra:pathSegment', object.base_object.path_segment)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
xml.tag!("cmis:property#{property.property_definition.type.name.demodulize}", {
|
2
|
+
"queryName" => property.property_definition.query_name,
|
3
|
+
"displayName" => property.property_definition.display_name,
|
4
|
+
"localName" => property.property_definition.local_name,
|
5
|
+
"propertyDefinitionId" => property.property_definition.id}
|
6
|
+
) do
|
7
|
+
xml.tag!("cmis:value", property.value)
|
8
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
xml << render(partial: 'cmis_server/atom_pub/entries/object_entry', locals: {object: @object})
|
@@ -0,0 +1,59 @@
|
|
1
|
+
xml.tag!('entry', 'xmlns:atom' => 'http://www.w3.org/2005/Atom',
|
2
|
+
'xmlns:cmis' => 'http://docs.oasis-open.org/ns/cmis/core/200908/',
|
3
|
+
'xmlns:cmisra' => 'http://docs.oasis-open.org/ns/cmis/restatom/200908/',
|
4
|
+
'xmlns' => 'http://www.w3.org/2005/Atom',
|
5
|
+
'xmlns:app' => 'http://www.w3.org/2007/app') do
|
6
|
+
|
7
|
+
xml.id @type.id
|
8
|
+
xml.title @type.display_name
|
9
|
+
xml.summary @type.description
|
10
|
+
xml.updated DateTime.now
|
11
|
+
xml.author do
|
12
|
+
xml.name 'unknown'
|
13
|
+
end
|
14
|
+
|
15
|
+
xml.link(rel: 'service', href: atom_pub_url, type: 'application/atomsvc+xml')
|
16
|
+
xml.link(rel: 'self', href: atom_pub_type_by_id_url(id: @type.id), type: 'application/atomsvc+xml')
|
17
|
+
|
18
|
+
xml.tag!("app:edited", DateTime.now)
|
19
|
+
|
20
|
+
xml.tag!('cmisra:type', 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
|
21
|
+
'xmlns:ns3' => "http://docs.oasis-open.org/ns/cmis/messaging/200908/",
|
22
|
+
'xsi:type' => "cmis:cmisTypeFolderDefinitionType") do
|
23
|
+
xml.tag! 'cmis:id', @type.id
|
24
|
+
xml.tag! 'cmis:localName', @type.local_name
|
25
|
+
xml.tag! 'cmis:localNamespace', @type.local_namespace
|
26
|
+
xml.tag! 'cmis:displayName', @type.display_name
|
27
|
+
xml.tag! 'cmis:queryName', @type.query_name
|
28
|
+
xml.tag! 'cmis:description', @type.description
|
29
|
+
xml.tag! 'cmis:baseId', @type.base_id
|
30
|
+
xml.tag! 'cmis:creatable', @type.creatable
|
31
|
+
xml.tag! 'cmis:fileable', @type.fileable
|
32
|
+
xml.tag! 'cmis:queryable', @type.queryable
|
33
|
+
xml.tag! 'cmis:fulltextIndexed', @type.fulltext_indexed
|
34
|
+
xml.tag! 'cmis:includedInSupertypeQuery', @type.included_in_supertype_query
|
35
|
+
xml.tag! 'cmis:controllablePolicy', @type.controllable_policy
|
36
|
+
xml.tag! 'cmis:controllableACL', @type.controllable_acl
|
37
|
+
|
38
|
+
|
39
|
+
@type.property_definitions.each do |prop|
|
40
|
+
xml.tag!('cmis:propertyIdDefinition') do
|
41
|
+
xml.tag!('cmis:id', prop.id)
|
42
|
+
xml.tag!('cmis:localName', prop.local_name.to_s)
|
43
|
+
xml.tag!('cmis:localNamespace', prop.local_namespace.to_s)
|
44
|
+
xml.tag!('cmis:displayName', prop.display_name.to_s)
|
45
|
+
xml.tag!('cmis:queryName', prop.query_name.to_s)
|
46
|
+
xml.tag!('cmis:inherited', prop.inherited.to_s)
|
47
|
+
xml.tag!('cmis:description', prop.description.to_s)
|
48
|
+
xml.tag!('cmis:propertyType', prop.property_type.to_s)
|
49
|
+
xml.tag!('cmis:cardinality', prop.cardinality.to_s)
|
50
|
+
xml.tag!('cmis:updatability', prop.updatability.to_s)
|
51
|
+
xml.tag!('cmis:required', prop.required.to_s)
|
52
|
+
xml.tag!('cmis:queryable', prop.queryable.to_s)
|
53
|
+
xml.tag!('cmis:orderable', prop.orderable.to_s)
|
54
|
+
xml.tag!('cmis:openChoice', prop.open_choice.to_s)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
xml << render(partial: 'cmis_server/atom_pub/entries/object_entry', locals: {object: object, with_path_segment: true}, formats: [:atom_entry])
|
@@ -0,0 +1,30 @@
|
|
1
|
+
xml.tag!('atom:feed', 'xmlns:atom' => 'http://www.w3.org/2005/Atom',
|
2
|
+
'xmlns:cmis' => 'http://docs.oasis-open.org/ns/cmis/core/200908/',
|
3
|
+
'xmlns:cmisra' => 'http://docs.oasis-open.org/ns/cmis/restatom/200908/',
|
4
|
+
'xmlns' => 'http://www.w3.org/2005/Atom', 'xmlns:app' => 'http://www.w3.org/2007/app') do
|
5
|
+
xml.tag!('atom:author') do
|
6
|
+
xml.tag!('atom:name', @collection.atompub_properties[:author])
|
7
|
+
end
|
8
|
+
xml.tag!('atom:id', @collection.atompub_properties[:id])
|
9
|
+
xml.tag!('atom:title', @collection.atompub_properties[:title])
|
10
|
+
xml.tag!('app:edited', @collection.atompub_properties[:edited])
|
11
|
+
xml.tag!('atom:updated', @collection.atompub_properties[:updated])
|
12
|
+
|
13
|
+
if @collection.base_object
|
14
|
+
xml << render(partial: 'cmis_server/atom_pub/shared/collection', formats: [:xml], locals: {
|
15
|
+
href: atom_pub_folder_collection_url(id: @collection.base_object.cmis_object_id),
|
16
|
+
title: "Folder Collection",
|
17
|
+
accept: "application/cmisatom+xml",
|
18
|
+
})
|
19
|
+
end
|
20
|
+
|
21
|
+
if @collection.total_items_count
|
22
|
+
xml.tag!('cmisra:numItems', @collection.total_items_count)
|
23
|
+
end
|
24
|
+
|
25
|
+
@collection.items.each do |object|
|
26
|
+
|
27
|
+
xml << render(partial: 'cmis_server/atom_pub/feeds/feed_entry', locals: {object: object})
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
xml.tag!('app:workspace') do
|
2
|
+
xml.tag!('app:title', repository.id)
|
3
|
+
|
4
|
+
xml.tag!('cmisra:repositoryInfo', {'xmlns:ns3' => "http://docs.oasis-open.org/ns/cmis/messaging/200908/"}) do
|
5
|
+
xml.tag!('cmis:repositoryId', repository.id)
|
6
|
+
xml.tag!('cmis:repositoryName', repository.name)
|
7
|
+
xml.tag!('cmis:repositoryDescription', repository.description)
|
8
|
+
xml.tag!('cmis:vendorName', repository.vendor_name)
|
9
|
+
xml.tag!('cmis:productName', repository.product_name)
|
10
|
+
xml.tag!('cmis:productVersion', repository.product_version)
|
11
|
+
xml.tag!('cmis:rootFolderId', repository.root_folder_id)
|
12
|
+
xml.tag!('cmis:latestChangeLogToken', repository.latest_change_log_token)
|
13
|
+
xml.tag!('cmis:cmisVersionSupported', repository.cmis_version_supported)
|
14
|
+
xml.tag!('cmis:capabilities') do
|
15
|
+
xml.tag!('cmis:capabilityACL', repository.capabilities[:acl].to_s)
|
16
|
+
xml.tag!('cmis:capabilityAllVersionsSearchable', repository.capabilities[:all_versions_searchable].to_s)
|
17
|
+
xml.tag!('cmis:capabilityChanges', repository.capabilities[:changes].to_s)
|
18
|
+
xml.tag!('cmis:capabilityContentStreamUpdatability', repository.capabilities[:content_stream_updatability].to_s)
|
19
|
+
xml.tag!('cmis:capabilityGetDescendants', repository.capabilities[:get_descendants].to_s)
|
20
|
+
xml.tag!('cmis:capabilityGetFolderTree', repository.capabilities[:get_folder_tree].to_s)
|
21
|
+
xml.tag!('cmis:capabilityMultifiling', repository.capabilities[:multifiling].to_s)
|
22
|
+
xml.tag!('cmis:capabilityPWCSearchable', repository.capabilities[:pwc_searchable].to_s)
|
23
|
+
xml.tag!('cmis:capabilityPWCUpdatable', repository.capabilities[:pwc_updatable].to_s)
|
24
|
+
xml.tag!('cmis:capabilityQuery', repository.capabilities[:query].to_s)
|
25
|
+
xml.tag!('cmis:capabilityRenditions', repository.capabilities[:renditions].to_s)
|
26
|
+
xml.tag!('cmis:capabilitySecondaryTypes', repository.capabilities[:secondary_types].to_s)
|
27
|
+
xml.tag!('cmis:capabilityUnfiling', repository.capabilities[:unfiling].to_s)
|
28
|
+
xml.tag!('cmis:capabilityVersionSpecificFiling', repository.capabilities[:version_specific_filing].to_s)
|
29
|
+
xml.tag!('cmis:capabilityJoin', repository.capabilities[:join].to_s)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
xml << render(partial: 'cmis_server/atom_pub/shared/collection', formats: [:xml], locals: {
|
35
|
+
type: "root",
|
36
|
+
href: atom_pub_folder_collection_url(repository.id, CmisServer::FolderObject.root_folder.cmis_object_id),
|
37
|
+
title: "Root Collection",
|
38
|
+
accept: "application/atom+xml;type=entry",
|
39
|
+
})
|
40
|
+
|
41
|
+
xml << render(partial: 'cmis_server/atom_pub/shared/collection', formats: [:xml], locals: {
|
42
|
+
type: "query",
|
43
|
+
href: atom_pub_query_url(repository.id),
|
44
|
+
title: "Query Collection",
|
45
|
+
accept: "application/cmisquery+xml",
|
46
|
+
})
|
47
|
+
|
48
|
+
xml << render(partial: 'cmis_server/atom_pub/service_documents/uri_template', locals: {
|
49
|
+
type: "objectbyid",
|
50
|
+
template: URI.unescape(atom_pub_object_by_id_url(repository.id, {id: '{id}',
|
51
|
+
filter: '{filter}',
|
52
|
+
include_allowable_actions: '{includeAllowableActions}',
|
53
|
+
include_acl: "{includeACL}",
|
54
|
+
include_policy_ids: "{includePolicyIds}",
|
55
|
+
include_relationships: "{includeRelationships}",
|
56
|
+
rendition_filter: "{renditionFilter}"
|
57
|
+
})),
|
58
|
+
mediatype: 'application/atom+xml;type=entry'
|
59
|
+
})
|
60
|
+
xml << render(partial: 'cmis_server/atom_pub/service_documents/uri_template', locals: {
|
61
|
+
type: "objectbypath",
|
62
|
+
template: URI.unescape(atom_pub_object_by_path_url(repository.id, {path: '{path}',
|
63
|
+
filter: '{filter}',
|
64
|
+
include_allowable_actions: '{includeAllowableActions}',
|
65
|
+
include_acl: "{includeACL}",
|
66
|
+
include_policy_ids: "{includePolicyIds}",
|
67
|
+
include_relationships: "{includeRelationships}",
|
68
|
+
rendition_filter: "{renditionFilter}"
|
69
|
+
})),
|
70
|
+
mediatype: 'application/atom+xml;type=entry'
|
71
|
+
})
|
72
|
+
xml << render(partial: 'cmis_server/atom_pub/service_documents/uri_template', locals: {
|
73
|
+
type: "typebyid",
|
74
|
+
template: URI.unescape(atom_pub_type_by_id_url(repository.id, {id: '{id}'})),
|
75
|
+
mediatype: 'application/atom+xml;type=entry'
|
76
|
+
})
|
77
|
+
xml << render(partial: 'cmis_server/atom_pub/service_documents/uri_template', locals: {
|
78
|
+
type: "query",
|
79
|
+
template: URI.unescape(atom_pub_query_url(repository.id, {q: '{q}',
|
80
|
+
search_all_versions: '{searchAllVersions}',
|
81
|
+
include_allowable_actions: '{includeAllowableActions}',
|
82
|
+
include_relationships: "{includeRelationships}",
|
83
|
+
max_items: "{maxItems}",
|
84
|
+
skip_count: "{skipCount}",
|
85
|
+
})),
|
86
|
+
mediatype: 'application/atom+xml;type=entry'
|
87
|
+
})
|
88
|
+
|
89
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
xml << render(partial: 'cmis_server/atom_pub/service_documents/workspace', locals: {repository: @repository})
|
File without changes
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<entry xmlns="http://www.w3.org/2005/Atom"
|
3
|
+
xmlns:app="http://www.w3.org/2007/app"
|
4
|
+
xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
|
5
|
+
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
|
6
|
+
|
7
|
+
<author>
|
8
|
+
<name><%= CmisServer.configuration.repository_info[:vendor_name] %></name>
|
9
|
+
</author>
|
10
|
+
|
11
|
+
<id><%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'show', :id => @type.id) %></id>
|
12
|
+
<title><%= @type.display_name %></title>
|
13
|
+
<updated><%= Time.now.iso8601 %></updated>
|
14
|
+
|
15
|
+
<content type="application/cmistree+xml">
|
16
|
+
<cmisra:type xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">
|
17
|
+
<cmis:id><%= @type.id %></cmis:id>
|
18
|
+
<cmis:localName><%= @type.local_name %></cmis:localName>
|
19
|
+
<cmis:localNamespace><%= @type.local_namespace %></cmis:localNamespace>
|
20
|
+
<cmis:displayName><%= @type.display_name %></cmis:displayName>
|
21
|
+
<cmis:queryName><%= @type.query_name %></cmis:queryName>
|
22
|
+
<cmis:description><%= @type.description %></cmis:description>
|
23
|
+
<cmis:baseId><%= @type.base_id %></cmis:baseId>
|
24
|
+
<% if @type.parent_id %>
|
25
|
+
<cmis:parentId><%= @type.parent_id %></cmis:parentId>
|
26
|
+
<% end %>
|
27
|
+
<cmis:creatable><%= @type.creatable %></cmis:creatable>
|
28
|
+
<cmis:fileable><%= @type.fileable %></cmis:fileable>
|
29
|
+
<cmis:queryable><%= @type.queryable %></cmis:queryable>
|
30
|
+
<cmis:controllablePolicy><%= @type.controllable_policy %></cmis:controllablePolicy>
|
31
|
+
<cmis:controllableACL><%= @type.controllable_acl %></cmis:controllableACL>
|
32
|
+
<cmis:fulltextIndexed><%= @type.fulltext_indexed %></cmis:fulltextIndexed>
|
33
|
+
<cmis:includedInSupertypeQuery><%= @type.included_in_supertype_query %></cmis:includedInSupertypeQuery>
|
34
|
+
|
35
|
+
<% if @include_property_definitions || params[:includePropertyDefinitions] != "false" %>
|
36
|
+
<% @type.property_definitions.each do |prop_def| %>
|
37
|
+
<cmis:propertyDefinition>
|
38
|
+
<cmis:id><%= prop_def.id %></cmis:id>
|
39
|
+
<cmis:localName><%= prop_def.local_name %></cmis:localName>
|
40
|
+
<cmis:localNamespace><%= prop_def.local_namespace %></cmis:localNamespace>
|
41
|
+
<cmis:displayName><%= prop_def.display_name %></cmis:displayName>
|
42
|
+
<cmis:queryName><%= prop_def.query_name %></cmis:queryName>
|
43
|
+
<cmis:description><%= prop_def.description %></cmis:description>
|
44
|
+
<cmis:propertyType><%= prop_def.property_type %></cmis:propertyType>
|
45
|
+
<cmis:cardinality><%= prop_def.cardinality %></cmis:cardinality>
|
46
|
+
<cmis:updatability><%= prop_def.updatability %></cmis:updatability>
|
47
|
+
<cmis:inherited><%= prop_def.is_a?(InheritedDecorator) %></cmis:inherited>
|
48
|
+
<cmis:required><%= prop_def.required %></cmis:required>
|
49
|
+
<cmis:queryable><%= prop_def.queryable %></cmis:queryable>
|
50
|
+
<cmis:orderable><%= prop_def.orderable %></cmis:orderable>
|
51
|
+
</cmis:propertyDefinition>
|
52
|
+
<% end %>
|
53
|
+
<% end %>
|
54
|
+
</cmisra:type>
|
55
|
+
</content>
|
56
|
+
|
57
|
+
<link rel="self" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'show', :id => @type.id) %>"/>
|
58
|
+
<link rel="edit" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'show', :id => @type.id) %>"/>
|
59
|
+
<link rel="service" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/service_documents', :action => 'index', :repository_id => params[:repository_id]) %>"/>
|
60
|
+
<link rel="up" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'index', :repository_id => params[:repository_id]) %>"/>
|
61
|
+
|
62
|
+
<% if @type.parent_id %>
|
63
|
+
<link rel="parent" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'show', :id => @type.parent_id, :repository_id => params[:repository_id]) %>"/>
|
64
|
+
<% end %>
|
65
|
+
|
66
|
+
<!-- CMIS 1.1 specific down link for type children -->
|
67
|
+
<link rel="down" type="application/atom+xml;type=feed" title="Children Types"
|
68
|
+
href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'index', :typeId => @type.id, :repository_id => params[:repository_id]) %>"/>
|
69
|
+
</entry>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<feed xmlns="http://www.w3.org/2005/Atom"
|
3
|
+
xmlns:app="http://www.w3.org/2007/app"
|
4
|
+
xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
|
5
|
+
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
|
6
|
+
|
7
|
+
<author>
|
8
|
+
<n><%= CmisServer.configuration.repository_info[:vendor_name] %></n>
|
9
|
+
</author>
|
10
|
+
|
11
|
+
<title>Types</title>
|
12
|
+
<id><%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'index', :repository_id => params[:repository_id]) %></id>
|
13
|
+
<updated><%= Time.now.iso8601 %></updated>
|
14
|
+
|
15
|
+
<link rel="self" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'index', :repository_id => params[:repository_id]) %>"/>
|
16
|
+
<link rel="service" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/service_documents', :action => 'index', :repository_id => params[:repository_id]) %>"/>
|
17
|
+
|
18
|
+
<% if params[:typeId] %>
|
19
|
+
<% parent_type = CmisServer::TypeRegistry.get_type(params[:typeId]) %>
|
20
|
+
<% if parent_type && parent_type.parent_id %>
|
21
|
+
<link rel="up" title="Parent Type" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'show', :id => parent_type.parent_id, :repository_id => params[:repository_id]) %>"/>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<cmisra:numItems><%= @types.count %></cmisra:numItems>
|
26
|
+
|
27
|
+
<% @types.each do |type| %>
|
28
|
+
<% next if params[:typeId] && type.parent_id != params[:typeId] %>
|
29
|
+
<entry>
|
30
|
+
<id><%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'show', :id => type.id, :repository_id => params[:repository_id]) %></id>
|
31
|
+
<title><%= type.display_name %></title>
|
32
|
+
<updated><%= Time.now.iso8601 %></updated>
|
33
|
+
|
34
|
+
<content type="application/cmistree+xml">
|
35
|
+
<cmisra:type xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">
|
36
|
+
<cmis:id><%= type.id %></cmis:id>
|
37
|
+
<cmis:localName><%= type.local_name %></cmis:localName>
|
38
|
+
<cmis:localNamespace><%= type.local_namespace %></cmis:localNamespace>
|
39
|
+
<cmis:displayName><%= type.display_name %></cmis:displayName>
|
40
|
+
<cmis:queryName><%= type.query_name %></cmis:queryName>
|
41
|
+
<cmis:description><%= type.description %></cmis:description>
|
42
|
+
<cmis:baseId><%= type.base_id %></cmis:baseId>
|
43
|
+
<% if type.parent_id %>
|
44
|
+
<cmis:parentId><%= type.parent_id %></cmis:parentId>
|
45
|
+
<% end %>
|
46
|
+
<cmis:creatable><%= type.creatable %></cmis:creatable>
|
47
|
+
<cmis:fileable><%= type.fileable %></cmis:fileable>
|
48
|
+
<cmis:queryable><%= type.queryable %></cmis:queryable>
|
49
|
+
<cmis:controllablePolicy><%= type.controllable_policy %></cmis:controllablePolicy>
|
50
|
+
<cmis:controllableACL><%= type.controllable_acl %></cmis:controllableACL>
|
51
|
+
<cmis:fulltextIndexed><%= type.fulltext_indexed %></cmis:fulltextIndexed>
|
52
|
+
<cmis:includedInSupertypeQuery><%= type.included_in_supertype_query %></cmis:includedInSupertypeQuery>
|
53
|
+
|
54
|
+
<% if @include_property_definitions %>
|
55
|
+
<% type.property_definitions.each do |prop_def| %>
|
56
|
+
<cmis:propertyDefinition>
|
57
|
+
<cmis:id><%= prop_def.id %></cmis:id>
|
58
|
+
<cmis:localName><%= prop_def.local_name %></cmis:localName>
|
59
|
+
<cmis:localNamespace><%= prop_def.local_namespace %></cmis:localNamespace>
|
60
|
+
<cmis:displayName><%= prop_def.display_name %></cmis:displayName>
|
61
|
+
<cmis:queryName><%= prop_def.query_name %></cmis:queryName>
|
62
|
+
<cmis:description><%= prop_def.description %></cmis:description>
|
63
|
+
<cmis:propertyType><%= prop_def.property_type %></cmis:propertyType>
|
64
|
+
<cmis:cardinality><%= prop_def.cardinality %></cmis:cardinality>
|
65
|
+
<cmis:updatability><%= prop_def.updatability %></cmis:updatability>
|
66
|
+
<cmis:inherited><%= prop_def.is_a?(InheritedDecorator) %></cmis:inherited>
|
67
|
+
<cmis:required><%= prop_def.required %></cmis:required>
|
68
|
+
<cmis:queryable><%= prop_def.queryable %></cmis:queryable>
|
69
|
+
<cmis:orderable><%= prop_def.orderable %></cmis:orderable>
|
70
|
+
</cmis:propertyDefinition>
|
71
|
+
<% end %>
|
72
|
+
<% end %>
|
73
|
+
</cmisra:type>
|
74
|
+
</content>
|
75
|
+
|
76
|
+
<link rel="self" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'show', :id => type.id, :repository_id => params[:repository_id]) %>"/>
|
77
|
+
<link rel="edit" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'show', :id => type.id, :repository_id => params[:repository_id]) %>"/>
|
78
|
+
|
79
|
+
<% if type.parent_id %>
|
80
|
+
<link rel="parent" href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'show', :id => type.parent_id, :repository_id => params[:repository_id]) %>"/>
|
81
|
+
<% end %>
|
82
|
+
|
83
|
+
<!-- Check if the type has children -->
|
84
|
+
<% has_children = CmisServer::TypeRegistry.types.values.any? { |t| t.parent_id == type.id } %>
|
85
|
+
<% if has_children %>
|
86
|
+
<link rel="down" type="application/atom+xml;type=feed" title="Children Types"
|
87
|
+
href="<%= url_for(:only_path => false, :controller => 'cmis_server/atom_pub/types', :action => 'index', :typeId => type.id, :repository_id => params[:repository_id]) %>"/>
|
88
|
+
<% end %>
|
89
|
+
</entry>
|
90
|
+
<% end %>
|
91
|
+
</feed>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.service('xmlns:atom' => 'http://www.w3.org/2005/Atom',
|
3
|
+
'xmlns:cmis' => 'http://docs.oasis-open.org/ns/cmis/core/200908/',
|
4
|
+
'xmlns:cmisra' => 'http://docs.oasis-open.org/ns/cmis/restatom/200908/',
|
5
|
+
'xmlns' => 'http://www.w3.org/2007/app',
|
6
|
+
'xmlns:app' => 'http://www.w3.org/2007/app') do
|
7
|
+
|
8
|
+
xml<<yield
|
9
|
+
|
10
|
+
end
|