2 package MOBY
::collection_output
;
6 use vars
qw($AUTOLOAD @ISA);
10 MOBY::collection_output - a lightweight connection to the
11 collection_output table in the database
15 NON FUNCTIONAL AT THIS TIME
16 use MOBY::collection_output;
17 my $Instance = MOBY::collection_output->new(
18 object_type => "Sequence",
19 namespaces => ["genbank/gi", "genbank/Acc"],
20 article_name => "InputSequenceThingy",
28 representation of the collection_output table. Can write to the database
32 Mark Wilkinson (mwilkinson@gene.pbi.nrc.ca)
41 #___________________________________________________________
43 my %_attr_data = # DEFAULT ACCESSIBILITY
45 collection_output_id => [ undef, 'read/write' ],
46 article_name => [ undef, 'read/write' ],
47 service_instance_id => [ undef, 'read/write' ],
48 service_instance_lsid => [ undef, 'read/write' ],
49 dbh => [ undef, 'read/write' ],
52 #_____________________________________________________________
53 # METHODS, to operate on encapsulated class data
54 # Is a specified object attribute accessible in a given mode
56 my ( $self, $attr, $mode ) = @_;
57 $_attr_data{$attr}[1] =~ /$mode/;
60 # Classwide default value for a specified object attribute
62 my ( $self, $attr ) = @_;
63 $_attr_data{$attr}[0];
66 # List of names of all specified object attributes
73 my ( $caller, %args ) = @_;
74 my $caller_is_obj = ref($caller);
75 return $caller if $caller_is_obj;
76 my $class = $caller_is_obj || $caller;
78 my $self = bless {}, $class;
79 foreach my $attrname ( $self->_standard_keys ) {
80 if ( exists $args{$attrname} ) {
81 $self->{$attrname} = $args{$attrname};
82 } elsif ($caller_is_obj) {
83 $self->{$attrname} = $caller->{$attrname};
85 $self->{$attrname} = $self->_default_for($attrname);
88 my $id = $self->WRITE;
89 $self->collection_output_id($id) if defined $id;
95 $CONFIG ||= MOBY::Config->new; # exported by Config.pm
96 my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' );
97 my $id = $adaptor->insert_collection_output(
98 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";