From: miker Date: Wed, 8 Nov 2006 19:57:58 +0000 (+0000) Subject: make it streaming for the gigantor record case X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=813f8690816f47dac7471ab29f79389fa3d258f8;p=evergreen%2Fpines.git make it streaming for the gigantor record case git-svn-id: svn://svn.open-ils.org/ILS/trunk@6569 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index 81daf3b02f..e9afe9d9d8 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -350,7 +350,7 @@ sub new_record_holdings { $year += 1900; $month += 1; - my $xml = ""; + $client->respond(""); for my $cn (@{$tree->call_numbers}) { @@ -358,6 +358,7 @@ sub new_record_holdings { for my $c (@{$cn->copies}) { next unless grep {$c->circ_lib->id == $_} @ou_ids; $found = 1; + last; } next unless $found; @@ -369,7 +370,7 @@ sub new_record_holdings { my $cn_label = $cn->label; - $xml .= ""; + my $xml = ""; for my $cp (@{$cn->copies}) { @@ -379,25 +380,22 @@ sub new_record_holdings { $cp_class =~ s/Fieldmapper-//gso; my $cp_tag = sprintf("tag:open-ils.org,$year-\%0.2d-\%0.2d:$cp_class/".$cp->id, $month, $day); - my $cp_stat = $cp->status->name; - - my $cp_loc = $cp->location->name; - - my $cp_lib = $cp->circ_lib->shortname; - - my $cp_bc = $cp->barcode; + my $cp_stat = escape($cp->status->name); + my $cp_loc = escape($cp->location->name); + my $cp_lib = escape($cp->circ_lib->shortname); + my $cp_bc = escape($cp->barcode); $xml .= "$cp_stat". - "$cp_loc$cp_lib"; + "$cp_loc$cp_lib"; - #if ($cp->notes) { - # for my $note ( @{$cp->notes} ) { - # next unless ( $sce->stat_cat->pub eq 't' ); - # $xml .= sprintf('%s',$note->create_date, escape($note->title), escape($note->value)); - # } - #} + if ($cp->notes) { + for my $note ( @{$cp->notes} ) { + next unless ( $note->pub eq 't' ); + $xml .= sprintf('%s',$note->create_date, escape($note->title), escape($note->value)); + } + } - $xml .= ""; + $xml .= ""; if ($cp->stat_cat_entries) { for my $sce ( @{$cp->stat_cat_entries} ) { @@ -410,17 +408,18 @@ sub new_record_holdings { } $xml .= ""; - } - $xml .= ""; + $client->respond($xml) + } - return $xml; + return ""; } __PACKAGE__->register_method( method => 'new_record_holdings', api_name => 'open-ils.supercat.record.holdings_xml.retrieve', api_level => 1, argc => 1, + stream => 1, signature => { desc => <<" DESC", Returns the XML representation of the requested bibliographic record's holdings @@ -432,7 +431,7 @@ Returns the XML representation of the requested bibliographic record's holdings type => 'number' }, ], 'return' => - { desc => 'The bib record holdings hierarchy in XML', + { desc => 'Stream of bib record holdings hierarchy in XML', type => 'string' } } ); diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm index d43e5f841e..8fa559319f 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm @@ -1180,8 +1180,13 @@ sub create_record_feed { my $node = $feed->add_item($xml); next unless $node; + $xml = ''; if ($lib && $type eq 'marcxml' && $flesh) { - $xml = $supercat->request( "open-ils.supercat.$search.holdings_xml.retrieve", $rec, $lib )->gather(1); + my $r = $supercat->request( "open-ils.supercat.$search.holdings_xml.retrieve", $rec, $lib ); + while ( !$r->complete ) { + $xml .= join('', map {$_->content} $r->recv); + } + $xml .= join('', map {$_->content} $r->recv); $node->add_holdings($xml); }