tons of storage server changes... see diffs
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Apr 2005 18:41:10 +0000 (18:41 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Apr 2005 18:41:10 +0000 (18:41 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@447 dcc99617-32d9-48b4-a31d-7c20da2025e4

20 files changed:
Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
Open-ILS/src/perlmods/OpenILS/Application/Auth.pm
Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm [new file with mode: 0644]
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/biblio.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/config.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/metabib.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm [new file with mode: 0644]
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm [new file with mode: 0644]
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/config.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/WORM.pm

index bb5e321..74fcfde 100644 (file)
@@ -134,7 +134,7 @@ sub get_org_tree {
        my $self = shift;
 
        my $orglist = $self->simple_scalar_request( 
-                       "open-ils.storage", "open-ils.storage.actor.org_unit_list" );
+                       "open-ils.storage", "open-ils.storage.direct.actor.org_unit_list" );
 
        return $self->build_org_tree($orglist);
 
index 7a51569..e1071a9 100644 (file)
@@ -108,7 +108,7 @@ sub init_authenticate {
 sub complete_authenticate {
        my( $self, $client, $username, $passwdhash ) = @_;
 
-       my $name = "open-ils.storage.actor.user.search.usrname";
+       my $name = "open-ils.storage.direct.actor.user.search.usrname";
 
        my $session = OpenSRF::AppSession->create("open-ils.storage");
        my $request = $session->request( $name, $username );
index 1db1c32..91fcb5d 100644 (file)
@@ -31,7 +31,7 @@ sub biblio_record_tree_retrieve {
 
        my( $self, $client, $recordid ) = @_;
 
-       my $name = "open-ils.storage.biblio.record_marc.retrieve";
+       my $name = "open-ils.storage.direct.biblio.record_marc.retrieve";
        my $session = OpenSRF::AppSession->create( "open-ils.storage" );
        my $request = $session->request( $name, $recordid );
        $request->wait_complete;
@@ -120,7 +120,7 @@ sub biblio_record_tree_commit {
        OpenILS::Application::AppUtils->rollback_db_session($session) unless $x;
 
        warn "Sending updated doc $docid to db\n";
-       my $req = $session->request( "open-ils.storage.biblio.record_marc.update", $biblio );
+       my $req = $session->request( "open-ils.storage.direct.biblio.record_marc.update", $biblio );
 
        $req->wait_complete;
        my $status = $req->recv();
@@ -206,7 +206,7 @@ sub biblio_record_record_metadata {
 
        my $session = OpenSRF::AppSession->create("open-ils.storage");
        my $request = $session->request( 
-                       "open-ils.storage.biblio.record_entry.batch.retrieve", @ids );
+                       "open-ils.storage.direct.biblio.record_entry.batch.retrieve", @ids );
 
        my $results = [];
 
@@ -249,7 +249,7 @@ sub _get_userid_by_id {
 
        my $session = OpenSRF::AppSession->create( "open-ils.storage" );
        my $request = $session->request( 
-               "open-ils.storage.actor.user.batch.retrieve.atomic", @ids );
+               "open-ils.storage.direct.actor.user.batch.retrieve.atomic", @ids );
 
        $request->wait_complete;
        my $response = $request->recv();
@@ -271,7 +271,7 @@ sub _get_userid_by_id {
        return @users;
 }
 
-# open-ils.storage.actor.user.search.usrid
+# open-ils.storage.direct.actor.user.search.usrid
 
 sub _get_id_by_userid {
 
@@ -280,7 +280,7 @@ sub _get_id_by_userid {
 
        my $session = OpenSRF::AppSession->create( "open-ils.storage" );
        my $request = $session->request( 
-               "open-ils.storage.actor.user.search.usrid", @users );
+               "open-ils.storage.direct.actor.user.search.usrid", @users );
 
        $request->wait_complete;
        my $response = $request->recv();
@@ -321,7 +321,7 @@ sub _update_record_metadata {
                # grab the meta information  and update it
                my $user_session = OpenSRF::AppSession->create("open-ils.storage");
                my $user_request = $user_session->request( 
-                       "open-ils.storage.biblio.record_entry.retrieve", $docid );
+                       "open-ils.storage.direct.biblio.record_entry.retrieve", $docid );
                $user_request->wait_complete;
                my $meta = $user_request->recv();
 
@@ -345,7 +345,7 @@ sub _update_record_metadata {
                warn "Grabbed the record, updating and moving on\n";
 
                my $request = $session->request( 
-                       "open-ils.storage.biblio.record_entry.update", $meta );
+                       "open-ils.storage.direct.biblio.record_entry.update", $meta );
 
                my $response = $request->recv();
                if(!$response) { 
@@ -396,7 +396,7 @@ sub retrieve_copies {
        # ------------------------------------------------------
        # grab the short name of the library location
        my $request = $session->request( 
-                       "open-ils.storage.actor.org_unit.retrieve", $home_ou );
+                       "open-ils.storage.direct.actor.org_unit.retrieve", $home_ou );
 
        my $org_unit = $request->recv();
        if(!$org_unit) {
@@ -416,7 +416,7 @@ sub retrieve_copies {
 
 
        $request = $session->request( 
-                       "open-ils.storage.asset.call_number.search", $search_hash );
+                       "open-ils.storage.direct.asset.call_number.search", $search_hash );
 
        my $volume;
        my @volume_ids;
@@ -431,7 +431,7 @@ sub retrieve_copies {
                warn "Grabbing copies for volume: " . $volume->id . "\n";
                my $copies = 
                        OpenILS::Application::AppUtils->simple_scalar_request( "open-ils.storage", 
-                               "open-ils.storage.asset.copy.search.call_number", $volume->id );
+                               "open-ils.storage.direct.asset.copy.search.call_number", $volume->id );
 
                $volume->copies($copies);
 
@@ -474,7 +474,7 @@ sub retrieve_copies_global {
        # ------------------------------------------------------
        # grab all the volumes for the given record and location
        my $request = $session->request( 
-                       "open-ils.storage.asset.call_number.search.record", $docid );
+                       "open-ils.storage.direct.asset.call_number.search.record", $docid );
 
        my $volumes = $request->recv();
 
@@ -497,7 +497,7 @@ sub retrieve_copies_global {
        warn "Searching volumes @ii\n";
                
        $request = $session->request( 
-                       "open-ils.storage.asset.copy.search.call_number", keys %$vol_hash );
+                       "open-ils.storage.direct.asset.copy.search.call_number", keys %$vol_hash );
        
        while( my $copylist = $request->recv ) {
                
@@ -641,7 +641,7 @@ sub volume_tree_add {
                        $volume->label . " " . $volume->record . "\n";
 
                my $cn_req = $session->request( 
-                               'open-ils.storage.asset.call_number.search' =>
+                               'open-ils.storage.direct.asset.call_number.search' =>
                      {       owning_lib      => $volume->owning_lib,
                              label           => $volume->label,
                              record          => $volume->record,
@@ -676,7 +676,7 @@ sub volume_tree_add {
                        warn Dumper $volume;
 
                        my $request = $session->request( 
-                               "open-ils.storage.asset.call_number.create", $volume );
+                               "open-ils.storage.direct.asset.call_number.create", $volume );
 
                        warn "0\n";
                        my $response = $request->recv();
@@ -722,7 +722,7 @@ sub volume_tree_add {
                        warn Dumper $copy;
 
                        my $req = $session->request(
-                                       "open-ils.storage.asset.copy.create", $copy );
+                                       "open-ils.storage.direct.asset.copy.create", $copy );
                        my $resp = $req->recv();
 
                        if(!$resp || ! ref($resp) ) { 
@@ -793,7 +793,7 @@ sub volume_tree_delete {
                        warn "Deleting copy " . $copy->id . " from db\n";
 
                        my $req = $session->request(
-                                       "open-ils.storage.asset.copy.delete", $copy );
+                                       "open-ils.storage.direct.asset.copy.delete", $copy );
 
                        my $resp = $req->recv();
 
@@ -814,7 +814,7 @@ sub volume_tree_delete {
                warn "Deleting volume " . $volume->id . " from database\n";
 
                my $vol_req = $session->request(
-                               "open-ils.storage.asset.call_number.delete", $volume );
+                               "open-ils.storage.direct.asset.call_number.delete", $volume );
                my $vol_resp = $vol_req;
 
                if(!$vol_req->complete) {
index 99adc93..8667999 100644 (file)
@@ -59,6 +59,7 @@ sub child_init {
        );
 
        if (OpenILS::Application::Storage::CDBI->db_Main()) {
+               OpenILS::Application::Storage::WORM->child_init();
                $log->debug("Success initializing driver!", DEBUG);
                return 1;
        }
index 1ceda15..0ceb825 100644 (file)
@@ -271,7 +271,7 @@ sub import {
        return if ($VERSION);
        #-------------------------------------------------------------------------------
        actor::user->has_a( home_ou => 'actor::org_unit' );
-       #actor::org_unit->has_a( address => 'actor::address' );
+       actor::user->has_many( survey_responses => 'action::survey_response' );
        #-------------------------------------------------------------------------------
        actor::org_unit->has_many( users => 'actor::user' );
        actor::org_unit->has_a( parent_ou => 'actor::org_unit' );
@@ -280,13 +280,29 @@ sub import {
        #-------------------------------------------------------------------------------
 
        #-------------------------------------------------------------------------------
+       action::survey_response->has_a( usr => 'actor::user' );
+       action::survey_response->has_a( survey => 'action::survey' );
+       action::survey_response->has_a( question => 'action::survey_question' );
+       action::survey_response->has_a( answer => 'action::survey_answer' );
+       #-------------------------------------------------------------------------------
+       action::survey->has_many( questions => 'action::survey_question' );
+       action::survey->has_many( responses => 'action::survey_response' );
+       #-------------------------------------------------------------------------------
+       action::survey_question->has_a( survey => 'action::survey' );
+       action::survey_question->has_many( answers => 'action::survey_answer' );
+       action::survey_question->has_many( responses => 'action::survey_response' );
+       #-------------------------------------------------------------------------------
+       action::survey_answer->has_a( question => 'action::survey' );
+       action::survey_answer->has_many( responses => 'action::survey_response' );
+       #-------------------------------------------------------------------------------
+
+       #-------------------------------------------------------------------------------
        asset::copy_note->has_a( owning_copy => 'asset::copy' );
        #-------------------------------------------------------------------------------
        asset::copy->has_a( call_number => 'asset::call_number' );
        asset::copy->has_many( notes => 'asset::copy_note' );
        asset::copy->has_a( creator => 'actor::user' );
        asset::copy->has_a( editor => 'actor::user' );
-       #asset::copy->might_have( metadata => 'asset::copy_metadata' );
        #-------------------------------------------------------------------------------
        asset::call_number_note->has_a( owning_call_number => 'asset::call_number' );
        #-------------------------------------------------------------------------------
@@ -301,52 +317,46 @@ sub import {
        #-------------------------------------------------------------------------------
        biblio::record_note->has_a( record => 'biblio::record_entry' );
        #-------------------------------------------------------------------------------
-       biblio::record_mods->is_a( id => 'biblio::record_entry' );
-       #-------------------------------------------------------------------------------
        biblio::record_marc->is_a( id => 'biblio::record_entry' );
        #-------------------------------------------------------------------------------
        biblio::record_entry->has_a( creator => 'actor::user' );
        biblio::record_entry->has_a( editor => 'actor::user' );
-       biblio::record_entry->might_have( mods_entry => 'biblio::record_mods' => qw/mods/ );
        biblio::record_entry->might_have( marc_entry => 'biblio::record_marc' => qw/marc/ );
+       biblio::record_entry->has_many( record_descriptor => 'metabib::record_descriptor' );
        biblio::record_entry->has_many( notes => 'biblio::record_note' );
-       biblio::record_entry->has_many( nodes => 'biblio::record_node', { order_by => 'intra_doc_id' } );
        biblio::record_entry->has_many( call_numbers => 'asset::call_number' );
        
        # should we have just one field entry per class for each record???? (xslt vs xpath)
-       #biblio::record_entry->has_a( item_type => 'config::item_type_map' );
+       biblio::record_entry->has_many( full_record_entries => 'metabib::full_rec' );
        biblio::record_entry->has_many( title_field_entries => 'metabib::title_field_entry' );
        biblio::record_entry->has_many( author_field_entries => 'metabib::author_field_entry' );
        biblio::record_entry->has_many( subject_field_entries => 'metabib::subject_field_entry' );
        biblio::record_entry->has_many( keyword_field_entries => 'metabib::keyword_field_entry' );
        #-------------------------------------------------------------------------------
-       biblio::record_node->has_a( owner_doc => 'biblio::record_entry' );
-       #biblio::record_node->has_a(
-       #       parent_node     => 'biblio::record_node::subnode',
-       #       inflate         => sub { return biblio::record_node::subnode::_load(@_) }
-       #);
-       #-------------------------------------------------------------------------------
-       
-       #-------------------------------------------------------------------------------
-       metabib::full_rec->has_a( record => 'biblio::record_entry' );
+
+
        #-------------------------------------------------------------------------------
        metabib::metarecord->has_a( master_record => 'biblio::record_entry' );
        metabib::metarecord->has_many( source_records => [ 'metabib::metarecord_source_map' => 'source'] );
        #-------------------------------------------------------------------------------
-       metabib::title_field_entry->has_many( source_records => [ 'metabib::title_field_entry_source_map' => 'source'] );
+       metabib::record_descriptor->has_a( record => 'biblio::record_entry' );
+       #-------------------------------------------------------------------------------
+       metabib::full_rec->has_a( record => 'biblio::record_entry' );
+       #-------------------------------------------------------------------------------
+       metabib::title_field_entry->has_a( source => 'biblio::record_entry' );
        metabib::title_field_entry->has_a( field => 'config::metabib_field' );
        #-------------------------------------------------------------------------------
-       metabib::author_field_entry->has_many( source_records => [ 'metabib::author_field_entry_source_map' => 'source'] );
+       metabib::author_field_entry->has_a( source => 'biblio::record_entry' );
        metabib::author_field_entry->has_a( field => 'config::metabib_field' );
        #-------------------------------------------------------------------------------
-       metabib::subject_field_entry->has_many( source_records => [ 'metabib::title_field_entry_source_map' => 'source'] );
+       metabib::subject_field_entry->has_a( source => 'biblio::record_entry' );
        metabib::subject_field_entry->has_a( field => 'config::metabib_field' );
        #-------------------------------------------------------------------------------
-       metabib::keyword_field_entry->has_many( source_records => [ 'metabib::keyword_field_entry_source_map' => 'source'] );
+       metabib::keyword_field_entry->has_a( source => 'biblio::record_entry' );
        metabib::keyword_field_entry->has_a( field => 'config::metabib_field' );
        #-------------------------------------------------------------------------------
        metabib::metarecord_source_map->has_a( metarecord => 'metabib::metarecord' );
-       metabib::metarecord_source_map->has_a( source_record => 'biblio::record_entry' );
+       metabib::metarecord_source_map->has_a( source => 'biblio::record_entry' );
        #-------------------------------------------------------------------------------
 
 
diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm
new file mode 100644 (file)
index 0000000..1db3517
--- /dev/null
@@ -0,0 +1,39 @@
+package OpenILS::Application::Storage::CDBI::action;
+our $VERSION = 1;
+
+#-------------------------------------------------------------------------------
+package action;
+use base qw/OpenILS::Application::Storage::CDBI/;
+#-------------------------------------------------------------------------------
+
+package action::survey;
+use base qw/action/;
+__PACKAGE__->table('action_survey');
+__PACKAGE__->columns(Primary => 'id');
+__PACKAGE__->columns(Essential => qw/name start_date end_date usr_summary opac/);
+#-------------------------------------------------------------------------------
+
+package action::survey_question;
+use base qw/action/;
+__PACKAGE__->table('action_survey_question');
+__PACKAGE__->columns(Primary => 'id');
+__PACKAGE__->columns(Essential => qw/survey question/);
+#-------------------------------------------------------------------------------
+
+
+package action::survey_answer;
+use base qw/action/;
+__PACKAGE__->table('action_survey_answer');
+__PACKAGE__->columns(Primary => 'id');
+__PACKAGE__->columns(Essential => qw/question answer/);
+#-------------------------------------------------------------------------------
+
+package action::survey_response;
+use base qw/action/;
+__PACKAGE__->table('action_survey_response');
+__PACKAGE__->columns(Primary => 'id');
+__PACKAGE__->columns(Essential => qw/usr survey question answer answer_date effective_date/);
+#-------------------------------------------------------------------------------
+
+1;
+
index 5cfc8af..886d0f4 100644 (file)
@@ -32,6 +32,38 @@ __PACKAGE__->columns( Primary => qw/id/);
 __PACKAGE__->columns( Others => qw/parent_ou ou_type address shortname name/);
 
 #-------------------------------------------------------------------------------
+package actor::stat_cat;
+use base qw/actor/;
+
+__PACKAGE__->table( 'actor_stat_cat' );
+__PACKAGE__->columns( Primary => qw/id/ );
+__PACKAGE__->columns( Others => qw/owner name opac_visible/ );
+
+#-------------------------------------------------------------------------------
+package actor::stat_cat_entry;
+use base qw/actor/;
+
+__PACKAGE__->table( 'actor_stat_cat_entry' );
+__PACKAGE__->columns( Primary => qw/id/ );
+__PACKAGE__->columns( Others => qw/owner value/ );
+
+#-------------------------------------------------------------------------------
+package actor::stat_cat_entry_user_map;
+use base qw/actor/;
+
+__PACKAGE__->table( 'actor_stat_cat_entry_usr_map' );
+__PACKAGE__->columns( Primary => qw/id/ );
+__PACKAGE__->columns( Others => qw/stat_cat_entry target_user/ );
+
+#-------------------------------------------------------------------------------
+package actor::card;
+use base qw/actor/;
+
+__PACKAGE__->table( 'actor_card' );
+__PACKAGE__->columns( Primary => qw/id/ );
+__PACKAGE__->columns( Others => qw/usr barcode active/ );
+
+#-------------------------------------------------------------------------------
 package actor::user_access_entry;
 use base qw/actor/;
 #-------------------------------------------------------------------------------
index d9bc764..10a161c 100644 (file)
@@ -16,7 +16,7 @@ __PACKAGE__->columns( Others => qw/record label creator create_date editor edit_
 package asset::call_number_note;
 use base qw/asset/;
 
-__PACKAGE__->table( 'asset_call_number' );
+__PACKAGE__->table( 'asset_call_number_note' );
 __PACKAGE__->columns( Primary => qw/id/ );
 __PACKAGE__->columns( Others => qw/owning_call_number title creator create_date value/ );
 
@@ -27,9 +27,33 @@ use base qw/asset/;
 __PACKAGE__->table( 'asset_copy' );
 __PACKAGE__->columns( Primary => qw/id/ );
 __PACKAGE__->columns( Others => qw/call_number barcode creator create_date editor
-                                  edit_date copy_number status home_lib loan_duration
+                                  edit_date copy_number available loan_duration
                                   fine_level circulate deposit price ref opac_visible
-                                  genre audience shelving_loc deposit_amount/ );
+                                  circ_as_type circ_modifier deposit_amount/ );
+
+#-------------------------------------------------------------------------------
+package asset::stat_cat;
+use base qw/asset/;
+
+__PACKAGE__->table( 'asset_stat_cat' );
+__PACKAGE__->columns( Primary => qw/id/ );
+__PACKAGE__->columns( Others => qw/owner name opac_visible/ );
+
+#-------------------------------------------------------------------------------
+package asset::stat_cat_entry;
+use base qw/asset/;
+
+__PACKAGE__->table( 'asset_stat_cat_entry' );
+__PACKAGE__->columns( Primary => qw/id/ );
+__PACKAGE__->columns( Others => qw/owner value/ );
+
+#-------------------------------------------------------------------------------
+package asset::stat_cat_entry_copy_map;
+use base qw/asset/;
+
+__PACKAGE__->table( 'asset_stat_cat_entry_copy_map' );
+__PACKAGE__->columns( Primary => qw/id/ );
+__PACKAGE__->columns( Others => qw/stat_cat stat_cat_entry owning_copy/ );
 
 #-------------------------------------------------------------------------------
 package asset::copy_note;
index a73e573..f40cc9a 100644 (file)
@@ -10,30 +10,32 @@ use base qw/biblio/;
 #use OpenILS::Application::Storage::CDBI::asset;
 
 biblio::record_entry->table( 'biblio_record_entry' );
-biblio::record_entry->columns( All => qw/id tcn_source tcn_value creator
-                                        editor create_date edit_date item_type
-                                        source active deleted last_xact_id/ );
+biblio::record_entry->columns( Primary         => 'id' );
+biblio::record_entry->columns( Essential       => qw/tcn_source tcn_value creator editor
+                                                     create_date edit_date source active
+                                                     deleted last_xact_id/ );
+biblio::record_entry->columns( Others          => qw/fingerprint/ );
 
 #-------------------------------------------------------------------------------
-package biblio::record_node::subnode;
-sub _load {
-       my $intra_doc_id = shift;
-       my $owner_doc = shift()->owner_doc;
-       return (biblio::record_node->search(
-                       owner_doc       => $owner_doc,
-                       intra_doc_id    => $intra_doc_id
-               )
-       )[0];
-}
-
-package biblio::record_node;
-use base qw/biblio/;
-
-biblio::record_node->table( 'biblio_record_data' );
-biblio::record_node->columns( All => qw/id owner_doc intra_doc_id
-                                       parent_node node_type
-                                       namespace_uri name value last_xact_id/ );
-
+#package biblio::record_node::subnode;
+#sub _load {
+#      my $intra_doc_id = shift;
+#      my $owner_doc = shift()->owner_doc;
+#      return (biblio::record_node->search(
+#                      owner_doc       => $owner_doc,
+#                      intra_doc_id    => $intra_doc_id
+#              )
+#      )[0];
+#}
+#
+#package biblio::record_node;
+#use base qw/biblio/;
+#
+#biblio::record_node->table( 'biblio_record_data' );
+#biblio::record_node->columns( All => qw/id owner_doc intra_doc_id
+#                                      parent_node node_type
+#                                      namespace_uri name value last_xact_id/ );
+#
 #biblio::record_node->has_a(
 #      parent_node     => 'biblio::record_node::subnode',
 #      inflate         => sub {
@@ -52,11 +54,11 @@ biblio::record_marc->columns( All => qw/id marc last_xact_id/ );
 #biblio::record_marc->is_a( id => qw/biblio::record_entry/ );
 
 #-------------------------------------------------------------------------------
-package biblio::record_mods;
-use base qw/biblio/;
+#package biblio::record_mods;
+#use base qw/biblio/;
 
-biblio::record_mods->table( 'biblio_record_mods' );
-biblio::record_mods->columns( All => qw/id mods/ );
+#biblio::record_mods->table( 'biblio_record_mods' );
+#biblio::record_mods->columns( All => qw/id mods/ );
 #biblio::record_mods->columns( Stringify => qw/mods/ );
 #biblio::record_mods->is_a( id => qw/biblio::record_entry/ );
 
index e659640..45a9e39 100644 (file)
@@ -5,12 +5,14 @@ our $VERSION = 1;
 package config;
 use base qw/OpenILS::Application::Storage::CDBI/;
 #-------------------------------------------------------------------------------
+
 package config::bib_source;
 use base qw/config/;
 __PACKAGE__->table('config_bib_source');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/quality source/);
 #-------------------------------------------------------------------------------
+
 package config::metabib_field;
 use base qw/config/;
 __PACKAGE__->table('config_metabib_field');
@@ -18,6 +20,14 @@ __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/field_class name xpath/);
 #-------------------------------------------------------------------------------
 
+package config::identification_type;
+use base qw/config/;
+__PACKAGE__->table('config_identifaction_type');
+__PACKAGE__->columns(Primary => 'id');
+__PACKAGE__->columns(Essential => qw/name/);
+#-------------------------------------------------------------------------------
+
+
 
 1;
 
index 22fe035..67f20b6 100644 (file)
@@ -48,38 +48,6 @@ metabib::keyword_field_entry->columns( Primary => qw/id/ );
 metabib::keyword_field_entry->columns( Others => qw/field value source/ );
 
 #-------------------------------------------------------------------------------
-#package metabib::title_field_entry_source_map;
-#use base qw/metabib/;
-#
-#metabib::title_field_entry_source_map->table( 'metabib_title_field_entry_source_map' );
-#metabib::title_field_entry_source_map->columns( Primary => qw/id/ );
-#metabib::title_field_entry_source_map->columns( Others => qw/field_entry metarecord source_record/ );
-#
-#-------------------------------------------------------------------------------
-#package metabib::author_field_entry_source_map;
-#use base qw/metabib/;
-#
-#metabib::author_field_entry_source_map->table( 'metabib_author_field_entry_source_map' );
-#metabib::author_field_entry_source_map->columns( Primary => qw/id/ );
-#metabib::author_field_entry_source_map->columns( Others => qw/field_entry metarecord source_record/ );
-#
-#-------------------------------------------------------------------------------
-#package metabib::subject_field_entry_source_map;
-#use base qw/metabib/;
-#
-#metabib::subject_field_entry_source_map->table( 'metabib_subject_field_entry_source_map' );
-#metabib::subject_field_entry_source_map->columns( Primary => qw/id/ );
-#metabib::subject_field_entry_source_map->columns( Others => qw/field_entry metarecord source_record/ );
-#
-#-------------------------------------------------------------------------------
-#package metabib::keyword_field_entry_source_map;
-#use base qw/metabib/;
-#
-#metabib::keyword_field_entry_source_map->table( 'metabib_keyword_field_entry_source_map' );
-#metabib::keyword_field_entry_source_map->columns( Primary => qw/id/ );
-#metabib::keyword_field_entry_source_map->columns( Others => qw/field_entry metarecord source_record/ );
-#
-#-------------------------------------------------------------------------------
 package metabib::metarecord_source_map;
 use base qw/metabib/;
 
@@ -96,6 +64,17 @@ metabib::full_rec->columns( Primary => qw/id/ );
 metabib::full_rec->columns( Others => qw/record tag ind1 ind2 subfield value/ );
 
 #-------------------------------------------------------------------------------
+package metabib::record_descriptor;
+use base qw/metabib/;
+#use OpenILS::Application::Storage::CDBI::asset;
+
+metabib::record_descriptor->table( 'metabib_rec_descriptor' );
+metabib::record_descriptor->columns( Primary => qw/id/ );
+metabib::record_descriptor->columns( Others => qw/record item_type item_form bib_level
+                                        control_type char_encoding enc_level
+                                        cat_form pub_status item_lang audience/ );
+
+#-------------------------------------------------------------------------------
 
 1;
 
index 21e266a..f89b8cb 100644 (file)
 
                my $col_list = join ',', @cols;
 
-               $log->debug('Starting COPY import for '.$cdbi->table, DEBUG);
+               $log->debug('Starting COPY import for '.$cdbi->table." ($col_list)", DEBUG);
                $cdbi->sql_copy_start($cdbi->table, $col_list)->execute;
 
                my $dbh = $cdbi->db_Main;
 
 {
        #---------------------------------------------------------------------
+       package action::survey;
+       
+       action::survey->table( 'action.survey' );
+       action::survey->sequence( 'action.survey_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package action::survey_question;
+       
+       action::survey_question->table( 'action.survey_question' );
+       action::survey_question->sequence( 'action.survey_question_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package action::survey_answer;
+       
+       action::survey_answer->table( 'action.survey_answer' );
+       action::survey_answer->sequence( 'action.survey_answer_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package action::survey_response;
+       
+       action::survey_response->table( 'action.survey_response' );
+       action::survey_response->sequence( 'action.survey_response_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package config::metabib_field;
+       
+       config::metabib_field->table( 'config.metabib_field' );
+       config::metabib_field->sequence( 'config.metabib_field_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package config::bib_source;
+       
+       config::bib_source->table( 'config.bib_source' );
+       config::bib_source->sequence( 'config.bib_source_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package config::identification_type;
+       
+       config::identification_type->table( 'config.identification_type' );
+       config::identification_type->sequence( 'config.identification_type_id_seq' );
+       
+       #---------------------------------------------------------------------
        package asset::call_number_note;
        
        asset::call_number->table( 'asset.call_number_note' );
        
        asset::copy->table( 'asset.copy' );
        asset::copy->sequence( 'asset.copy_id_seq' );
+
+       #---------------------------------------------------------------------
+       package asset::stat_cat;
+       
+       asset::stat_cat->table( 'asset.stat_cat' );
+       asset::stat_cat->sequence( 'asset.stat_cat_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package asset::stat_cat_entry;
+       
+       asset::stat_cat_entry->table( 'asset.stat_cat_entry' );
+       asset::stat_cat_entry->sequence( 'asset.stat_cat_entry_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package asset::stat_cat_entry_copy_map;
+       
+       asset::stat_cat_entry_copy_map->table( 'asset.stat_cat_entry_copy_map' );
+       asset::stat_cat_entry_copy_map->sequence( 'asset.stat_cat_entry_copy_map_id_seq' );
        
        #---------------------------------------------------------------------
        package biblio::record_entry;
        biblio::record_entry->sequence( 'biblio.record_entry_id_seq' );
 
        #---------------------------------------------------------------------
-       package biblio::record_node;
-       
-       biblio::record_node->table( 'biblio.record_data' );
-       biblio::record_node->sequence( 'biblio.record_data_id_seq' );
-       
-       #---------------------------------------------------------------------
        package biblio::record_marc;
        
        biblio::record_marc->table( 'biblio.record_marc' );
        biblio::record_marc->sequence( 'biblio.record_marc_id_seq' );
 
        #---------------------------------------------------------------------
-       package biblio::record_mods;
-       
-       biblio::record_mods->table( 'biblio.record_mods' );
-       biblio::record_mods->sequence( 'biblio.record_mods_id_seq' );
-
-       #---------------------------------------------------------------------
        package biblio::record_note;
        
        biblio::record_note->table( 'biblio.record_note' );
        actor::org_unit->sequence( 'actor.org_unit_id_seq' );
 
        #---------------------------------------------------------------------
+       package actor::stat_cat;
+       
+       actor::stat_cat->table( 'actor.stat_cat' );
+       actor::stat_cat->sequence( 'actor.stat_cat_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package actor::stat_cat_entry;
+       
+       actor::stat_cat_entry->table( 'actor.stat_cat_entry' );
+       actor::stat_cat_entry->sequence( 'actor.stat_cat_entry_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package actor::stat_cat_entry_user_map;
+       
+       actor::stat_cat_entry_user_map->table( 'actor.stat_cat_entry_copy_map' );
+       actor::stat_cat_entry_user_map->sequence( 'actor.stat_cat_entry_usr_map_id_seq' );
+       
+       #---------------------------------------------------------------------
+       package actor::card;
+       
+       actor::card->table( 'actor.card' );
+       actor::card->sequence( 'actor.card_id_seq' );
+       
+
+       #---------------------------------------------------------------------
 
        #-------------------------------------------------------------------------------
        package metabib::metarecord;
 #      );
 
        OpenILS::Application::Storage->register_method(
-               api_name        => 'open-ils.storage.metabib.title_field_entry.batch.create',
+               api_name        => 'open-ils.storage.direct.metabib.title_field_entry.batch.create',
                method          => 'copy_create',
                api_level       => 1,
                'package'       => 'OpenILS::Application::Storage',
        metabib::author_field_entry->columns( 'FTS' => 'index_vector' );
 
        OpenILS::Application::Storage->register_method(
-               api_name        => 'open-ils.storage.metabib.author_field_entry.batch.create',
+               api_name        => 'open-ils.storage.direct.metabib.author_field_entry.batch.create',
                method          => 'copy_create',
                api_level       => 1,
                'package'       => 'OpenILS::Application::Storage',
        metabib::subject_field_entry->columns( 'FTS' => 'index_vector' );
 
        OpenILS::Application::Storage->register_method(
-               api_name        => 'open-ils.storage.metabib.subject_field_entry.batch.create',
+               api_name        => 'open-ils.storage.direct.metabib.subject_field_entry.batch.create',
                method          => 'copy_create',
                api_level       => 1,
                'package'       => 'OpenILS::Application::Storage',
        metabib::keyword_field_entry->columns( 'FTS' => 'index_vector' );
 
        OpenILS::Application::Storage->register_method(
-               api_name        => 'open-ils.storage.metabib.keyword_field_entry.batch.create',
+               api_name        => 'open-ils.storage.direct.metabib.keyword_field_entry.batch.create',
                method          => 'copy_create',
                api_level       => 1,
                'package'       => 'OpenILS::Application::Storage',
        metabib::metarecord_source_map->table( 'metabib.metarecord_source_map' );
 
        #-------------------------------------------------------------------------------
+       package metabib::record_descriptor;
+
+       metabib::record_descriptor->table( 'metabib.rec_descriptor' );
+       metabib::record_descriptor->sequence( 'metabib.rec_descriptor_id_seq' );
+
+       OpenILS::Application::Storage->register_method(
+               api_name        => 'open-ils.storage.direct.metabib.record_descriptor.batch.create',
+               method          => 'copy_create',
+               api_level       => 1,
+               'package'       => 'OpenILS::Application::Storage',
+               cdbi            => 'metabib::record_descriptor',
+       );
+
+       #-------------------------------------------------------------------------------
+
 
        #-------------------------------------------------------------------------------
        package metabib::full_rec;
        metabib::full_rec->columns( 'FTS' => 'index_vector' );
 
        OpenILS::Application::Storage->register_method(
-               api_name        => 'open-ils.storage.metabib.full_rec.batch.create',
+               api_name        => 'open-ils.storage.direct.metabib.full_rec.batch.create',
                method          => 'copy_create',
                api_level       => 1,
                'package'       => 'OpenILS::Application::Storage',
index 5e7d00f..0c7d5df 100644 (file)
@@ -1,7 +1,6 @@
 package OpenILS::Application::Storage::Publisher;
 use base qw/OpenILS::Application::Storage/;
 our $VERSION = 1;
-my $pg = 'OpenILS::Application::Storage::Driver::Pg';
 
 use OpenSRF::EX qw/:try/;;
 use OpenSRF::Utils::Logger;
@@ -17,7 +16,8 @@ use OpenILS::Application::Storage::CDBI;
 #use OpenILS::Application::Storage::CDBI::metabib;
 
 use OpenILS::Application::Storage::Publisher::actor;
-#use OpenILS::Application::Storage::Publisher::asset;
+use OpenILS::Application::Storage::Publisher::action;
+use OpenILS::Application::Storage::Publisher::asset;
 use OpenILS::Application::Storage::Publisher::biblio;
 use OpenILS::Application::Storage::Publisher::config;
 use OpenILS::Application::Storage::Publisher::metabib;
@@ -191,7 +191,7 @@ for my $fmclass ( Fieldmapper->classes ) {
        (my $class = $cdbi) =~ s/::.*//o;
        (my $api_class = $cdbi) =~ s/::/./go;
        my $registration_class = __PACKAGE__ . "::$class";
-       my $api_prefix = 'open-ils.storage.'.$api_class;
+       my $api_prefix = 'open-ils.storage.direct.'.$api_class;
 
        # Create the search method
        unless ( __PACKAGE__->is_registered( $api_prefix.'.search' ) ) {
diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
new file mode 100644 (file)
index 0000000..01ffe8f
--- /dev/null
@@ -0,0 +1,9 @@
+package OpenILS::Application::Storage::Publisher::action;
+use base qw/OpenILS::Application::Storage/;
+#use OpenILS::Application::Storage::CDBI::action;
+#use OpenSRF::Utils::Logger qw/:level/;
+#use OpenILS::Utils::Fieldmapper;
+#
+#my $log = 'OpenSRF::Utils::Logger';
+
+1;
index f312b8e..e8ddad7 100644 (file)
@@ -25,7 +25,7 @@ sub org_unit_list {
        return \@fms;
 }
 __PACKAGE__->register_method(
-       api_name        => 'open-ils.storage.actor.org_unit_list',
+       api_name        => 'open-ils.storage.direct.actor.org_unit_list',
        api_level       => 1,
        method          => 'org_unit_list',
 );
@@ -55,102 +55,10 @@ sub org_unit_descendants {
        return \@fms;
 }
 __PACKAGE__->register_method(
-       api_name        => 'open-ils.storage.actor.org_unit_descendants',
+       api_name        => 'open-ils.storage.direct.actor.org_unit_descendants',
        api_level       => 1,
        method          => 'org_unit_descendants',
 );
 
 
-sub get_user_record {
-       my $self = shift;
-       my $client = shift;
-       my @ids = @_;
-
-       my $search_field = 'id';
-       $search_field = 'usrname' if ($self->api_name =~/userid/o);
-       $search_field = 'usrname' if ($self->api_name =~/username/o);
-
-       for my $id ( @ids ) {
-               next unless ($id);
-               
-               $log->debug("Searching for $id using ".$self->api_name, DEBUG);
-
-               my ($rec) = actor::user->fast_fieldmapper($search_field => "$id");
-               $client->respond( $rec ) if ($rec);
-
-               last if ($self->api_name !~ /list$/o);
-       }
-       return undef;
-}
-#__PACKAGE__->register_method(
-       #method         => 'get_user_record',
-       #api_name       => 'open-ils.storage.actor.user.retrieve',
-       #api_level      => 1,
-       #argc           => 1,
-#);
-#__PACKAGE__->register_method(
-       #method         => 'get_user_record',
-       #api_name       => 'open-ils.storage.actor.user.search.username',
-       #api_level      => 1,
-       #argc           => 1,
-#);
-#__PACKAGE__->register_method(
-       #method         => 'get_user_record',
-       #api_name       => 'open-ils.storage.actor.user.search.userid',
-       #api_level      => 1,
-       #argc           => 1,
-#);
-#__PACKAGE__->register_method(
-       #method         => 'get_user_record',
-       #api_name       => 'open-ils.storage.actor.user.retrieve.list',
-       #api_level      => 1,
-       #argc           => 1,
-#);
-#__PACKAGE__->register_method(
-       #method         => 'get_user_record',
-       #api_name       => 'open-ils.storage.actor.user.search.username.list',
-       #api_level      => 1,
-       #stream         => 1,
-       #argc           => 1,
-#);
-#__PACKAGE__->register_method(
-       #method         => 'get_user_record',
-       #api_name       => 'open-ils.storage.actor.user.search.userid.list',
-       #api_level      => 1,
-       #stream         => 1,
-       #argc           => 1,
-#);
-
-sub update_user_record {
-        my $self = shift;
-        my $client = shift;
-        my $user = shift;
-
-        my $rec = actor::user->update($user);
-        return 0 unless ($rec);
-        return 1;
-}
-#__PACKAGE__->register_method(
-        #method          => 'update_user_record',
-        #api_name        => 'open-ils.storage.actor.user.update',
-        #api_level       => 1,
-        #argc            => 1,
-#);
-
-sub delete_record_entry {
-        my $self = shift;
-        my $client = shift;
-        my $user = shift;
-
-        my $rec = actor::user->delete($user);
-       return 0 unless ($rec);
-        return 1;
-}
-#__PACKAGE__->register_method(
-        #method          => 'delete_user_record',
-        #api_name        => 'open-ils.storage.actor.user.delete',
-        #api_level       => 1,
-        #argc            => 1,
-#);
-
 1;
diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm
new file mode 100644 (file)
index 0000000..b09175c
--- /dev/null
@@ -0,0 +1,9 @@
+package OpenILS::Application::Storage::Publisher::asset;
+use base qw/OpenILS::Application::Storage/;
+#use OpenILS::Application::Storage::CDBI::asset;
+#use OpenSRF::Utils::Logger qw/:level/;
+#use OpenILS::Utils::Fieldmapper;
+#
+#my $log = 'OpenSRF::Utils::Logger';
+
+1;
index 6088f8e..fca9e14 100644 (file)
@@ -25,7 +25,7 @@ sub record_copy_count {
        throw OpenSRF::EX::InvalidArg ( "No record id passed!" )
                unless (@recs);
 
-       $org_unit_lookup ||= $self->method_lookup('open-ils.storage.actor.org_unit.retrieve');
+       $org_unit_lookup ||= $self->method_lookup('open-ils.storage.direct.actor.org_unit.retrieve');
        my ($org_unit) = $org_unit_lookup->run($oid);
 
        # XXX Use descendancy tree here!!!
@@ -59,344 +59,16 @@ sub record_copy_count {
 }
 __PACKAGE__->register_method(
        method          => 'record_copy_count',
-       api_name        => 'open-ils.storage.biblio.record_copy_count',
+       api_name        => 'open-ils.storage.direct.biblio.record_copy_count',
        api_level       => 1,
        argc            => 1,
 );
 __PACKAGE__->register_method(
        method          => 'record_copy_count',
-       api_name        => 'open-ils.storage.biblio.record_copy_count.batch',
+       api_name        => 'open-ils.storage.direct.biblio.record_copy_count.batch',
        api_level       => 1,
        argc            => 1,
        stream          => 1,
 );
 
-sub create_record_entry {
-       my $self = shift;
-       my $client = shift;
-       my $metadata = shift;
-
-       try {
-               my $rec = biblio::record_entry->create($metadata);
-               $client->respond( $rec->id );
-       } catch Error with {
-               $client->respond( 0 );
-       };
-
-       return undef;
-}
-#__PACKAGE__->register_method(
-       #method         => 'create_record_entry',
-       #api_name       => 'open-ils.storage.biblio.record_entry.create',
-       #api_level      => 1,
-       #argc           => 2,
-       #note           => <<TEXT,
-#
-#Params should be passed as a hash ref! 
-#Required fields are:
-#
-       #creator
-       #editor
-#
-#Please at least try to fill in:
-#
-       #tcn_source
-       #tcn_value
-       #metarecord
-       #source
-       #active
-#
-#TEXT
-#
-#);
-
-sub update_record_entry {
-       my $self = shift;
-       my $client = shift;
-       my $entry = shift;
-       
-       my $success = 1;
-       try {
-               $success = biblio::record_entry->update($entry);
-       } catch Error with {
-               $success = 0;
-       };
-
-       return $success;
-}
-#__PACKAGE__->register_method(
-       #method         => 'update_record_entry',
-       #api_name       => 'open-ils.storage.biblio.record_entry.update',
-       #api_level      => 1,
-       #argc           => 1,
-#);
-#
-sub delete_record_entry {
-       my $self = shift;
-       my $client = shift;
-       my $entry = shift;
-       
-       my $rec = biblio::record_entry->delete($entry);
-       return 0 unless ($rec);
-       return 1;
-}
-#__PACKAGE__->register_method(
-       #method         => 'delete_record_entry',
-       #api_name       => 'open-ils.storage.biblio.record_entry.delete',
-       #api_level      => 1,
-       #argc           => 1,
-#);
-#
-sub search_record_entry_one_field {
-       my $self = shift;
-       my $client = shift;
-       my @ids = @_;
-
-       (my $search_field = $self->api_name) =~ s/^.*\.search\.([^\.]+).*?$/$1/o;
-
-       for my $id ( @ids ) {
-               next unless ($id);
-               
-               for my $rec ( biblio::record_entry->fast_fieldmapper($search_field => "$id") ) {
-                       $client->respond( $rec ) if ($rec);
-               }
-
-               last if ($self->api_name !~ /list/o);
-       }
-       return undef;
-}
-#__PACKAGE__->register_method(
-       #method         => 'search_record_entry_one_field',
-       #api_name       => 'open-ils.storage.biblio.record_entry.search.tcn_value',
-       #api_level      => 1,
-       #argc           => 1,
-       #stream         => 1,
-#);
-#__PACKAGE__->register_method(
-       #method         => 'search_record_entry_one_field',
-       #api_name       => 'open-ils.storage.biblio.record_entry.search.tcn_value.list',
-       #api_level      => 1,
-       #argc           => 1,
-       #stream         => 1,
-#);
-
-sub get_record_entry {
-       my $self = shift;
-       my $client = shift;
-       my @ids = @_;
-
-       for my $id ( @ids ) {
-               next unless ($id);
-               
-               my ($rec) = biblio::record_entry->fast_fieldmapper($id);
-               $client->respond( $rec ) if ($rec);
-
-               last if ($self->api_name !~ /list/o);
-       }
-       return undef;
-}
-#__PACKAGE__->register_method(
-#      method          => 'get_record_entry',
-#      api_name        => 'open-ils.storage.biblio.record_entry.retrieve',
-#      api_level       => 1,
-#      argc            => 1,
-#);
-#__PACKAGE__->register_method(
-#      method          => 'get_record_entry',
-#      api_name        => 'open-ils.storage.biblio.record_entry.retrieve.list',
-#      api_level       => 1,
-#      argc            => 1,
-#      stream          => 1,
-#);
-
-sub create_record_node {
-       my $self = shift;
-       my $client = shift;
-       my $node = shift;;
-
-       try {
-               my $n = biblio::record_node->create($node);
-               $client->respond( $n->id );
-       } catch Error with {
-               $client->respond( 0 );
-       };
-
-       return undef;
-}
-#__PACKAGE__->register_method(
-#      method          => 'create_record_node',
-#      api_name        => 'open-ils.storage.biblio.record_node.create',
-#      api_level       => 1,
-#      argc            => 1,
-#);
-
-sub update_record_node {
-       my $self = shift;
-       my $client = shift;
-       my $node = shift;;
-
-       my $success = 1;
-       try {
-               $success = biblio::record_node->update($node);
-       } catch Error with {
-               $success = 0;
-       };
-
-       return $success;
-}
-#__PACKAGE__->register_method(
-#      method          => 'update_record_node',
-#      api_name        => 'open-ils.storage.biblio.record_node.update',
-#      api_level       => 1,
-#      argc            => 1,
-#);
-
-sub delete_record_node {
-       my $self = shift;
-       my $client = shift;
-       my $node = shift;
-       
-       my $rec = biblio::record_node->delete($node);
-       return 0 unless ($rec);
-       return 1;
-}
-#__PACKAGE__->register_method(
-#      method          => 'delete_record_node',
-#      api_name        => 'open-ils.storage.biblio.record_node.delete',
-#      api_level       => 1,
-#      argc            => 1,
-#);
-
-sub get_record_node {
-       my $self = shift;
-       my $client = shift;
-       my @ids = @_;
-
-       for my $id ( @ids ) {
-               next unless ($id);
-               
-               my ($rec) = biblio::record_node->fast_fieldmapper($id);
-               $client->respond( $rec ) if ($rec);
-
-               last if ($self->api_name !~ /list/o);
-       }
-       return undef;
-}
-#__PACKAGE__->register_method(
-       #method         => 'get_record_node',
-       #api_name       => 'open-ils.storage.biblio.record_node.retrieve',
-       #api_level      => 1,
-       #argc           => 1,
-#);
-#__PACKAGE__->register_method(
-       #method         => 'get_record_node',
-       #api_name       => 'open-ils.storage.biblio.record_node.retrieve.list',
-       #api_level      => 1,
-       ##argc          => 1,
-       #stream         => 1,
-#);
-
-sub create_record_nodeset {
-       my $self = shift;
-       my $client = shift;
-       my @nodes = @_;
-
-       my $method = $self->method_lookup('open-ils.storage.biblio.record_node.create');
-
-       my @success;
-       while ( my $node = shift(@nodes) ) {
-               my ($res) = $method->run( $node );
-               push(@success, $res) if ($res >= 0);
-       }
-       
-       my $insert_total = 0;
-       $insert_total += $_ for (@success);
-
-       return $insert_total;
-}
-#__PACKAGE__->register_method(
-#      method          => 'create_record_nodeset',
-#      api_name        => 'open-ils.storage.biblio.record_node.batch.create',
-#      api_level       => 1,
-#      argc            => 1,
-#);
-
-sub update_record_nodeset {
-       my $self = shift;
-       my $client = shift;
-       my @stuff = @_;
-
-       my $method = $self->method_lookup('open-ils.storage.biblio.record_node.update');
-
-       my @success;
-       while ( my $node = shift(@stuff) ) {
-               my ($res) = $method->run( $node );
-               push(@success, $res) if ($res >= 0);
-       }
-
-       my $update_total;
-       $update_total += $_ for (@success);
-       
-       return $update_total;
-}
-#__PACKAGE__->register_method(
-#      method          => 'update_record_nodeset',
-#      api_name        => 'open-ils.storage.biblio.record_node.batch.update',
-#      api_level       => 1,
-#      argc            => 1,
-#);
-
-sub delete_record_nodeset {
-       my $self = shift;
-       my $client = shift;
-
-       my $method = $self->method_lookup('open-ils.storage.biblio.record_node.delete');
-
-       my @success;
-       while ( my $node = shift(@_) ) {
-               my ($res) = $method->run( $node );
-               push(@success, $res) if ($res >= 0);
-       }
-
-       my $delete_total = 0;
-       $delete_total += $_ for (@success);
-       
-       return $delete_total;
-}
-#__PACKAGE__->register_method(
-#      method          => 'delete_record_nodeset',
-#      api_name        => 'open-ils.storage.biblio.record_node.batch.delete',
-#      api_level       => 1,
-#      argc            => 1,
-#);
-
-sub get_record_nodeset {
-       my $self = shift;
-       my $client = shift;
-       my @ids = @_;
-
-       for my $id ( @ids ) {
-               next unless ($id);
-               
-               $client->respond( [biblio::record_node->fast_fieldmapper( owner_doc => "$id", {order_by => 'intra_doc_id'} )] );
-               
-               last if ($self->api_name !~ /list/o);
-       }
-       return undef;
-}
-#__PACKAGE__->register_method(
-       #method         => 'get_record_nodeset',
-       #api_name       => 'open-ils.storage.biblio.record_entry.nodeset.retrieve',
-       #api_level      => 1,
-       #argc           => 1,
-#);
-#__PACKAGE__->register_method(
-       #method         => 'get_record_nodeset',
-       #api_name       => 'open-ils.storage.biblio.record_entry.nodeset.retrieve.list',
-       #api_level      => 1,
-       #argc           => 1,
-       #stream         => 1,
-#);
-#
-
 1;
index 1177ed6..1c572aa 100644 (file)
@@ -2,81 +2,22 @@ package OpenILS::Application::Storage::Publisher::config;
 use base qw/OpenILS::Application::Storage/;
 use OpenILS::Application::Storage::CDBI::config;
 
-#      XXX     XXX     XXX     XXX     XXX     XXX     XXX
-#              THIS IS NOT RIGHT! PLEASE UPDATE!!
-#      XXX     XXX     XXX     XXX     XXX     XXX     XXX
 
-sub getBiblioFieldMaps {
+sub metabib_field_all {
        my $self = shift;
        my $client = shift;
-       my $id = shift;
-       $log->debug(" Executing [".$self->method."] as [".$self->api_name."]",INTERNAL);
-       
-       if ($self->api_name =~ /by_class$/o) {
-               if ($id) {
-                       return $self->_cdbi2Hash( config::metarecord_field_map->search( fieldclass => $id ) );
-               } else {
-                       throw OpenSRF::EX::InvalidArg ('Please give me a Class to look up!');
-               }
-       } else {
-               if ($id) {
-                       return $self->_cdbi2Hash( config::metarecord_field_map->retrieve( $id ) );
-               } else {
-                       return $self->_cdbi_list2AoH( config::metarecord_field_map->retrieve_all );
-               }
-       }
-}      
-#__PACKAGE__->register_method(
-#      method          => 'getBiblioFieldMaps',
-#      api_name        => 'open-ils.storage.config.metarecord_field',
-#      argc            => 1,
-#);
-#__PACKAGE__->register_method(
-#      method          => 'getBiblioFieldMaps',
-#      api_name        => 'open-ils.storage.config.metarecord_field.all',
-#      argc            => 0,
-#);
-#__PACKAGE__->register_method(
-#      method          => 'getBiblioFieldMaps',
-#      api_name        => 'open-ils.storage.config.metarecord_field.list.by_class',
-#      argc            => 1,
-#);
-
 
-sub getBiblioFieldMapClasses {
-       my $self = shift;
-       my $client = shift;
-       my @ids = shift;
-
-       $log->debug(" Executing [".$self->method."] as [".$self->api_name."]",INTERNAL);
-
-       if ($self->api_name =~ /all/o) {
-               return $self->_cdbi_list2AoH( config::metarecord_field_class_map->retrieve_all );
-       } else {
-               for my $id (@ids) {
-                       next unless ($id);
-                       $client->respond( $self->_cdbi2Hash( config::metarecord_field_class_map->retrieve( $id ) ) );
-                       last unless ($self->api_name =~ /list/o);
-               } 
-               return undef;
+       for my $rec ( config::metabib_field->retrieve_all ) {
+               $client->respond( $rec->to_fieldmapper );
        }
-}      
-#__PACKAGE__->register_method(
-#      method          => 'getBiblioFieldMapClasses',
-#      api_name        => 'open-ils.storage.config.metarecord_field_class',
-#      argc            => 1,
-#);
-#
-#__PACKAGE__->register_method(
-#      method          => 'getBiblioFieldMapClasses',
-#      api_name        => 'open-ils.storage.config.metarecord_field_class.list',
-#      argc            => 1,
-#      stream          => 1,
-#);
-#__PACKAGE__->register_method(
-#      method          => 'getBiblioFieldMapClasses',
-#      api_name        => 'open-ils.storage.config.metarecord_field_class.all',
-#      argc            => 0,
-#);
+
+       return undef;
+}
+__PACKAGE__->register_method(
+       method          => 'metabib_field_all',
+       api_name        => 'open-ils.storage.direct.config.metabib_field.all',
+       argc            => 0,
+       stream          => 1,
+);
 
 1;
index 021844b..e1525b4 100644 (file)
@@ -47,13 +47,13 @@ sub search_full_rec {
 
 }
 __PACKAGE__->register_method(
-       api_name        => 'open-ils.storage.metabib.full_rec.search_fts.value',
+       api_name        => 'open-ils.storage.direct.metabib.full_rec.search_fts.value',
        method          => 'search_full_rec',
        api_level       => 1,
        stream          => 1,
 );
 __PACKAGE__->register_method(
-       api_name        => 'open-ils.storage.metabib.full_rec.search_fts.index_vector',
+       api_name        => 'open-ils.storage.direct.metabib.full_rec.search_fts.index_vector',
        method          => 'search_full_rec',
        api_level       => 1,
        stream          => 1,
index 3dfe28f..d338bb0 100644 (file)
@@ -4,6 +4,9 @@ use strict; use warnings;
 
 use OpenSRF::EX qw/:try/;
 
+use OpenSRF::Utils::Logger qw/:level/;
+my $log = 'OpenSRF::Utils::Logger';
+
 use OpenILS::Utils::FlatXML;
 use OpenILS::Utils::Fieldmapper;
 use JSON;
@@ -22,74 +25,143 @@ my $mods_sheet = $xslt->parse_stylesheet( $xslt_doc );
 
 use open qw/:utf8/;
 
+my $xpathset = {};
 
 sub child_init {
-       #try {
-       #       __PACKAGE__->method_lookup('i.do.not.exist');
-       #} catch Error with {
-       #       warn shift();
-       #};
+       my $meth = __PACKAGE__->method_lookup('open-ils.storage.direct.config.metabib_field.all');
+       for my $f ($meth->run) {
+               $xpathset->{ $f->field_class }->{ $f->name }->{xpath} = $f->xpath;
+               $xpathset->{ $f->field_class }->{ $f->name }->{id} = $f->id;
+               $log->debug("Loaded XPath from DB: ".$f->field_class." => ".$f->name." : ".$f->xpath, DEBUG);
+       }
 }
 
+# --------------------------------------------------------------------------------
+# Fingerprinting
+
+my @fp_mods_xpath = (
+       '//mods:mods/mods:typeOfResource[text()="text"]' => [
+                       title   => {
+                                       xpath   => [
+                                                       '//mods:mods/mods:titleInfo[mods:title and (@type="uniform")]',
+                                                       '//mods:mods/mods:titleInfo[mods:title and (@type="translated")]',
+                                                       '//mods:mods/mods:titleInfo[mods:title and (@type="alternative")]',
+                                                       '//mods:mods/mods:titleInfo[mods:title and not(@type)]',
+                                       ],
+                                       fixup   => '
+                                                       do {
+                                                               $text = lc($text);
+                                                               $text =~ s/\s+/ /sgo;
+                                                               $text =~ s/^\s*(.+)\s*$/$1/sgo;
+                                                               $text =~ s/\b(?:the|an?)\b//sgo;
+                                                               $text =~ s/\[.[^\]]+\]//sgo;
+                                                               $text =~ s/\s*[;\/\.]*$//sgo;
+                                                       };
+                                       ',
+                       },
+                       author  => {
+                                       xpath   => [
+                                                       '//mods:mods/mods:name[mods:role/mods:text/text()="creator" and @type="personal"]/mods:namePart',
+                                                       '//mods:mods/mods:name[mods:role/mods:text/text()="creator"]/mods:namePart',
+                                       ],
+                                       fixup   => '
+                                                       do {
+                                                               $text = lc($text);
+                                                               $text =~ s/\s+/ /sgo;
+                                                               $text =~ s/^\s*(.+)\s*$/$1/sgo;
+                                                               ($text) = split ",", $text;
+                                                       };
+                                       ',
+                       },
+       ],
+
+       '//mods:mods/mods:relatedItem[@type!="host"]' => [
+                       title   => {
+                                       xpath   => [
+                                                       '//mods:mods/mods:relatedItem/mods:titleInfo[mods:title and (@type="uniform")]',
+                                                       '//mods:mods/mods:relatedItem/mods:titleInfo[mods:title and (@type="translated")]',
+                                                       '//mods:mods/mods:relatedItem/mods:titleInfo[mods:title and (@type="alternative")]',
+                                                       '//mods:mods/mods:relatedItem/mods:titleInfo[mods:title and not(@type)]',
+                                                       '//mods:mods/mods:titleInfo[mods:title and (@type="uniform")]',
+                                                       '//mods:mods/mods:titleInfo[mods:title and (@type="translated")]',
+                                                       '//mods:mods/mods:titleInfo[mods:title and (@type="alternative")]',
+                                                       '//mods:mods/mods:titleInfo[mods:title and not(@type)]',
+                                       ],
+                                       fixup   => '
+                                                       do {
+                                                               $text = lc($text);
+                                                               $text =~ s/\s+/ /sgo;
+                                                               $text =~ s/^\s*(.+)\s*$/$1/sgo;
+                                                               $text =~ s/\b(?:the|an?)\b//sgo;
+                                                               $text =~ s/\[.[^\]]+\]//sgo;
+                                                               $text =~ s/\s*[;\/\.]*$//sgo;
+                                                       };
+                                       ',
+                       },
+                       author  => {
+                                       xpath   => [
+                                                       '//mods:mods/mods:relatedItem/mods:name[mods:role/mods:text/text()="creator" and @type="personal"]/mods:namePart',
+                                                       '//mods:mods/mods:relatedItem/mods:name[mods:role/mods:text/text()="creator"]/mods:namePart',
+                                                       '//mods:mods/mods:name[mods:role/mods:text/text()="creator" and @type="personal"]/mods:namePart',
+                                                       '//mods:mods/mods:name[mods:role/mods:text/text()="creator"]/mods:namePart',
+                                       ],
+                                       fixup   => '
+                                                       do {
+                                                               $text = lc($text);
+                                                               $text =~ s/\s+/ /sgo;
+                                                               $text =~ s/^\s*(.+)\s*$/$1/sgo;
+                                                               ($text) = split ",", $text;
+                                                       };
+                                       ',
+                       },
+       ],
 
-# get me from the database
-my $xpathset = {
-
-       title => {
-
-               abbreviated => 
-                       "//mods:mods/mods:titleInfo[mods:title and (\@type='abreviated')]",
-
-               translated =>
-                       "//mods:mods/mods:titleInfo[mods:title and (\@type='translated')]",
-
-               uniform =>
-                       "//mods:mods/mods:titleInfo[mods:title and (\@type='uniform')]",
-
-               proper =>
-                       "//mods:mods/mods:titleInfo[mods:title and not (\@type)]",
-       },
-
-       author => {
-
-               corporate => 
-                       "//mods:mods/mods:name[\@type='corporate']/mods:namePart".
-                               "[../mods:role/mods:text[text()='creator']][1]",
-
-               personal => 
-                       "//mods:mods/mods:name[\@type='personal']/mods:namePart".
-                               "[../mods:role/mods:text[text()='creator']][1]",
-
-               conference => 
-                       "//mods:mods/mods:name[\@type='conference']/mods:namePart".
-                               "[../mods:role/mods:text[text()='creator']][1]",
+);
 
-               other => 
-                       "//mods:mods/mods:name[\@type='personal']/mods:namePart",
-       },
+push @fp_mods_xpath, '//mods:mods/mods:titleInfo' => $fp_mods_xpath[1];
 
-       subject => {
+sub fingerprint_mods {
+       my $mods = shift;
 
-               geographic => 
-                       "//mods:mods/mods:subject/mods:geographic",
+       my $fp_string = '';
 
-               name => 
-                       "//mods:mods/mods:subject/mods:name",
+       my $match_index = 0;
+       my $block_index = 1;
+       while ( my $match_xpath = $fp_mods_xpath[$match_index] ) {
+               if ( my @nodes = $mods->findnodes( $match_xpath ) ) {
 
-               temporal => 
-                       "//mods:mods/mods:subject/mods:temporal",
+                       my $block_name_index = 0;
+                       my $block_value_index = 1;
+                       my $block = $fp_mods_xpath[$block_index];
+                       while ( my $part = $$block[$block_value_index] ) {
+                               my $text;
+                               for my $xpath ( @{ $part->{xpath} } ) {
+                                       $text = $mods->findvalue( $xpath );
+                                       last if ($text);
+                               }
 
-               topic => 
-                       "//mods:mods/mods:subject/mods:topic",
+                               $log->debug("Found fingerprint text using $$block[$block_name_index] : [$text]", DEBUG);
 
-               genre => 
-                       "//mods:mods/mods:genre",
+                               if ($text) {
+                                       eval $$part{fixup};
+                                       $fp_string .= $text;
+                               }
 
-       },
+                               $block_name_index += 2;
+                               $block_value_index += 2;
+                       }
+               }
+               if ($fp_string) {
+                       $log->debug("Fingerprint is [$fp_string]", INFO);;
+                       return $fp_string;
+               }
 
-       keyword => { keyword => "//mods:mods/*[not(local-name()='originInfo')]", },
+               $match_index += 2;
+               $block_index += 2;
+       }
+       return undef;
+}
 
-};
 
 
 # --------------------------------------------------------------------------------
@@ -98,6 +170,9 @@ my $begin;
 my $commit;
 my $rollback;
 my $lookup;
+my $fetch_entry;
+my $update_entry;
+my $rm_old_rd;
 my $rm_old_fr;
 my $rm_old_tr;
 my $rm_old_ar;
@@ -105,8 +180,21 @@ my $rm_old_sr;
 my $rm_old_kr;
 
 my $fr_create;
+my $rd_create;
 my $create = {};
 
+my %descriptor_code = (
+       item_type => 'substr($ldr,6,1)',
+       item_form => '(substr($ldr,6,1) =~ /^(?:f|g|i|m|o|p|r)$/) ? substr($oo8,29,1) : substr($oo8,23,1)',
+       bib_level => 'substr($ldr,7,1)',
+       control_type => 'substr($ldr,8,1)',
+       char_encoding => 'substr($ldr,9,1)',
+       enc_level => 'substr($ldr,17,1)',
+       cat_form => 'substr($ldr,18,1)',
+       pub_status => 'substr($ldr,5,1)',
+       item_lang => 'substr($oo8,35,3)',
+       audience => 'substr($oo8,22,1)',
+);
 
 sub wormize {
 
@@ -120,27 +208,35 @@ sub wormize {
                unless ($commit);
        $rollback = $self->method_lookup( 'open-ils.storage.transaction.rollback')
                unless ($rollback);
-       $lookup = $self->method_lookup('open-ils.storage.biblio.record_marc.batch.retrieve')
+       $lookup = $self->method_lookup('open-ils.storage.direct.biblio.record_marc.batch.retrieve')
                unless ($lookup);
-       $rm_old_fr = $self->method_lookup( 'open-ils.storage.metabib.full_rec.mass_delete')
+       $fetch_entry = $self->method_lookup('open-ils.storage.direct.biblio.record_entry.retrieve')
+               unless ($update_entry);
+       $update_entry = $self->method_lookup('open-ils.storage.direct.biblio.record_entry.batch.update')
+               unless ($update_entry);
+       $rm_old_rd = $self->method_lookup( 'open-ils.storage.direct.metabib.record_descriptor.mass_delete')
+               unless ($rm_old_rd);
+       $rm_old_fr = $self->method_lookup( 'open-ils.storage.direct.metabib.full_rec.mass_delete')
                unless ($rm_old_fr);
-       $rm_old_tr = $self->method_lookup( 'open-ils.storage.metabib.title_field_entry.mass_delete')
+       $rm_old_tr = $self->method_lookup( 'open-ils.storage.direct.metabib.title_field_entry.mass_delete')
                unless ($rm_old_tr);
-       $rm_old_ar = $self->method_lookup( 'open-ils.storage.metabib.author_field_entry.mass_delete')
+       $rm_old_ar = $self->method_lookup( 'open-ils.storage.direct.metabib.author_field_entry.mass_delete')
                unless ($rm_old_ar);
-       $rm_old_sr = $self->method_lookup( 'open-ils.storage.metabib.subject_field_entry.mass_delete')
+       $rm_old_sr = $self->method_lookup( 'open-ils.storage.direct.metabib.subject_field_entry.mass_delete')
                unless ($rm_old_sr);
-       $rm_old_kr = $self->method_lookup( 'open-ils.storage.metabib.keyword_field_entry.mass_delete')
+       $rm_old_kr = $self->method_lookup( 'open-ils.storage.direct.metabib.keyword_field_entry.mass_delete')
                unless ($rm_old_kr);
-       $fr_create = $self->method_lookup( 'open-ils.storage.metabib.full_rec.batch.create')
+       $rd_create = $self->method_lookup( 'open-ils.storage.direct.metabib.record_descriptor.batch.create')
+               unless ($rd_create);
+       $fr_create = $self->method_lookup( 'open-ils.storage.direct.metabib.full_rec.batch.create')
                unless ($fr_create);
-       $$create{title} = $self->method_lookup( 'open-ils.storage.metabib.title_field_entry.batch.create')
+       $$create{title} = $self->method_lookup( 'open-ils.storage.direct.metabib.title_field_entry.batch.create')
                unless ($$create{title});
-       $$create{author} = $self->method_lookup( 'open-ils.storage.metabib.author_field_entry.batch.create')
+       $$create{author} = $self->method_lookup( 'open-ils.storage.direct.metabib.author_field_entry.batch.create')
                unless ($$create{author});
-       $$create{subject} = $self->method_lookup( 'open-ils.storage.metabib.subject_field_entry.batch.create')
+       $$create{subject} = $self->method_lookup( 'open-ils.storage.direct.metabib.subject_field_entry.batch.create')
                unless ($$create{subject});
-       $$create{keyword} = $self->method_lookup( 'open-ils.storage.metabib.keyword_field_entry.batch.create')
+       $$create{keyword} = $self->method_lookup( 'open-ils.storage.direct.metabib.keyword_field_entry.batch.create')
                unless ($$create{keyword});
 
 
@@ -154,6 +250,8 @@ sub wormize {
                throw OpenSRF::EX::PANIC ("WoRM Couldn't BEGIN transaction!")
        };
 
+       my @entry_list;
+       my @rd_list;
        my @ns_list;
        my @mods_data;
        my $ret = 0;
@@ -164,8 +262,26 @@ sub wormize {
                my $xml = $marc->marc;
                my $docid = $marc->id;
                my $marcdoc = $parser->parse_string($xml);
+               my $modsdoc = $mods_sheet->transform($marcdoc);
 
-               push @mods_data, { $docid => $self->modsdoc_to_values( $mods_sheet->transform($marcdoc) ) };
+               my $mods = $modsdoc->documentElement;
+               $mods->setNamespace( "http://www.loc.gov/mods/", "mods", 1 );
+
+               my ($entry) = $fetch_entry->run($docid);
+               $entry->fingerprint( fingerprint_mods( $mods ) );
+               push @entry_list, $entry;
+
+               my $ldr = $marcdoc->documentElement->getChildrenByTagName('leader')->pop->textContent;
+               my $oo8 = $marcdoc->documentElement->findvalue('//*[local-name()="controlfield" and @tag="008"]');
+
+               my $rd_obj = Fieldmapper::metabib::record_descriptor->new;
+               for my $rd_field ( keys %descriptor_code ) {
+                       $rd_obj->$rd_field( eval "$descriptor_code{$rd_field};" );
+               }
+               $rd_obj->record( $docid );
+               push @rd_list, $rd_obj;
+
+               push @mods_data, { $docid => $self->modsdoc_to_values( $mods ) };
 
                # step 2: build the KOHA rows
                my @tmp_list = _marcxml_to_full_rows( $marcdoc );
@@ -177,15 +293,26 @@ sub wormize {
                last unless ($self->api_name =~ /batch$/o);
        }
 
+       $rm_old_rd->run( { record => \@docids } );
        $rm_old_fr->run( { record => \@docids } );
        $rm_old_tr->run( { source => \@docids } );
        $rm_old_ar->run( { source => \@docids } );
        $rm_old_sr->run( { source => \@docids } );
        $rm_old_kr->run( { source => \@docids } );
 
+       my ($re) = $update_entry->run(@entry_list);
+       unless (defined $re) {
+               throw OpenSRF::EX::PANIC ("Couldn't run open-ils.storage.direct.biblio.record_entry.batch.update!")
+       }
+
+       my ($rd) = $rd_create->run(@rd_list);
+       unless (defined $rd) {
+               throw OpenSRF::EX::PANIC ("Couldn't run open-ils.storage.direct.metabib.record_descriptor.batch.create!")
+       }
+
        my ($fr) = $fr_create->run(@ns_list);
        unless (defined $fr) {
-               throw OpenSRF::EX::PANIC ("Couldn't run open-ils.storage.metabib.full_rec.batch.create!")
+               throw OpenSRF::EX::PANIC ("Couldn't run open-ils.storage.direct.metabib.full_rec.batch.create!")
        }
 
        # step 5: insert the new metadata
@@ -198,13 +325,12 @@ sub wormize {
                        my $fm_constructor = "Fieldmapper::metabib::${class}_field_entry";
                        for my $row ( keys %{ $$data{$class} } ) {
                                next unless (exists $$data{$class}{$row});
-                               next unless ($$data{$class}{$row});
+                               next unless ($$data{$class}{$row}{value});
                                my $fm_obj = $fm_constructor->new;
-                               $fm_obj->value( $$data{$class}{$row} );
+                               $fm_obj->value( $$data{$class}{$row}{value} );
+                               $fm_obj->field( $$data{$class}{$row}{field_id} );
                                $fm_obj->source( $did );
-
-                               # XXX This needs to be a real thing once the xpath is in the DB
-                               $fm_obj->field( 1 );
+                               $log->debug("$class entry: ".$fm_obj->source." => ".$fm_obj->field." : ".$fm_obj->value, DEBUG);
 
                                push @md_list, $fm_obj;
                        }
@@ -212,7 +338,7 @@ sub wormize {
                        
                my ($cr) = $$create{$class}->run(@md_list);
                unless (defined $cr) {
-                       throw OpenSRF::EX::PANIC ("Couldn't run open-ils.storage.metabib.${class}_field_entry.batch.create!")
+                       throw OpenSRF::EX::PANIC ("Couldn't run open-ils.storage.direct.metabib.${class}_field_entry.batch.create!")
                }
        }
 
@@ -278,14 +404,18 @@ sub _marcxml_to_full_rows {
        for my $tagline ( @{$root->getChildrenByTagName("datafield")} ) {
                next unless $tagline;
 
-               for my $data ( @{$tagline->getChildrenByTagName("subfield")} ) {
-                       next unless $tagline;
+               my $tag = $tagline->getAttribute( "tag" );
+               my $ind1 = $tagline->getAttribute( "ind1" );
+               my $ind2 = $tagline->getAttribute( "ind2" );
+
+               for my $data ( $tagline->childNodes ) {
+                       next unless $data;
 
                        my $ns = new Fieldmapper::metabib::full_rec;
 
-                       $ns->tag( $tagline->getAttribute( "tag" ) );
-                       $ns->ind1( $tagline->getAttribute( "ind1" ) );
-                       $ns->ind2( $tagline->getAttribute( "ind2" ) );
+                       $ns->tag( $tag );
+                       $ns->ind1( $ind1 );
+                       $ns->ind2( $ind2 );
                        $ns->subfield( $data->getAttribute( "code" ) );
                        my $val = $data->textContent;
                        $val =~ s/(\pM)//gso;
@@ -299,11 +429,9 @@ sub _marcxml_to_full_rows {
 
 sub _get_field_value {
 
-       my( $mods, $xpath ) = @_;
+       my( $root, $xpath ) = @_;
 
        my $string = "";
-       my $root = $mods->documentElement;
-       $root->setNamespace( "http://www.loc.gov/mods/", "mods", 1 );
 
        # grab the set of matching nodes
        my @nodes = $root->findnodes( $xpath );
@@ -332,9 +460,10 @@ sub modsdoc_to_values {
        my $data = {};
        for my $class (keys %$xpathset) {
                $data->{$class} = {};
-               for my $type(keys %{$xpathset->{$class}}) {
-                       my $value = _get_field_value( $mods, $xpathset->{$class}->{$type} );
-                       $data->{$class}->{$type} = $value;
+               for my $type (keys %{$xpathset->{$class}}) {
+                       $data->{$class}->{$type} = {};
+                       $data->{$class}->{$type}->{value} = _get_field_value( $mods, $xpathset->{$class}->{$type}->{xpath} );
+                       $data->{$class}->{$type}->{field_id} = $xpathset->{$class}->{$type}->{id};
                }
        }
        return $data;