return [ map { ($U->is_true($_->location->opac_visible) && $U->is_true($_->status->opac_visible)) ? ($_->id) : () } @$copies ];
}
+__PACKAGE__->register_method(
+ method => "unapi_records",
+ api_name => "open-ils.search.unapi.bre",
+ stream => 1,
+ # TODO
+);
+
+__PACKAGE__->register_method(
+ method => "unapi_records",
+ api_name => "open-ils.search.unapi.mmr",
+ stream => 1,
+ # TODO
+);
+
+sub unapi_records {
+ my ($self, $client, $rec_id, $unapi_args) = @_;
+
+ my $rec_ids = ref $rec_id eq 'ARRAY' ? $rec_id : [$rec_id];
+
+ $unapi_args ||= {};
+ $unapi_args->{site} ||= $U->get_org_tree->shortname;
+ $unapi_args->{flesh} ||= '{bre}'; # default to just the record
+ $unapi_args->{flesh_depth} ||= 5;
+ $unapi_args->{flesh_limit} ||= '';
+ $unapi_args->{format} ||= 'marcxml';
+ $unapi_args->{ename} ||= 'record';
+
+ my $unapi_type =
+ ($self->api_name =~ /bre/) ? 'unapi.bre' : 'unapi.mmr';
+
+ my $e = new_editor;
+ for my $id (@$rec_ids) {
+ $client->respond(
+ $e->json_query({
+ from => [
+ $unapi_type,
+ $id,
+ $unapi_args->{format},
+ $unapi_args->{ename},
+ $unapi_args->{flesh},
+ $unapi_args->{site},
+ $unapi_args->{depth},
+ $unapi_args->{flesh_limit},
+ $unapi_args->{flesh_offset},
+ $unapi_args->{inc_xmlns},
+ $unapi_args->{pref_lib}
+ ]
+ })->[0]
+ );
+ }
+
+ return undef;
+}
+
1;
my $outer_self = $self;
$self->timelog("get_records_and_facets(): about to call multisession");
my $ses = OpenSRF::MultiSession->new(
- app => 'open-ils.cstore',
+ app => 'open-ils.search',
cap => 10, # XXX config
success_handler => sub {
my($self, $req) = @_;
# tag the record with the MR id
$flesh =~ s/}$/,mmr.unapi}/g if $is_meta;
+ my $method = $is_meta ?
+ 'open-ils.search.unapi.mmr' :
+ 'open-ils.search.unapi.bre';
+
$ses->request(
- 'open-ils.cstore.json_query',
- {from => [
- $unapi_type, $bid, 'marcxml','record', $flesh,
- $unapi_args->{site},
- $unapi_args->{depth},
- $slimit,
- undef, undef, $unapi_args->{pref_lib}
- ]}
+ $method, $bid, {
+ flesh => $flesh,
+ site => $unapi_args->{site},
+ depth => $unapi_args->{depth},
+ flesh_limit => $slimit,
+ pref_lib => $unapi_args->{pref_lib}
+ }
);
}
}