From a3c5354012d776264aff37f217e8733646319339 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 11 Mar 2008 16:49:55 +0000 Subject: [PATCH] generate methods after loading the IDL git-svn-id: svn://svn.open-ils.org/ILS/trunk@8970 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/PermaCrud.pm | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/PermaCrud.pm b/Open-ILS/src/perlmods/OpenILS/Application/PermaCrud.pm index 173287cb32..14bc8c40e1 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/PermaCrud.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/PermaCrud.pm @@ -46,6 +46,8 @@ sub initialize { $idl = $parser->parse_file( $idl_file ); $log->debug( 'IDL XML file loaded' ); + + generate_methods(); } sub child_init {} @@ -169,31 +171,32 @@ sub search_permacrud { return undef; } -for my $class_node ( $xpc->findnodes( '//idl:class[perm:permacrud]', $idl->documentElement ) ) { - my $hint = $class_node->getAttribute('id'); - - for my $action_node ( $xpc->findnodes( "perm:permacrud/perm:actions/perm:*", $class_node ) ) { - my $method = $action_node->localname =~ s/^.+:(.+)$/$1/o; - - __PACKAGE__->register_method( - method => 'CRUD_action_object_permcheck', - api_name => 'open-ils.permacrud.' . $method . '.' . $hint, - authoritative => 1, - class_hint => $hint, - ); - - if ($method eq 'retrieve') { +sub generate_methods { + for my $class_node ( $xpc->findnodes( '//idl:class[perm:permacrud]', $idl->documentElement ) ) { + my $hint = $class_node->getAttribute('id'); + + for my $action_node ( $xpc->findnodes( "perm:permacrud/perm:actions/perm:*", $class_node ) ) { + my $method = $action_node->localname =~ s/^.+:(.+)$/$1/o; + __PACKAGE__->register_method( - method => 'search_permcheck', - api_name => 'open-ils.permacrud.search.' . $hint, - class_hint => $hint, - retriever => 'open-ils.permacrud.retrieve.' . $hint, - stream => 1 + method => 'CRUD_action_object_permcheck', + api_name => 'open-ils.permacrud.' . $method . '.' . $hint, + authoritative => 1, + class_hint => $hint, ); + + if ($method eq 'retrieve') { + __PACKAGE__->register_method( + method => 'search_permcheck', + api_name => 'open-ils.permacrud.search.' . $hint, + class_hint => $hint, + retriever => 'open-ils.permacrud.retrieve.' . $hint, + stream => 1 + ); + } } } } - 1; -- 2.43.2