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