[open-ils-commits] [GIT] Evergreen ILS branch master updated. 18eb592b77d1ce42c2e0e32c8a393d9ea7779fba

Evergreen Git git at git.evergreen-ils.org
Fri Dec 16 15:25:38 EST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  18eb592b77d1ce42c2e0e32c8a393d9ea7779fba (commit)
      from  f18da3a7a00951e80c131be8c8486e8a28bc323d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 18eb592b77d1ce42c2e0e32c8a393d9ea7779fba
Author: Jason Stephenson <jason at sigio.com>
Date:   Sat Dec 10 20:28:48 2011 -0500

    Add class_for_hint function to OpenILS::Utils::Fieldmapper.
    
    Use this function to find a Fieldmapper class from the JSON hint or
    class id:
    
    my $class = Fieldmapper::class_for_hint('au');
    print("$class\n");
    
    Will print:
    
    Fieldmapper::actor::user
    
    Signed-off-by: Jason Stephenson <jason at sigio.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm
index e1bebb7..df00277 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm
@@ -37,6 +37,15 @@ sub classes {
 	return keys %$fieldmap;
 }
 
+# Find a Fieldmapper class given the json hint.
+sub class_for_hint {
+    my $hint = shift;
+    foreach (keys %$fieldmap) {
+        return $_ if ($fieldmap->{$_}->{hint} eq $hint);
+    }
+    return undef;
+}
+
 sub get_attribute {
 	my $attr_list = shift;
 	my $attr_name = shift;

-----------------------------------------------------------------------

Summary of changes:
 .../src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm  |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list