2 package MOBY
::simple_input
;
6 use vars
qw($AUTOLOAD @ISA);
10 MOBY::simple_input - a lightweight connection to the
11 simple_input table in the database
15 NON FUNCTIONAL AT THIS TIME
17 use MOBY::simple_input;
18 my $Instance = MOBY::simple_input->new(
19 object_type => "Sequence",
20 namespaces => ["genbank/gi", "genbank/Acc"],
21 article_name => "InputSequenceThingy",
23 print $Instance->simple_input_id;
24 print $Instance->service_instance_id;
31 representation of the simple_input table. Can write to the database
35 Mark Wilkinson (mwilkinson@gene.pbi.nrc.ca)
44 #___________________________________________________________
46 my %_attr_data = # DEFAULT ACCESSIBILITY
48 simple_input_id => [ undef, 'read/write' ],
49 object_type_uri => [ undef, 'read/write' ],
50 namespace_type_uris => [ undef, 'read/write' ],
51 article_name => [ undef, 'read/write' ],
52 service_instance_id => [ undef, 'read/write' ],
53 service_instance_lsid => [ undef, 'read/write' ],
54 collection_input_id => [ undef, 'read/write' ],
55 dbh => [ undef, 'read/write' ],
58 #_____________________________________________________________
59 # METHODS, to operate on encapsulated class data
60 # Is a specified object attribute accessible in a given mode
62 my ( $self, $attr, $mode ) = @_;
63 $_attr_data{$attr}[1] =~ /$mode/;
66 # Classwide default value for a specified object attribute
68 my ( $self, $attr ) = @_;
69 $_attr_data{$attr}[0];
72 # List of names of all specified object attributes
79 my ( $caller, %args ) = @_;
80 my $caller_is_obj = ref($caller);
81 return $caller if $caller_is_obj;
82 my $class = $caller_is_obj || $caller;
84 my $self = bless {}, $class;
85 foreach my $attrname ( $self->_standard_keys ) {
86 if ( exists $args{$attrname} ) {
87 $self->{$attrname} = $args{$attrname};
88 } elsif ($caller_is_obj) {
89 $self->{$attrname} = $caller->{$attrname};
91 $self->{$attrname} = $self->_default_for($attrname);
94 my $id = $self->WRITE;
95 $self->simple_input_id($id) if defined $id;
101 $CONFIG ||= MOBY::Config->new; # exported by Config.pm
102 my $adaptor = $CONFIG->getDataAdaptor( datasource => 'mobycentral' );
103 my $id = $adaptor->insert_simple_input(
104 object_type_uri => $self->object_type_uri,
105 namespace_type_uris => $self->namespace_type_uris,
106 article_name => $self->article_name,
107 service_instance_lsid => $self->service_instance_lsid,
108 collection_input_id => $self->collection_input_id
115 my ( $self, $newval ) = @_;
116 $AUTOLOAD =~ /.*::(\w+)/;
118 if ( $self->_accessible( $attr, 'write' ) ) {
120 if ( defined $_[1] ) { $_[0]->{$attr} = $_[1] }
121 return $_[0]->{$attr};
122 }; ### end of created subroutine
123 ### this is called first time only
124 if ( defined $newval ) {
125 $self->{$attr} = $newval;
127 return $self->{$attr};
128 } elsif ( $self->_accessible( $attr, 'read' ) ) {
130 return $_[0]->{$attr};
131 }; ### end of created subroutine
132 return $self->{$attr};
135 # Must have been a mistake then...
136 croak "No such method: $AUTOLOAD";