ResourceClass.pm 1.86 KB
Newer Older
1 2 3 4
=pod 

=head1 NAME

5
    Bio::EnsEMBL::Hive::ResourceClass
6 7 8 9 10 11 12 13 14 15

=head1 DESCRIPTION

    A data container object (the only methods are getters/setters) that corresponds to a row in 'resource_class' table:

    CREATE TABLE resource_class (
        resource_class_id   int(10) unsigned NOT NULL AUTO_INCREMENT,     # unique internal id
        name                varchar(40) NOT NULL,

        PRIMARY KEY(resource_class_id)
16 17 18 19
    );

=head1 LICENSE

20
    Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
21 22 23 24 25 26 27 28 29

    Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software distributed under the License
    is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and limitations under the License.
30 31 32

=head1 CONTACT

33
    Please contact ehive-users@ebi.ac.uk mailing list with questions/suggestions.
34 35 36

=cut

37

38 39 40
package Bio::EnsEMBL::Hive::ResourceClass;

use strict;
41 42

use Bio::EnsEMBL::Utils::Argument ('rearrange');
43 44 45

use base (  'Bio::EnsEMBL::Storable',       # inherit dbID(), adaptor() and new() methods
         );
46 47 48 49 50
 

sub new {
    my $class = shift @_;

51
    my $self = $class->SUPER::new( @_ );    # deal with Storable stuff
52

53 54
    my ($name) =
         rearrange([qw(name) ], @_);
55

56
    $self->name($name) if($name);
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

    return $self;
}


sub name {
    my $self = shift @_;

    if(@_) {
        $self->{'_name'} = shift @_;
    }
    return $self->{'_name'};
}


72
sub toString {
73 74 75 76 77 78 79
    my $self = shift @_;

    return (ref($self).': '.join(', ', map { $_.'="'.$self->$_().'"' } qw(dbID name) ));
}

1;