Class: CmisServer::AtomPub::UriTemplatesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- CmisServer::ApplicationController
- BaseController
- CmisServer::AtomPub::UriTemplatesController
- Includes:
- RepositoryScopable
- Defined in:
- app/controllers/cmis_server/atom_pub/uri_templates_controller.rb
Instance Method Summary collapse
Methods included from RepositoryScopable
Methods inherited from BaseController
#raw_post_body, #render_standard_error, #request_entry_parser
Methods inherited from CmisServer::ApplicationController
Instance Method Details
#object_by_id ⇒ Object
12 13 14 15 16 |
# File 'app/controllers/cmis_server/atom_pub/uri_templates_controller.rb', line 12 def object_by_id service = CmisServer::ObjectService.new(@repository, current_context) @object = service.get_object(params[:id], with_object: true, filter: @filter) render 'cmis_server/atom_pub/entries/object_entry', formats: :atom_entry end |
#object_by_path ⇒ Object
18 19 20 21 22 |
# File 'app/controllers/cmis_server/atom_pub/uri_templates_controller.rb', line 18 def object_by_path service = CmisServer::ObjectService.new(@repository, current_context) @object = service.get_object_by_path(params[:path], with_object: true, filter: @filter) render 'cmis_server/atom_pub/entries/object_entry', formats: :atom_entry end |
#query ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/cmis_server/atom_pub/uri_templates_controller.rb', line 30 def query if request.post? # POST query with XML/JSON body if request.content_type =~ /xml/ query_params = Hash.from_xml(raw_post_body)["query"].slice("statement", "searchAllVersions", "includeAllowableActions", "includeRelationships", "renditionFilter", "maxItems", "skipCount") else # JSON body query_params = JSON.parse(raw_post_body) end else # GET query with URL parameters query_params = params.slice(:statement, :searchAllVersions, :includeAllowableActions, :includeRelationships, :renditionFilter, :maxItems, :skipCount) end service = CmisServer::DiscoveryService.new(@repository, current_context) response = service.query(query_params['statement'] || query_params[:statement], search_all_versions: (query_params['searchAllVersions'] == 'true' || query_params[:searchAllVersions] == 'true'), rendition_filter: (query_params['renditionFilter'] || query_params[:renditionFilter] || 'cmis:none'), include_relationships: ((query_params['includeRelationships'] || query_params[:includeRelationships])&.to_sym || :none), include_allowable_actions: (query_params['includeAllowableActions'] == 'true' || query_params[:includeAllowableActions] == 'true'), max_items: ((query_params['maxItems'] || query_params[:maxItems]) || 10).to_i, skip_count: ((query_params['skipCount'] || query_params[:skipCount]) || 0).to_i ) @collection = CmisServer::RenderableCollection.new(base_object: nil, items: response[:query_results], atompub_properties: {title: "Query"}) render 'cmis_server/atom_pub/feeds/feed', formats: :atom_feed, status: :created end |
#type_by_id ⇒ Object
24 25 26 27 28 |
# File 'app/controllers/cmis_server/atom_pub/uri_templates_controller.rb', line 24 def type_by_id service = CmisServer::RepositoryService.new(@repository) @type = service.get_type_definition(params[:id]) render 'cmis_server/atom_pub/entries/type_entry', formats: :atom_entry end |