]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
commit just returns true or null
[Evergreen.git] / Open-ILS / src / perlmods / OpenILS / Application / Cat.pm
1 use strict; use warnings;
2 package OpenILS::Application::Cat;
3 use OpenSRF::Application;
4 use OpenILS::Application::Cat::Utils;
5 use base qw/OpenSRF::Application/;
6 use Time::HiRes qw(time);
7 use JSON;
8 use OpenILS::Utils::Fieldmapper;
9
10 my $utils = "OpenILS::Application::Cat::Utils";
11
12 sub child_init {
13         OpenSRF::Application->method_lookup( "blah" );
14 }
15
16
17 __PACKAGE__->register_method(
18         method  => "biblio_record_tree_retrieve",
19         api_name        => "open-ils.cat.biblio.record.tree.retrieve",
20         argc            => 1, 
21         note            => "Returns the tree associated with the nodeset of the given doc id"
22 );
23
24 sub biblio_record_tree_retrieve {
25         my( $self, $client, $recordid ) = @_;
26
27         my $name = "open-ils.storage.biblio.record_entry.nodeset.retrieve";
28         my $method = $self->method_lookup($name);
29
30         unless($method) {
31                 throw OpenSRF::EX::PANIC ("Could not lookup method $name");
32         }
33
34         my ($nodes) = $method->run($recordid);
35
36         if(UNIVERSAL::isa($nodes,"OpenSRF::EX")) {
37                 throw $nodes;
38         }
39
40         return undef unless $nodes;
41         my $tree = $utils->nodeset2tree( $nodes );
42         return $tree;
43 }
44
45
46 __PACKAGE__->register_method(
47         method  => "biblio_record_tree_commit",
48         api_name        => "open-ils.cat.biblio.record.tree.commit",
49         argc            => 1, 
50         note            => "Walks the tree and commits any changed nodes " .
51                                         "adds any new nodes, and deletes any deleted nodes",
52 );
53
54 sub biblio_record_tree_commit {
55         my( $self, $client, $tree ) = @_;
56         my $nodeset = $utils->tree2nodeset($tree);
57         return $utils->commit_nodeset( $nodeset );
58 }
59
60
61
62
63 1;