updated storage 'search' methods to be atomic
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Jul 2005 18:45:39 +0000 (18:45 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Jul 2005 18:45:39 +0000 (18:45 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1082 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/OpenILS/Application/Auth.pm
Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Rules.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/StatCat.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Survey.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Actor.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/src/perlmods/OpenILS/Utils/ModsParser.pm

index 9f811c5..ba999f6 100644 (file)
@@ -120,7 +120,7 @@ sub flesh_user {
 
        # grab the cards
        my $cards_req = $session->request(
-                       "open-ils.storage.direct.actor.card.search.usr",
+                       "open-ils.storage.direct.actor.card.search.usr.atomic",
                        $user->id() );
        $user->cards( $cards_req->gather(1) );
 
@@ -132,7 +132,7 @@ sub flesh_user {
        }
 
        my $add_req = $session->request(
-                       "open-ils.storage.direct.actor.user_address.search.usr",
+                       "open-ils.storage.direct.actor.user_address.search.usr.atomic",
                        $user->id() );
        $user->addresses( $add_req->gather(1) );
 
@@ -151,7 +151,7 @@ sub flesh_user {
        }
 
        my $stat_req = $session->request(
-               "open-ils.storage.direct.actor.stat_cat_entry_user_map.search.target_usr",
+               "open-ils.storage.direct.actor.stat_cat_entry_user_map.search.target_usr.atomic",
                $user->id() );
        $user->stat_cat_entries($stat_req->gather(1));
 
@@ -483,7 +483,7 @@ sub search_username {
        my($self, $client, $username) = @_;
        my $users = OpenILS::Application::AppUtils->simple_scalar_request(
                        "open-ils.storage", 
-                       "open-ils.storage.direct.actor.user.search.usrname",
+                       "open-ils.storage.direct.actor.user.search.usrname.atomic",
                        $username );
        return $users;
 }
@@ -504,7 +504,7 @@ sub user_retrieve_by_barcode {
 
        # find the card with the given barcode
        my $creq        = $session->request(
-                       "open-ils.storage.direct.actor.card.search.barcode",
+                       "open-ils.storage.direct.actor.card.search.barcode.atomic",
                        $barcode );
        my $card = $creq->gather(1);
 
index 2d84b87..b4fffb4 100644 (file)
@@ -103,7 +103,7 @@ sub init_authenticate {
 sub complete_authenticate {
        my( $self, $client, $username, $passwdhash, $type ) = @_;
 
-       my $name = "open-ils.storage.direct.actor.user.search.usrname";
+       my $name = "open-ils.storage.direct.actor.user.search.usrname.atomic";
 
        warn "Completing Authentication\n";
 
index 9b25a10..af274bd 100644 (file)
@@ -109,7 +109,7 @@ sub _tcn_exists {
        if(!$tcn) {return 0;}
 
        my $req = $session->request(      
-               "open-ils.storage.direct.biblio.record_entry.search.tcn_value",
+               "open-ils.storage.direct.biblio.record_entry.search.tcn_value.atomic",
                $tcn );
        my $recs = $req->gather(1);
 
@@ -347,7 +347,7 @@ sub _get_id_by_userid {
 
        my $session = OpenSRF::AppSession->create( "open-ils.storage" );
        my $request = $session->request( 
-               "open-ils.storage.direct.actor.user.search.usrname", @users );
+               "open-ils.storage.direct.actor.user.search.usrname.atomic", @users );
 
        $request->wait_complete;
        my $response = $request->recv();
@@ -418,7 +418,7 @@ sub orgs_for_title {
 
        my $vols = $apputils->simple_scalar_request(
                "open-ils.storage",
-               "open-ils.storage.direct.asset.call_number.search.record",
+               "open-ils.storage.direct.asset.call_number.search.record.atomic",
                $record_id );
 
        my $orgs = { map {$_->owning_lib => 1 } @$vols };
@@ -491,7 +491,7 @@ sub _build_volume_list {
 
                warn "Grabbing copies for volume: " . $volume->id . "\n";
                my $creq = $session->request(
-                       "open-ils.storage.direct.asset.copy.search.call_number", 
+                       "open-ils.storage.direct.asset.copy.search.call_number.atomic", 
                        $volume->id );
                my $copies = $creq->gather(1);
 
@@ -590,7 +590,7 @@ sub _delete_volume {
        warn "Deleting volume " . $volume->id . "\n";
 
        my $copies = $session->request(
-               "open-ils.storage.direct.asset.copy.search.call_number",
+               "open-ils.storage.direct.asset.copy.search.call_number.atomic",
                $volume->id )->gather(1);
        if(@$copies) {
                throw OpenSRF::EX::ERROR 
@@ -723,7 +723,7 @@ sub _fleshed_copy_update {
        if(!@$stat_cat_entries) { return 1; }
 
        my $stat_maps = $session->request(
-               "open-ils.storage.direct.asset.stat_cat_entry_copy_map.search.owning_copy",
+               "open-ils.storage.direct.asset.stat_cat_entry_copy_map.search.owning_copy.atomic",
                $copy->id )->gather(1);
 
        if(!$copy->isnew) { _delete_stale_maps($session, $stat_maps, $copy); }
index d72ea65..404201b 100644 (file)
@@ -59,15 +59,16 @@ sub checkouts_by_user {
                $copy = $copy->gather(1);
                $record = $record->gather(1);
 
-               my $due_date = 
-                       OpenSRF::Utils->interval_to_seconds( 
-                               $circ->duration ) + int(time());
-               $circ->due_date($due_date);
+#              my $due_date = 
+#                      OpenSRF::Utils->interval_to_seconds( 
+#              $circ->duration ) + int(time());
+#              $circ->due_date($due_date);
 
+               use Data::Dumper;
+               warn Dumper $circ;
                my $u = OpenILS::Utils::ModsParser->new();
                $u->start_mods_batch( $record->marc() );
                my $mods = $u->finish_mods_batch();
-               warn "Doc id is " . $record->id() . "\n";
                $mods->doc_id($record->id());
 
                push( @results, { copy => $copy, circ => $circ, record => $mods } );
index de0fbc2..15b011b 100644 (file)
@@ -180,7 +180,7 @@ sub retrieve_holds {
 
        my $session = OpenSRF::AppSession->create("open-ils.storage");
        my $req = $session->request(
-               "open-ils.storage.direct.action.hold_request.search.usr",
+               "open-ils.storage.direct.action.hold_request.search.usr.atomic",
                $user_id );
        my $h = $req->gather(1);
        $session->disconnect();
index fe266cd..efffecd 100644 (file)
@@ -139,7 +139,7 @@ sub gather_circ_objects {
 
 
        my $copy_req    = $session->request(
-               "open-ils.storage.fleshed.asset.copy.search.barcode", 
+               "open-ils.storage.fleshed.asset.copy.search.barcode.atomic", 
                $barcode_string );
 
        my $patron_req  = $session->request(
@@ -317,11 +317,13 @@ sub circulate {
        $circ->max_fine_rule($max);
        $circ->recuring_fine_rule($recurring);
 
-       my $due_date = 
-               OpenSRF::Utils->interval_to_seconds( 
-                       $circ->duration ) + int(time());
 
-       $circ->due_date($due_date);
+#      my $due_date = 
+#              OpenSRF::Utils->interval_to_seconds( 
+#              $circ->duration ) + int(time());
+
+#      this comes from an earlier setting now
+#      $circ->due_date($due_date);
 
        return $circ;
 
@@ -360,15 +362,15 @@ sub run_circ_scripts {
        # find the rules objects based on the rule names returned from
        # the various scripts.
        my $dur_req = $session->request(
-               "open-ils.storage.direct.config.rules.circ_duration.search.name",
+               "open-ils.storage.direct.config.rules.circ_duration.search.name.atomic",
                $duration_rule->[0] );
 
        my $rec_req = $session->request(
-               "open-ils.storage.direct.config.rules.recuring_fine.search.name",
+               "open-ils.storage.direct.config.rules.recuring_fine.search.name.atomic",
                $rec_fines_rule->[0] );
 
        my $max_req = $session->request(
-               "open-ils.storage.direct.config.rules.max_fine.search.name",
+               "open-ils.storage.direct.config.rules.max_fine.search.name.atomic",
                $max_fines_rule->[0] );
 
        my $duration    = $dur_req->gather(1)->[0];
@@ -460,7 +462,7 @@ sub checkin {
                }
        
                my $copy_req = $session->request(
-                       "open-ils.storage.direct.asset.copy.search.barcode", 
+                       "open-ils.storage.direct.asset.copy.search.barcode.atomic", 
                        $barcode );
                $copy = $copy_req->gather(1)->[0];
                if(!$copy) {
@@ -474,7 +476,7 @@ sub checkin {
                # given copy.  should only be one.
                warn "Retrieving circ for checking\n";
                my $circ_req = $session->request(
-                       "open-ils.storage.direct.action.circulation.search.atomic",
+                       "open-ils.storage.direct.action.circulation.search.atomic.atomic",
                        { target_copy => $copy->id, xact_finish => undef } );
        
                my $circ = $circ_req->gather(1)->[0];
index dc4decf..7d998a5 100644 (file)
@@ -384,10 +384,10 @@ sub retrieve_maps {
 
        my $user_obj = $apputils->check_user_session($user_session); 
 
-       my      $method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.search.owning_copy";
+       my      $method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.search.owning_copy.atomic";
        if($self->api_name =~ /actor/ ) {
                if(!$target) { $target = $user_obj->id; }
-               $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.search.target_usr";
+               $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.search.target_usr.atomic";
        }
 
        return $apputils->simple_scalar_request("open-ils.storage", $method, $target);
index 0034030..8e95ecd 100644 (file)
@@ -245,14 +245,17 @@ sub get_fleshed_survey {
 
        warn "Grabbing survey questions\n";
        my $qreq = $session->request(
-               "open-ils.storage.direct.action.survey_question.search.survey", 
+               "open-ils.storage.direct.action.survey_question.search.survey.atomic", 
                $survey->id() );
 
        my $questions = $qreq->gather(1); 
+       use Data::Dumper;
+       warn "Question: " . Dumper($questions);
 
        if($questions) {
 
                for my $question (@$questions) {
+                       next unless defined $question;
        
                        # add this question to the survey
                        push( @{$survey->questions()}, $question );
@@ -260,7 +263,7 @@ sub get_fleshed_survey {
                        warn "Grabbing question answers\n";
 
                        my $ans_req = $session->request(
-                               "open-ils.storage.direct.action.survey_answer.search.question",
+                               "open-ils.storage.direct.action.survey_answer.search.question.atomic",
                                $question->id() );
        
                        # add this array of answers to this question
index 576784e..2c24f11 100644 (file)
@@ -17,7 +17,7 @@ sub actor_user_search_username {
 
        my $users = OpenILS::Application::AppUtils->simple_scalar_request(
                        "open-ils.storage", 
-                       "open-ils.storage.direct.actor.user.search.usrname",
+                       "open-ils.storage.direct.actor.user.search.usrname.atomic",
                        $username );
 
        return $users;
@@ -37,7 +37,7 @@ sub actor_user_retrieve_by_barcode {
 
        # find the card with the given barcode
        my $creq        = $session->request(
-                       "open-ils.storage.direct.actor.card.search.barcode",
+                       "open-ils.storage.direct.actor.card.search.barcode.atomic",
                        $barcode );
        my $card = $creq->gather(1);
        $card = $card->[0];
@@ -80,12 +80,12 @@ sub flesh_user {
 
        # grab the cards
        my $cards_req = $session->request(
-                       "open-ils.storage.direct.actor.card.search.usr",
+                       "open-ils.storage.direct.actor.card.search.usr.atomic",
                        $user->id() );
        $user->cards( $cards_req->gather(1) );
 
        my $add_req = $session->request(
-                       "open-ils.storage.direct.actor.user_address.search.usr",
+                       "open-ils.storage.direct.actor.user_address.search.usr.atomic",
                        $user->id() );
        $user->addresses( $add_req->gather(1) );
 
index 31c4cbe..028eef0 100644 (file)
@@ -246,7 +246,7 @@ sub biblio_search_tcn {
 
        my $session = OpenSRF::AppSession->create( "open-ils.storage" );
        my $request = $session->request( 
-                       "open-ils.storage.direct.biblio.record_entry.search.tcn_value", $tcn );
+                       "open-ils.storage.direct.biblio.record_entry.search.tcn_value.atomic", $tcn );
        my $record_entry = $request->gather(1);
 
        my @ids;
@@ -308,7 +308,7 @@ sub biblio_barcode_to_copy {
        warn "copy search for barcode $barcode\n";
        my $record = OpenILS::Application::AppUtils->simple_scalar_request(
                        "open-ils.storage", 
-                       "open-ils.storage.direct.asset.copy.search.barcode",
+                       "open-ils.storage.direct.asset.copy.search.barcode.atomic",
                        $barcode );
 
        return undef unless($record);
@@ -366,7 +366,7 @@ __PACKAGE__->register_method(
        api_name        => "open-ils.search.asset.copy.fleshed.retrieve",
 );
 
-sub fleshed_copy_retrieve_batch { 
+sub fleshed_copy_retrieve { 
        my( $self, $client, $id ) = @_;
 
        return undef unless defined $id;
index b86fc1d..ac7497c 100644 (file)
@@ -263,9 +263,9 @@ sub start_mods_batch {
        my $xmldoc = $parser->parse_string($master_doc);
        my $mods = $mods_sheet->transform($xmldoc);
 
-       warn "-" x 100 . "\n";
-       warn "MODS " . $mods->toString(1) . "\n";
-       warn "-" x 100 . "\n";
+#      warn "-" x 100 . "\n";
+#      warn "MODS " . $mods->toString(1) . "\n";
+#      warn "-" x 100 . "\n";
 
        $self->{master_doc} = $self->modsdoc_to_values( $mods );
        $self->{master_doc} = $self->mods_values_to_mods_slim( $self->{master_doc} );