From 5a9ddedef305c0feca8b2ac1fd9f765bc09031c2 Mon Sep 17 00:00:00 2001
From: miker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Wed, 16 Jun 2010 19:21:48 +0000
Subject: [PATCH] add authority marcxml retrieve method, switch on record type

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16733 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 .../src/perlmods/OpenILS/Application/SuperCat.pm   | 33 ++++++++++++++++++++++
 Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm      |  4 ++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
index 47545a7a22..34857768bc 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
@@ -1351,6 +1351,39 @@ for my $t ( qw/biblio authority/ ) {
 }
 
 
+sub retrieve_authority_marcxml {
+	my $self = shift;
+	my $client = shift;
+	my $rid = shift;
+
+	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+
+	my $record = $_storage->request( 'open-ils.cstore.direct.authority.record_entry.retrieve' => $rid )->gather(1);
+	return $U->entityize( $record->marc ) if ($record);
+	return undef;
+}
+
+__PACKAGE__->register_method(
+	method    => 'retrieve_authority_marcxml',
+	api_name  => 'open-ils.supercat.authority.marcxml.retrieve',
+	api_level => 1,
+	argc      => 1,
+	signature =>
+		{ desc     => <<"		  DESC",
+Returns the MARCXML representation of the requested authority record
+		  DESC
+		  params   =>
+		  	[
+				{ name => 'authorityId',
+				  desc => 'An OpenILS authority::record_entry id',
+				  type => 'number' },
+			],
+		  'return' =>
+		  	{ desc => 'The authority record in MARCXML',
+			  type => 'string' }
+		}
+);
+
 sub retrieve_record_marcxml {
 	my $self = shift;
 	my $client = shift;
diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
index 3639b8a9df..3c6bd2cdf7 100644
--- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
+++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
@@ -163,7 +163,8 @@ sub child_init {
                 	my $site = shift;
 
 			$log->info("Creating record feed with params [$real_format, $record_list, $unapi, $site]");
-                	my $feed = create_record_feed( 'record', $real_format, $record_list, $unapi, $site, $real_format =~ /(-full|-uris)$/o ? 1 : 0 );
+                	my $bib_or_authority = $__a =~ /^authority/ ? 'authority' : 'record';
+                	my $feed = create_record_feed( $bib_or_authority, $real_format, $record_list, $unapi, $site, $real_format =~ /(-full|-uris)$/o ? 1 : 0 );
                 	$feed->root( "$base/../" );
                 	$feed->lib( $site );
                 	$feed->link( next => $next => $feed->type );
@@ -1328,6 +1329,7 @@ sub create_record_feed {
 
 		my $item_tag = "tag:$host,$year:biblio-record_entry/$rec/$lib";
 		$item_tag = "tag:$host,$year:isbn/$rec/$lib" if ($search eq 'isbn');
+		$item_tag = "tag:$host,$year:authorit-record_entry/$rec" if ($search eq 'authority');
 
 		my $xml = $supercat->request(
 			"open-ils.supercat.$search.$type.retrieve",
-- 
2.11.0