2 package MOBY
::simple_output
;
6 use vars
qw($AUTOLOAD @ISA);
10 MOBY::simple_output - a lightweight connection to the
11 simple_output table in the database
15 NON FUNCTIONAL AT THIS TIME
16 use MOBY::simple_output;
17 my $Instance = MOBY::simple_output->new(
18 object_type => "Sequence",
19 namespaces => ["genbank/gi", "genbank/Acc"],
20 article_name => "InputSequenceThingy",
22 print $Instance->simple_output_id;
23 print $Instance->service_instance_id;
30 representation of the simple_output table. Can write to the database
34 Mark Wilkinson (mwilkinson@gene.pbi.nrc.ca)
43 #___________________________________________________________
45 my %_attr_data = # DEFAULT ACCESSIBILITY
47 simple_output_id => [ undef, 'read/write' ],
48 object_type_uri => [ undef, 'read/write' ],
49 namespace_type_uris => [ undef, 'read/write' ],
50 article_name => [ undef, 'read/write' ],
51 service_instance_id => [ undef, 'read/write' ],
52 service_instance_lsid => [ undef, 'read/write' ],
53 collection_output_id => [ undef, 'read/write' ],
54 dbh => [ undef, 'read/write' ],
57 #_____________________________________________________________
58 # METHODS, to operate on encapsulated class data
59 # Is a specified object attribute accessible in a given mode
61 my ( $self, $attr, $mode ) = @_;
62 $_attr_data{$attr}[1] =~ /$mode/;
65 # Classwide default value for a specified object attribute
67 my ( $self, $attr ) = @_;
68 $_attr_data{$attr}[0];
71 # List of names of all specified object attributes
78 my ( $caller, %args ) = @_;
79 my $caller_is_obj = ref($caller);
80 return $caller if $caller_is_obj;
81 my $class = $caller_is_obj || $caller;
83 my $self = bless {}, $class;
84 foreach my $attrname ( $self->_standard_keys ) {
85 if ( exists $args{$attrname} ) {
86 $self->{$attrname} = $args{$attrname};
87 } elsif ($caller_is_obj) {
88 $self->{$attrname} = $caller->{$attrname};
90 $self->{$attrname} = $self->_default_for($attrname);
93 my $id = $self->WRITE;
94 $self->simple_output_id($id) if defined $id;
100 $CONFIG ||= MOBY::Config->new; # exported by Config.pm
101 my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' );
102 my $id = $adaptor->insert_simple_output(
103 object_type_uri => $self->object_type_uri,
104 namespace_type_uris => $self->namespace_type_uris,
105 article_name => $self->article_name,
106 service_instance_lsid => $self->service_instance_lsid,
107 collection_output_id => $self->collection_output_id
114 my ( $self, $newval ) = @_;
115 $AUTOLOAD =~ /.*::(\w+)/;
117 if ( $self->_accessible( $attr, 'write' ) ) {
119 if ( defined $_[1] ) { $_[0]->{$attr} = $_[1] }
120 return $_[0]->{$attr};
121 }; ### end of created subroutine
122 ### this is called first time only
123 if ( defined $newval ) {
124 $self->{$attr} = $newval;
126 return $self->{$attr};
127 } elsif ( $self->_accessible( $attr, 'read' ) ) {
129 return $_[0]->{$attr};
130 }; ### end of created subroutine
131 return $self->{$attr};
134 # Must have been a mistake then...
135 croak "No such method: $AUTOLOAD";