1 package OpenILS::Application::Storage::CDBI;
2 use base qw/Class::DBI/;
4 use Class::DBI::AbstractSearch;
6 use OpenILS::Application::Storage::CDBI::actor;
7 use OpenILS::Application::Storage::CDBI::action;
8 use OpenILS::Application::Storage::CDBI::asset;
9 use OpenILS::Application::Storage::CDBI::authority;
10 use OpenILS::Application::Storage::CDBI::biblio;
11 use OpenILS::Application::Storage::CDBI::config;
12 use OpenILS::Application::Storage::CDBI::metabib;
13 use OpenILS::Application::Storage::CDBI::money;
14 use OpenILS::Application::Storage::CDBI::permission;
15 use OpenILS::Application::Storage::CDBI::container;
18 use OpenSRF::Utils::Logger qw(:level);
19 use OpenSRF::EX qw/:try/;
22 my $log = 'OpenSRF::Utils::Logger';
27 $log->debug("Creating ImaDBI Querys", DEBUG);
28 __PACKAGE__->set_sql( 'OILSFastSearch', <<" SQL", 'Main');
34 __PACKAGE__->set_sql( 'OILSFastOrderedSearchLike', <<" SQL", 'Main');
41 __PACKAGE__->set_sql( 'OILSFastOrderedSearch', <<" SQL", 'Main');
48 $log->debug("Calling Driver child_init", DEBUG);
49 $self->SUPER::child_init(@_);
55 $class = ref($class) || $class;
63 if (!(defined($order) and ref($order) and ref($order) eq 'HASH')) {
64 if (defined($value) and ref($value) and ref($value) eq 'HASH') {
68 $order = { order_by => $class->columns('Primary') }
72 unless (defined $value) {
74 ($field) = $class->columns('Primary');
77 unless (defined $field) {
78 ($field) = $class->columns('Primary');
81 unless ($order->{order_by}) {
82 $order = { order_by => $class->columns('Primary') }
85 my $fm_class = 'Fieldmapper::'.$class;
86 my $field_list = join ',', $class->columns('Essential');
90 $sth = $class->sql_OILSFastOrderedSearch( $field_list, $class->table, $field, $order->{order_by});
92 $sth = $class->sql_OILSFastOrderedSearchLike( $field_list, $class->table, $field, $order->{order_by});
94 $sth->execute($value);
100 return map $class->construct($_), $self->fast_flesh_sth(@_)->fetchall_hash;
103 sub fast_fieldmapper {
109 my $class = ref($self) || $self;
110 my $fm_class = 'Fieldmapper::'.$class;
112 $log->debug("fast_fieldmapper() ==> Retrieving $fm_class", INTERNAL);
114 for my $hash ($self->fast_flesh_sth( $col, "$id", { order_by => $col }, $like )->fetchall_hash) {
115 my $fm = $fm_class->new;
116 for my $field ( $fm_class->real_fields ) {
117 $fm->$field( $$hash{$field} );
122 my $search_type = 'search';
124 $search_type = 'search_fts'
125 } elsif ($like == 3) {
126 $search_type = 'search_regex'
129 for my $obj ($class->$search_type({ $col => $id}, $options)) {
130 push @fms, $obj->to_fieldmapper;
140 (UNIVERSAL::isa($arg => 'Fieldmapper') ||
141 UNIVERSAL::isa($arg => 'Class::DBI')) ) {
142 my ($col) = $self->primary_column;
143 $log->debug("Using field $col as the primary key", INTERNAL);
146 my ($col) = $self->primary_column;
147 $log->debug("Using field $col as the primary key", INTERNAL);
151 $log->debug("Retrieving $self with $arg", INTERNAL);
154 $rec = $self->SUPER::retrieve("$arg");
156 $log->debug("Could not retrieve $self with $arg! -- ".shift(), DEBUG);
164 my $class = ref($obj) || $obj;
166 my $fm_class = 'Fieldmapper::'.$class;
167 my $fm = $fm_class->new;
170 for my $field ( $fm->real_fields ) {
171 $fm->$field( ''.$obj->$field );
183 delete $$arg{$_} for (keys %$search);
185 $log->debug("CDBI->merge: \$search is $search (".ref($search)." : ".join(',',map{"$_ => $$search{$_}"}keys(%$search)).")",DEBUG);
186 $log->debug("CDBI->merge: \$arg is $arg (".ref($arg)." : ".join(',',map{"$_ => $$arg{$_}"}keys(%$arg)).")",DEBUG);
189 @objs = $self->search_where($search) unless (ref $self);
192 $objs[0]->update($arg);
194 } elsif (@objs == 0) {
195 return $self->create({%$search,%$arg});
197 throw OpenSRF::EX::WARN ("Non-unique search key for merge. Perhaps you meant to use remote_update?");
206 delete $$arg{$_} for (keys %$search);
208 $log->debug("CDBI->remote_update: \$search is $search (".ref($search)." : ".join(',',map{"$_ => $$search{$_}"}keys(%$search)).")",DEBUG);
209 $log->debug("CDBI->remote_update: \$arg is $arg (".ref($arg)." : ".join(',',map{"$_ => $$arg{$_}"}keys(%$arg)).")",DEBUG);
211 # my @objs = $self->search_where($search);
212 # throw OpenSRF::EX::WARN ("No objects found for remote_update. Perhaps you meant to use merge?")
215 # $_->update($arg) for (@objs);
216 # return scalar(@objs);
218 my @finds = sort keys %$search;
219 my @sets = sort keys %$arg;
221 my @find_vals = @$search{@finds};
222 my @set_vals = @$arg{@sets};
224 my $sql = 'UPDATE %s SET %s WHERE %s';
226 my $table = $self->table;
227 my $set = join(', ', map { "$_=?" } @sets);
228 my $where = join(', ', map { "$_=?" } @finds);
230 my $sth = $self->db_Main->prepare(sprintf($sql, $table, $set, $where));
231 $sth->execute(@set_vals,@find_vals);
240 $log->debug("CDBI->create: \$arg is $arg (".ref($arg)." : ".JSON->perl2JSON($arg).")",DEBUG);
242 if (ref($arg) && UNIVERSAL::isa($arg => 'Fieldmapper')) {
243 return $self->create_from_fieldmapper($arg,@_);
246 return $self->SUPER::create($arg,@_);
249 sub create_from_fieldmapper {
254 $log->debug("Creating node of type ".ref($fm), DEBUG);
256 my $class = ref($obj) || $obj;
257 my ($primary) = $class->columns('Primary');
259 if (ref($fm) &&UNIVERSAL::isa($fm => 'Fieldmapper')) {
260 my %hash = map { defined $fm->$_ ?
263 } grep { $_ ne $primary } $class->columns('Essential');
265 if ($class->find_column( 'last_xact_id' )) {
266 if ($OpenILS::Application::Storage::IGNORE_XACT_ID_FAILURE) {
267 $hash{last_xact_id} = 'unknown.'.time.'.'.$$.'.'.rand($$);
269 my $xact_id = $class->current_xact_id;
270 throw Error unless ($xact_id);
271 $hash{last_xact_id} = $xact_id;
275 return $class->create( \%hash, @params );
286 my $class = ref($self) || $self;
288 $self = $self->retrieve($arg) if (!ref($self));
289 unless (defined $self) {
290 $log->debug("ARG! Couldn't retrieve record ".$arg->id, DEBUG);
291 throw OpenSRF::EX::WARN ("ARG! Couldn't retrieve record ");
294 if ($class->find_column( 'last_xact_id' )) {
295 my $xact_id = $self->current_xact_id;
297 throw Error ("Deleting from $class requires a transaction be established")
300 throw Error ("The row you are attempting to delete has been changed since you read it")
301 unless ( $orig->last_xact_id eq $self->last_xact_id);
303 $self->last_xact_id( $class->current_xact_id );
304 $self->SUPER::update;
307 $self->SUPER::delete;
316 $string .= "Object type:\t".ref($obj)."\n";
317 $string .= "Object string:\t$obj\n";
319 if (ref($obj) && UNIVERSAL::isa($obj => 'Fieldmapper')) {
320 $string .= "Object fields:\n";
321 for my $col ($obj->real_fields()) {
322 $string .= "\t$col\t=> ".$obj->$col."\n";
324 } elsif (ref($obj) && UNIVERSAL::isa($obj => 'Class::DBI')) {
325 $string .= "Object cols:\n";
326 for my $col ($obj->columns('All')) {
327 $string .= "\t$col\t=> ".$obj->$col."\n";
329 } elsif (ref($obj) && UNIVERSAL::isa($obj => 'HASH')) {
330 $string .= "Object keys and vals:\n";
331 for my $col (keys %$obj) {
332 $string .= "\t$col\t=> $$obj{$col}\n";
338 $log->debug($string,DEBUG);
346 $log->debug("Attempting to update using $arg", DEBUG) if ($arg);
349 $self = $self->modify_from_fieldmapper($arg);
350 unless (defined $self) {
351 $log->debug("Modification of $arg seems to have failed....", DEBUG);
356 $log->debug("Calling Class::DBI->update on modified object $self", DEBUG);
358 #debug_object($self);
360 return $self->SUPER::update if ($self->is_changed);
364 sub modify_from_fieldmapper {
372 $log->debug("Modifying object using fieldmapper", DEBUG);
374 my $class = ref($obj) || $obj;
375 my ($primary) = $class->columns('Primary');
379 $obj = $class->retrieve($fm);
382 $log->debug("Retrieve of $class using $fm (".$fm->id.") failed! -- ".shift(), ERROR);
383 throw OpenSRF::EX::WARN ("No $class with id of ".$fm->id."!!");
389 if (ref($fm) and UNIVERSAL::isa($fm => 'Fieldmapper')) {
390 %hash = map { ($_ => $fm->$_) } grep { $_ ne $primary } $class->columns('Essential');
391 delete $hash{passwd} if ($fm->isa('Fieldmapper::actor::user'));
396 my $au = $obj->autoupdate;
401 for my $field ( keys %hash ) {
402 $obj->$field( $hash{$field} ) if ($obj->$field ne $hash{$field});
403 $log->debug("Setting field $field on $obj to $hash{$field}",INTERNAL);
406 if ($class->find_column( 'last_xact_id' ) and $obj->is_changed) {
407 my ($xact_id) = OpenILS::Application::Storage->method_lookup('open-ils.storage.transaction.current')->run();
408 throw Error ("Updating $class requires a transaction be established")
410 throw Error ("The row you are attempting to delete has been changed since you read it")
411 unless ( $fm->last_xact_id eq $obj->last_xact_id);
412 $obj->last_xact_id( $xact_id );
414 $obj->autoupdate($au)
422 #-------------------------------------------------------------------------------
423 actor::user->has_a( home_ou => 'actor::org_unit' );
424 actor::user->has_a( card => 'actor::card' );
425 actor::user->has_a( standing => 'config::standing' );
426 actor::user->has_a( profile => 'permission::grp_tree' );
427 actor::user->has_a( mailing_address => 'actor::user_address' );
428 actor::user->has_a( billing_address => 'actor::user_address' );
429 actor::user->has_a( ident_type => 'config::identification_type' );
430 actor::user->has_a( ident_type2 => 'config::identification_type' );
431 actor::user->has_a( net_access_level => 'config::net_access_level' );
433 actor::user_address->has_a( usr => 'actor::user' );
435 actor::card->has_a( usr => 'actor::user' );
437 actor::workstation->has_a( owning_lib => 'actor::org_unit' );
438 actor::org_unit::closed_date->has_a( org_unit => 'actor::org_unit' );
439 actor::org_unit_setting->has_a( org_unit => 'actor::org_unit' );
441 actor::usr_note->has_a( usr => 'actor::user' );
442 actor::user->has_many( notes => 'actor::usr_note' );
444 actor::user_standing_penalty->has_a( usr => 'actor::user' );
445 actor::user->has_many( standing_penalties => 'actor::user_standing_penalty' );
447 actor::org_unit->has_a( parent_ou => 'actor::org_unit' );
448 actor::org_unit->has_a( ou_type => 'actor::org_unit_type' );
449 actor::org_unit->has_a( ill_address => 'actor::org_address' );
450 actor::org_unit->has_a( holds_address => 'actor::org_address' );
451 actor::org_unit->has_a( mailing_address => 'actor::org_address' );
452 actor::org_unit->has_a( billing_address => 'actor::org_address' );
453 actor::org_unit->has_many( children => 'actor::org_unit' => 'parent_ou' );
454 actor::org_unit->has_many( workstations => 'actor::workstation' );
455 actor::org_unit->has_many( closed_dates => 'actor::org_unit::closed_date' );
456 actor::org_unit->has_many( settings => 'actor::org_unit_setting' );
457 #actor::org_unit->might_have( hours_of_operation => 'actor::org_unit::hours_of_operation' );
459 actor::org_unit_type->has_a( parent => 'actor::org_unit_type' );
460 actor::org_unit_type->has_many( children => 'actor::org_unit_type' => 'parent' );
462 actor::org_address->has_a( org_unit => 'actor::org_unit' );
463 actor::org_unit->has_many( addresses => 'actor::org_address' );
465 action::transit_copy->has_a( source => 'actor::org_unit' );
466 action::transit_copy->has_a( dest => 'actor::org_unit' );
467 action::transit_copy->has_a( copy_status => 'config::copy_status' );
469 action::hold_transit_copy->has_a( source => 'actor::org_unit' );
470 action::hold_transit_copy->has_a( dest => 'actor::org_unit' );
471 action::hold_transit_copy->has_a( copy_status => 'config::copy_status' );
472 action::hold_transit_copy->has_a( hold => 'action::hold_request' );
474 action::hold_request->has_many( transits => 'action::hold_transit_copy' );
476 actor::stat_cat_entry->has_a( stat_cat => 'actor::stat_cat' );
477 actor::stat_cat->has_a( owner => 'actor::org_unit' );
478 actor::stat_cat->has_many( entries => 'actor::stat_cat_entry' );
479 actor::stat_cat_entry_user_map->has_a( stat_cat => 'actor::stat_cat' );
480 actor::stat_cat_entry_user_map->has_a( stat_cat_entry => 'actor::stat_cat_entry' );
481 actor::stat_cat_entry_user_map->has_a( target_usr => 'actor::user' );
483 asset::stat_cat_entry->has_a( stat_cat => 'asset::stat_cat' );
484 asset::stat_cat->has_a( owner => 'actor::org_unit' );
485 asset::stat_cat->has_many( entries => 'asset::stat_cat_entry' );
486 asset::stat_cat_entry_copy_map->has_a( stat_cat => 'asset::stat_cat' );
487 asset::stat_cat_entry_copy_map->has_a( stat_cat_entry => 'asset::stat_cat_entry' );
488 asset::stat_cat_entry_copy_map->has_a( owning_copy => 'asset::copy' );
490 action::survey_response->has_a( usr => 'actor::user' );
491 action::survey_response->has_a( survey => 'action::survey' );
492 action::survey_response->has_a( question => 'action::survey_question' );
493 action::survey_response->has_a( answer => 'action::survey_answer' );
495 action::survey_question->has_a( survey => 'action::survey' );
497 action::survey_answer->has_a( question => 'action::survey_question' );
499 asset::copy_note->has_a( owning_copy => 'asset::copy' );
500 asset::copy_note->has_a( creator => 'actor::user' );
502 actor::user->has_many( stat_cat_entries => [ 'actor::stat_cat_entry_user_map' => 'stat_cat_entry' ] );
503 actor::user->has_many( stat_cat_entry_user_maps => 'actor::stat_cat_entry_user_map' );
505 asset::copy->has_many( stat_cat_entries => [ 'asset::stat_cat_entry_copy_map' => 'stat_cat_entry' ] );
506 asset::copy->has_many( stat_cat_entry_copy_maps => 'asset::stat_cat_entry_copy_map' );
508 asset::copy->has_a( call_number => 'asset::call_number' );
509 asset::copy->has_a( creator => 'actor::user' );
510 asset::copy->has_a( editor => 'actor::user' );
511 asset::copy->has_a( status => 'config::copy_status' );
512 asset::copy->has_a( location => 'asset::copy_location' );
513 asset::copy->has_a( circ_lib => 'actor::org_unit' );
515 asset::call_number_note->has_a( call_number => 'asset::call_number' );
517 asset::call_number->has_a( record => 'biblio::record_entry' );
518 asset::call_number->has_a( creator => 'actor::user' );
519 asset::call_number->has_a( editor => 'actor::user' );
520 asset::call_number->has_a( owning_lib => 'actor::org_unit' );
522 authority::record_note->has_a( record => 'authority::record_entry' );
523 biblio::record_note->has_a( record => 'biblio::record_entry' );
525 authority::record_entry->has_a( creator => 'actor::user' );
526 authority::record_entry->has_a( editor => 'actor::user' );
527 biblio::record_entry->has_a( creator => 'actor::user' );
528 biblio::record_entry->has_a( editor => 'actor::user' );
530 metabib::metarecord->has_a( master_record => 'biblio::record_entry' );
532 authority::record_descriptor->has_a( record => 'authority::record_entry' );
533 metabib::record_descriptor->has_a( record => 'biblio::record_entry' );
535 authority::full_rec->has_a( record => 'authority::record_entry' );
536 metabib::full_rec->has_a( record => 'biblio::record_entry' );
538 metabib::title_field_entry->has_a( source => 'biblio::record_entry' );
539 metabib::title_field_entry->has_a( field => 'config::metabib_field' );
541 metabib::author_field_entry->has_a( source => 'biblio::record_entry' );
542 metabib::author_field_entry->has_a( field => 'config::metabib_field' );
544 metabib::subject_field_entry->has_a( source => 'biblio::record_entry' );
545 metabib::subject_field_entry->has_a( field => 'config::metabib_field' );
547 metabib::keyword_field_entry->has_a( source => 'biblio::record_entry' );
548 metabib::keyword_field_entry->has_a( field => 'config::metabib_field' );
550 metabib::series_field_entry->has_a( source => 'biblio::record_entry' );
551 metabib::series_field_entry->has_a( field => 'config::metabib_field' );
553 metabib::metarecord_source_map->has_a( metarecord => 'metabib::metarecord' );
554 metabib::metarecord_source_map->has_a( source => 'biblio::record_entry' );
556 action::circulation->has_a( usr => 'actor::user' );
557 actor::user->has_many( circulations => 'action::circulation' => 'usr' );
559 action::circulation->has_a( circ_staff => 'actor::user' );
560 actor::user->has_many( performed_circulations => 'action::circulation' => 'circ_staff' );
562 action::circulation->has_a( checkin_staff => 'actor::user' );
563 actor::user->has_many( checkins => 'action::circulation' => 'checkin_staff' );
565 action::circulation->has_a( target_copy => 'asset::copy' );
566 asset::copy->has_many( circulations => 'action::circulation' => 'target_copy' );
568 action::circulation->has_a( circ_lib => 'actor::org_unit' );
569 actor::org_unit->has_many( circulations => 'action::circulation' => 'circ_lib' );
571 action::circulation->has_a( checkin_lib => 'actor::org_unit' );
572 actor::org_unit->has_many( checkins => 'action::circulation' => 'checkin_lib' );
574 money::billable_transaction->has_a( usr => 'actor::user' );
575 #money::billable_transaction->might_have( circulation => 'action::circulation' );
576 #money::billable_transaction->might_have( grocery => 'money::grocery' );
577 actor::user->has_many( billable_transactions => 'action::circulation' => 'usr' );
580 #-------------------------------------------------------------------------------
581 actor::user->has_many( survey_responses => 'action::survey_response' );
582 actor::user->has_many( addresses => 'actor::user_address' );
583 actor::user->has_many( cards => 'actor::card' );
585 actor::org_unit->has_many( users => 'actor::user' );
587 action::survey->has_many( questions => 'action::survey_question' );
588 action::survey->has_many( responses => 'action::survey_response' );
590 action::survey_question->has_many( answers => 'action::survey_answer' );
591 action::survey_question->has_many( responses => 'action::survey_response' );
593 action::survey_answer->has_many( responses => 'action::survey_response' );
595 asset::copy->has_many( notes => 'asset::copy_note' );
596 asset::call_number->has_many( copies => 'asset::copy' );
597 asset::call_number->has_many( notes => 'asset::call_number_note' );
599 authority::record_entry->has_many( record_descriptor => 'authority::record_descriptor' );
600 authority::record_entry->has_many( notes => 'authority::record_note' );
602 biblio::record_entry->has_many( record_descriptor => 'metabib::record_descriptor' );
603 biblio::record_entry->has_many( notes => 'biblio::record_note' );
604 biblio::record_entry->has_many( call_numbers => 'asset::call_number' );
605 biblio::record_entry->has_many( full_record_entries => 'metabib::full_rec' );
606 biblio::record_entry->has_many( title_field_entries => 'metabib::title_field_entry' );
607 biblio::record_entry->has_many( author_field_entries => 'metabib::author_field_entry' );
608 biblio::record_entry->has_many( subject_field_entries => 'metabib::subject_field_entry' );
609 biblio::record_entry->has_many( keyword_field_entries => 'metabib::keyword_field_entry' );
610 biblio::record_entry->has_many( series_field_entries => 'metabib::series_field_entry' );
612 metabib::metarecord->has_many( source_records => [ 'metabib::metarecord_source_map' => 'source'] );
613 biblio::record_entry->has_many( metarecords => [ 'metabib::metarecord_source_map' => 'metarecord'] );
615 money::billable_transaction->has_many( billings => 'money::billing' );
616 money::billable_transaction->has_many( payments => 'money::payment' );
618 action::circulation->has_many( billings => 'money::billing' => 'xact' );
619 action::circulation->has_many( payments => 'money::payment' => 'xact' );
620 #action::circulation->might_have( billable_transaction => 'money::billable_transaction' );
622 #action::open_circulation->might_have( circulation => 'action::circulation' );
624 action::in_house_use->has_a( org_unit => 'actor::org_unit' );
625 action::in_house_use->has_a( staff => 'actor::user' );
626 action::in_house_use->has_a( item => 'asset::copy' );
628 action::non_cataloged_circulation->has_a( circ_lib => 'actor::org_unit' );
629 action::non_cataloged_circulation->has_a( item_type => 'config::non_cataloged_type' );
630 action::non_cataloged_circulation->has_a( patron => 'actor::user' );
631 action::non_cataloged_circulation->has_a( staff => 'actor::user' );
633 money::grocery->has_many( billings => 'money::billing' => 'xact' );
634 money::grocery->has_many( payments => 'money::payment' => 'xact' );
635 #money::grocery->might_have( billable_transaction => 'money::billable_transaction' );
637 money::billing->has_a( xact => 'money::billable_transaction' );
638 money::payment->has_a( xact => 'money::billable_transaction' );
639 #money::payment->might_have( cash_payment => 'money::cash_payment' );
640 #money::payment->might_have( check_payment => 'money::check_payment' );
641 #money::payment->might_have( credit_card_payment => 'money::credit_card_payment' );
642 #money::payment->might_have( forgive_payment => 'money::forgive_payment' );
643 #money::payment->might_have( work_payment => 'money::work_payment' );
644 #money::payment->might_have( credit_payment => 'money::credit_payment' );
646 money::cash_payment->has_a( xact => 'money::billable_transaction' );
647 money::cash_payment->has_a( accepting_usr => 'actor::user' );
648 #money::cash_payment->might_have( payment => 'money::payment' );
650 money::check_payment->has_a( xact => 'money::billable_transaction' );
651 money::check_payment->has_a( accepting_usr => 'actor::user' );
652 #money::check_payment->might_have( payment => 'money::payment' );
654 money::credit_card_payment->has_a( xact => 'money::billable_transaction' );
655 money::credit_card_payment->has_a( accepting_usr => 'actor::user' );
656 #money::credit_card_payment->might_have( payment => 'money::payment' );
658 money::forgive_payment->has_a( xact => 'money::billable_transaction' );
659 money::forgive_payment->has_a( accepting_usr => 'actor::user' );
660 #money::forgive_payment->might_have( payment => 'money::payment' );
662 money::work_payment->has_a( xact => 'money::billable_transaction' );
663 money::work_payment->has_a( accepting_usr => 'actor::user' );
664 #money::work_payment->might_have( payment => 'money::payment' );
666 money::credit_payment->has_a( xact => 'money::billable_transaction' );
667 money::credit_payment->has_a( accepting_usr => 'actor::user' );
668 #money::credit_payment->might_have( payment => 'money::payment' );
670 permission::grp_tree->has_a( parent => 'permission::grp_tree' );
671 permission::grp_tree->has_many( children => 'permission::grp_tree' => 'parent' );
673 permission::grp_perm_map->has_a( grp => 'permission::grp_tree' );
674 permission::grp_perm_map->has_a( perm => 'permission::perm_list' );
675 permission::grp_perm_map->has_a( depth => 'actor::org_unit_type' );
677 permission::usr_perm_map->has_a( usr => 'actor::user' );
678 permission::usr_perm_map->has_a( perm => 'permission::perm_list' );
679 permission::usr_perm_map->has_a( depth => 'actor::org_unit_type' );
681 permission::usr_grp_map->has_a( usr => 'actor::user' );
682 permission::usr_grp_map->has_a( grp => 'permission::grp_tree' );
684 action::hold_notification->has_a( hold => 'action::hold_request' );
686 action::hold_copy_map->has_a( hold => 'action::hold_request' );
687 action::hold_copy_map->has_a( target_copy => 'asset::copy' );
689 action::unfulfilled_hold_list->has_a( current_copy => 'asset::copy' );
690 action::unfulfilled_hold_list->has_a( hold => 'action::hold_request' );
691 action::unfulfilled_hold_list->has_a( circ_lib => 'actor::org_unit' );
693 action::hold_request->has_a( current_copy => 'asset::copy' );
694 action::hold_request->has_a( requestor => 'actor::user' );
695 action::hold_request->has_a( usr => 'actor::user' );
696 action::hold_request->has_a( fulfillment_staff => 'actor::user' );
697 action::hold_request->has_a( pickup_lib => 'actor::org_unit' );
698 action::hold_request->has_a( request_lib => 'actor::org_unit' );
699 action::hold_request->has_a( fulfillment_lib => 'actor::org_unit' );
700 action::hold_request->has_a( selection_ou => 'actor::org_unit' );
702 action::hold_request->has_many( notifications => 'action::hold_notification' );
703 action::hold_request->has_many( eligible_copies => [ 'action::hold_copy_map' => 'target_copy' ] );
705 asset::copy->has_many( holds => [ 'action::hold_copy_map' => 'hold' ] );
707 container::biblio_record_entry_bucket->has_a( owner => 'actor::user' );
708 container::biblio_record_entry_bucket_item->has_a( bucket => 'container::biblio_record_entry_bucket' );
709 container::biblio_record_entry_bucket_item->has_a( target_biblio_record_entry => 'biblio::record_entry' );
710 container::biblio_record_entry_bucket->has_many( items => 'container::biblio_record_entry_bucket_item' );
712 container::user_bucket->has_a( owner => 'actor::user' );
713 container::user_bucket_item->has_a( bucket => 'container::user_bucket' );
714 container::user_bucket_item->has_a( target_user => 'actor::user' );
715 container::user_bucket->has_many( items => 'container::user_bucket_item' );
717 container::call_number_bucket->has_a( owner => 'actor::user' );
718 container::call_number_bucket_item->has_a( bucket => 'container::call_number_bucket' );
719 container::call_number_bucket_item->has_a( target_call_number => 'asset::call_number' );
720 container::call_number_bucket->has_many( items => 'container::call_number_bucket_item' );
722 container::copy_bucket->has_a( owner => 'actor::user' );
723 container::copy_bucket_item->has_a( bucket => 'container::copy_bucket' );
724 container::copy_bucket_item->has_a( target_copy => 'asset::copy' );
725 container::copy_bucket->has_many( items => 'container::copy_bucket_item' );