]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
updated to use Fieldmapper
[working/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
7 my $utils = "OpenILS::Application::Cat::Utils";
8
9
10
11
12 __PACKAGE__->register_method(
13         method  => "record_tree_retrieve",
14         api_name        => "open-ils.cat.record.tree.retrieve",
15         argc            => 1, 
16         note            => "Returns the tree associated with the nodeset of the given doc id"
17 );
18
19 sub record_tree_retrieve {
20         my( $self, $client, $recordid ) = @_;
21
22         my $name = "open-ils.storage.biblio.record_entry.nodeset.retrieve";
23         my $method = $self->method_lookup($name);
24
25         unless($method) {
26                 throw OpenSRF::EX::PANIC ("Could not lookup method $name");
27         }
28
29         my ($nodes) = $method->run($recordid);
30
31         if(UNIVERSAL::isa($nodes,"OpenSRF::EX")) {
32                 throw $nodes;
33         }
34
35         return undef unless $nodes;
36
37         return $utils->nodeset2tree( $nodes );
38 }
39
40
41 __PACKAGE__->register_method(
42         method  => "record_tree_commit",
43         api_name        => "open-ils.cat.record.tree.commit",
44         argc            => 1, 
45         note            => "Walks the tree and commits any changed nodes " .
46                                         "adds any new nodes, and deletes any deleted nodes",
47 );
48
49 sub record_tree_commit {
50         my( $self, $client, $tree ) = @_;
51         my $nodeset = $utils->tree2nodeset($tree);
52         $utils->commit_nodeset( $nodeset );
53         return $nodeset;
54 }
55
56
57
58 1;