]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/config.pm
adding the "publishing" interface section of the Storage server
[Evergreen.git] / Open-ILS / src / perlmods / OpenILS / Application / Storage / Publisher / config.pm
1 package OpenILS::Application::Storage::Publisher::config;
2 use base qw/OpenILS::Application::Storage/;
3 use OpenILS::Application::Storage::CDBI::config;
4
5 sub getBiblioFieldMaps {
6         my $self = shift;
7         my $client = shift;
8         my $id = shift;
9         $log->debug(" Executing [".$self->method."] as [".$self->api_name."]",INTERNAL);
10         
11         if ($self->api_name =~ /by_class$/o) {
12                 if ($id) {
13                         return $self->_cdbi2Hash( config::metarecord_field_map->search( fieldclass => $id ) );
14                 } else {
15                         throw OpenSRF::EX::InvalidArg ('Please give me a Class to look up!');
16                 }
17         } else {
18                 if ($id) {
19                         return $self->_cdbi2Hash( config::metarecord_field_map->retrieve( $id ) );
20                 } else {
21                         return $self->_cdbi_list2AoH( config::metarecord_field_map->retrieve_all );
22                 }
23         }
24 }       
25 __PACKAGE__->register_method(
26         method          => 'getBiblioFieldMaps',
27         api_name        => 'open-ils.storage.config.metarecord_field',
28         argc            => 1,
29 );
30 __PACKAGE__->register_method(
31         method          => 'getBiblioFieldMaps',
32         api_name        => 'open-ils.storage.config.metarecord_field.all',
33         argc            => 0,
34 );
35 __PACKAGE__->register_method(
36         method          => 'getBiblioFieldMaps',
37         api_name        => 'open-ils.storage.config.metarecord_field.list.by_class',
38         argc            => 1,
39 );
40
41
42 sub getBiblioFieldMapClasses {
43         my $self = shift;
44         my $client = shift;
45         my @ids = shift;
46
47         $log->debug(" Executing [".$self->method."] as [".$self->api_name."]",INTERNAL);
48
49         if ($self->api_name =~ /all/o) {
50                 return $self->_cdbi_list2AoH( config::metarecord_field_class_map->retrieve_all );
51         } else {
52                 for my $id (@ids) {
53                         next unless ($id);
54                         $client->respond( $self->_cdbi2Hash( config::metarecord_field_class_map->retrieve( $id ) ) );
55                         last unless ($self->api_name =~ /list/o);
56                 } 
57                 return undef;
58         }
59 }       
60 __PACKAGE__->register_method(
61         method          => 'getBiblioFieldMapClasses',
62         api_name        => 'open-ils.storage.config.metarecord_field_class',
63         argc            => 1,
64 );
65
66 __PACKAGE__->register_method(
67         method          => 'getBiblioFieldMapClasses',
68         api_name        => 'open-ils.storage.config.metarecord_field_class.list',
69         argc            => 1,
70         stream          => 1,
71 );
72 __PACKAGE__->register_method(
73         method          => 'getBiblioFieldMapClasses',
74         api_name        => 'open-ils.storage.config.metarecord_field_class.all',
75         argc            => 0,
76 );
77
78 1;