1 package MOBY
::collection_input
;
5 use vars
qw($AUTOLOAD @ISA);
9 MOBY::collection_input - a lightweight connection to the
10 collection_input table in the database
14 NON FUNCTIONAL AT THIS TIME
16 use MOBY::collection_input;
17 my $Instance = MOBY::collection_input->new(
18 object_type => "Sequence",
19 namespaces => ["genbank/gi", "genbank/Acc"],
20 article_name => "InputSequenceThingy",
29 representation of the collection_input table. Can write to the database
33 Mark Wilkinson (mwilkinson@gene.pbi.nrc.ca)
42 #___________________________________________________________
44 my %_attr_data = # DEFAULT ACCESSIBILITY
46 collection_input_id => [ undef, 'read/write' ],
47 article_name => [ undef, 'read/write' ],
48 service_instance_id => [ undef, 'read/write' ],
49 service_instance_lsid => [ undef, 'read/write' ],
50 dbh => [ undef, 'read/write' ],
53 #_____________________________________________________________
54 # METHODS, to operate on encapsulated class data
55 # Is a specified object attribute accessible in a given mode
57 my ( $self, $attr, $mode ) = @_;
58 $_attr_data{$attr}[1] =~ /$mode/;
61 # Classwide default value for a specified object attribute
63 my ( $self, $attr ) = @_;
64 $_attr_data{$attr}[0];
67 # List of names of all specified object attributes
74 my ( $caller, %args ) = @_;
75 my $caller_is_obj = ref($caller);
76 return $caller if $caller_is_obj;
77 my $class = $caller_is_obj || $caller;
79 my $self = bless {}, $class;
80 foreach my $attrname ( $self->_standard_keys ) {
81 if ( exists $args{$attrname} ) {
82 $self->{$attrname} = $args{$attrname};
83 } elsif ($caller_is_obj) {
84 $self->{$attrname} = $caller->{$attrname};
86 $self->{$attrname} = $self->_default_for($attrname);
89 my $id = $self->WRITE;
90 $self->collection_input_id($id) if defined $id;
96 $CONFIG ||= MOBY::Config->new; # exported by Config.pm
97 my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' );
98 my $id = $adaptor->insert_collection_input(service_instance_lsid => $self->service_instance_lsid,
99 article_name => $self->article_name);
105 my ( $self, $newval ) = @_;
106 $AUTOLOAD =~ /.*::(\w+)/;
108 if ( $self->_accessible( $attr, 'write' ) ) {
110 if ( defined $_[1] ) { $_[0]->{$attr} = $_[1] }
111 return $_[0]->{$attr};
112 }; ### end of created subroutine
113 ### this is called first time only
114 if ( defined $newval ) {
115 $self->{$attr} = $newval;
117 return $self->{$attr};
118 } elsif ( $self->_accessible( $attr, 'read' ) ) {
120 return $_[0]->{$attr};
121 }; ### end of created subroutine
122 return $self->{$attr};
125 # Must have been a mistake then...
126 croak "No such method: $AUTOLOAD";