Sha256: 4027d1936b36c88430f2cf4d0bc92d50f51a2a5707a4d977f8db87dcc01cb382

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

module FcrepoAdmin
  class ObjectsController < ApplicationController

    layout 'fcrepo_admin/objects'

    include FcrepoAdmin::Controller::ControllerBehavior

    before_filter :load_and_authorize_object
    
    def show
      respond_to do |format|
        format.html { load_solr_document }
        format.xml { render :xml => @object.object_xml }
      end
    end

    def audit_trail
      if @object.auditable?
        respond_to do |format|
          format.html
          format.xml { render :xml => @object.audit_trail.to_xml }
        end
      else
        render :text => I18n.t("fcrepo_admin.object.audit_trail.not_implemented"), :status => 404
      end
    end

    def solr
      render :xml => raw_solr_response
    end

    def permissions
    end

    protected

    def load_solr_document
      @document = SolrDocument.new(ActiveFedora::SolrService.query(solr_document_query).first, nil)
    end

    def raw_solr_response
      ActiveFedora::SolrService.query(solr_document_query, raw: true, wt: 'xml')
    end

    def solr_document_query
      ActiveFedora::SolrService.construct_query_for_pids([@object.pid])
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fcrepo_admin-0.6.1 app/controllers/fcrepo_admin/objects_controller.rb
fcrepo_admin-0.6.0 app/controllers/fcrepo_admin/objects_controller.rb