Also deprecated
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 22 Aug 2008 20:33:19 +0000 (20:33 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 22 Aug 2008 20:33:19 +0000 (20:33 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10414 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/src/perlmods/Evergreen/Application/Search/AddedContent/ContentCafe.pm [deleted file]

diff --git a/Evergreen/src/perlmods/Evergreen/Application/Search/AddedContent/ContentCafe.pm b/Evergreen/src/perlmods/Evergreen/Application/Search/AddedContent/ContentCafe.pm
deleted file mode 100644 (file)
index 545117b..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-package Evergreen::Application::Search::AddedContent::ContentCafe;
-use base qw/OpenSRF::Application/;
-use strict; use warnings;
-use OpenILS::Application::AppUtils;
-use OpenSRF::Utils::SettingsClient;
-my $apputils = "OpenILS::Application::AppUtils";
-use XML::LibXML;
-use LWP::UserAgent;
-use OpenSRF::EX qw(:try);
-
-my $host;
-my $username;
-my $password;
-my $enabled = 0;
-my $urlbase = "ContentCafe";
-my $types = {
-       toc                     => "TOC.asmx",
-       review          => "Review.asmx",
-       annotation      => "Annotation.asmx",
-       member          => "Member.asmx",
-       };
-
-sub initialize {
-       my $conf = OpenSRF::Utils::SettingsClient->new;
-       $host = $conf->config_value(                                    
-               "apps", "open-ils.search","app_settings", "added_content", "host");
-       $username = $conf->config_value(                                        
-               "apps", "open-ils.search","app_settings", "added_content", "username");
-       $password = $conf->config_value(                                        
-               "apps", "open-ils.search","app_settings", "added_content", "password");
-
-       $enabled = 1 if ($host and $username and $password);
-}
-
-
-
-# Fetches the added content and returns the data as a string.
-# If not data is retrieved (or timeout occurs), undef is returned
-sub retrieve_added_content {
-       my( $type, $isbn, $summary ) = @_;
-       return undef unless ( $isbn && $isbn ne "" );
-
-       my $func = "fnDetailByItemKey";
-       if($summary) { $func = "fnContentByItemKey"; }
-
-       my $url = "$host/$urlbase/" . $types->{$type} . 
-               "/$func?UserId=$username&Password=$password&ItemKey=$isbn";
-
-
-       warn "Added Content URL: $url\n";
-
-       my $data = undef;
-       try {
-               alarm(15);
-               $data = LWP::UserAgent->new->get($url)->content;
-               alarm(0);
-       } catch Error with {
-               alarm(0);
-       };
-       alarm(0);
-
-#      warn "received content data:\n$data\n";
-       return $data;
-}
-
-__PACKAGE__->register_method(
-       method  => "summary",
-       api_name        => "open-ils.search.added_content.summary.retrieve",
-       notes           => <<"  NOTE");
-               Returns an object like so:
-                       {
-                               Review : true/false,
-                               Inventory : true/false,
-                               Annotation : true/false,
-                               Jacket : true/false
-                               TOC : true/false
-                               Product : true/false
-                       }
-               This object indicates the existance of each type of added content for the given ISBN
-               PARAMS( ISBN ),
-       NOTE
-
-sub summary {
-       my( $self, $client, $isbn ) = @_;
-
-       if(!$enabled) {
-               return { 
-                       Review          => "false",
-                       Inventory       => "false",
-                       Annotation      => "false",
-                       Jacket          => "false",
-                       TOC                     => "false",
-                       Product         => "false",
-               };
-       }
-
-       my $data = retrieve_added_content( "member", $isbn, 1 );
-       return {} unless $data;
-       my $doc;
-       try {
-               $doc = XML::LibXML->new->parse_string($data);
-       } catch Error with { $doc = undef };
-
-       my $summary = {};
-       return $summary unless $doc;
-
-       for my $node ( $doc->getDocumentElement->childNodes ) {
-               if( $node->localName ) {
-                       $summary->{$node->localName} = $node->textContent;      
-               }
-       }
-       return $summary;
-}
-
-
-
-
-
-__PACKAGE__->register_method(
-       method  => "reviews",
-       api_name        => "open-ils.search.added_content.review.retrieve.random",
-       notes           => <<"  NOTE");
-               Returns a singe random review article object
-               PARAMS( ISBN ),
-       NOTE
-
-__PACKAGE__->register_method(
-       method  => "reviews",
-       api_name        => "open-ils.search.added_content.review.retrieve.all",
-       notes           => <<"  NOTE");
-               Returns an array review article objects
-               PARAMS( ISBN ),
-       NOTE
-
-sub reviews {
-       my( $self, $client, $isbn ) = @_;
-
-       my $ret = [];
-       return $ret unless $enabled;
-       my $data = retrieve_added_content( "review", $isbn );
-       return $ret unless $data;
-
-       my $doc;
-       try {
-               $doc = XML::LibXML->new->parse_string($data);
-       } catch Error with { $doc = undef };
-
-
-       if(!$doc) {
-               if( $self->api_name =~ /random/ ) { return undef; }
-               return $ret;
-       }
-
-       my $reviews = $doc->findnodes("//*[local-name()='Review']");
-
-       for my $rev ( $reviews->get_nodelist() ) {
-               my $revobj = {};
-               for my $node ($rev->childNodes) {
-
-                       if( $node->localName ) {
-                               if( $node->localName eq "ReviewText" ) {
-                                       $revobj ->{'text'} = $node->textContent;
-                               }
-                               if( $node->localName eq "ReviewLiteral" ) {
-                                       $revobj->{'info'} = $node->textContent;
-                               }
-
-                       }
-               }
-
-               if( $self->api_name =~ /random/ ) { return $revobj; }
-               push( @$ret, $revobj );
-       }
-
-       return $ret;
-}
-
-
-__PACKAGE__->register_method(
-       method  => "toc",
-       api_name        => "open-ils.search.added_content.toc.retrieve",
-       notes           => <<"  NOTE");
-               Returns the table of contents for the given ISBN
-               PARAMS( ISBN ),
-       NOTE
-
-sub toc {
-       my( $self, $client, $isbn ) = @_;
-
-       my $data = retrieve_added_content( "toc", $isbn );
-       return undef unless $data;
-
-       my $doc;
-       try {
-               $doc = XML::LibXML->new->parse_string($data);
-       } catch Error with { $doc = undef };
-
-
-       my @nodes =  $doc->findnodes("//*[local-name()='TOCText']")->get_nodelist();
-               
-       if($nodes[0]) {
-               return $nodes[0]->textContent;
-       }
-
-       return "";
-}
-
-
-1;