1 package OpenILS::Application::Storage::Publisher;
2 use base qw/OpenILS::Application::Storage/;
5 use OpenSRF::Utils::Logger;
6 my $log = 'OpenSRF::Utils::Logger';
8 use OpenILS::Utils::Fieldmapper;
9 use OpenILS::Application::Storage::CDBI;
11 #use OpenILS::Application::Storage::CDBI::actor;
12 #use OpenILS::Application::Storage::CDBI::asset;
13 #use OpenILS::Application::Storage::CDBI::biblio;
14 #use OpenILS::Application::Storage::CDBI::config;
15 #use OpenILS::Application::Storage::CDBI::metabib;
17 use OpenILS::Application::Storage::Publisher::actor;
18 #use OpenILS::Application::Storage::Publisher::asset;
19 use OpenILS::Application::Storage::Publisher::biblio;
20 use OpenILS::Application::Storage::Publisher::config;
21 use OpenILS::Application::Storage::Publisher::metabib;
28 my $cdbi = $self->{cdbi};
32 my $rec = $cdbi->create($node);
46 my $cdbi = $self->{cdbi};
48 return $cdbi->update($node);
56 my $cdbi = $self->{cdbi};
72 my $cdbi = $self->{cdbi};
73 my $api_name = $self->api_name;
74 (my $single_call_api_name = $api_name) =~ s/batch\.//o;
76 $log->debug("Default $api_name looking up $single_call_api_name...",INTERNAL);
77 my $method = $self->method_lookup($single_call_api_name);
80 while ( my $node = shift(@nodes) ) {
81 my ($res) = $method->run( $node );
82 push(@success, 1) if ($res >= 0);
86 $insert_total += $_ for (@success);
91 for my $fmclass ( Fieldmapper->classes ) {
92 (my $cdbi = $fmclass) =~ s/^Fieldmapper:://o;
93 (my $class = $cdbi) =~ s/::.*//o;
94 (my $api_class = $cdbi) =~ s/::/./go;
95 my $registration_class = __PACKAGE__ . "::$class";
96 my $api_prefix = 'open-ils.storage.'.$api_class;
98 # Create the create method
99 unless ( __PACKAGE__->is_registered( $api_prefix.'.create' ) ) {
100 __PACKAGE__->register_method(
101 api_name => $api_prefix.'.create',
102 method => 'create_node',
108 # Create the batch create method
109 unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.create' ) ) {
110 __PACKAGE__->register_method(
111 api_name => $api_prefix.'.batch.create',
112 method => 'batch_call',
118 # Create the update method
119 unless ( __PACKAGE__->is_registered( $api_prefix.'.update' ) ) {
120 __PACKAGE__->register_method(
121 api_name => $api_prefix.'.update',
122 method => 'update_node',
128 # Create the batch update method
129 unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.update' ) ) {
130 __PACKAGE__->register_method(
131 api_name => $api_prefix.'.batch.update',
132 method => 'batch_call',
138 # Create the delete method
139 unless ( __PACKAGE__->is_registered( $api_prefix.'.delete' ) ) {
140 __PACKAGE__->register_method(
141 api_name => $api_prefix.'.delete',
142 method => 'delete_node',
148 # Create the batch delete method
149 unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.delete' ) ) {
150 __PACKAGE__->register_method(
151 api_name => $api_prefix.'.batch.delete',
152 method => 'batch_call',