#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------
package RPS::ArtistRoleList;

use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::Assert;

use lib '/app/tools/rps/lib';
use RPS::ArtistRole;
use RPS::DB::Item::ArtistRole;

use Common::FormObject;
use base 'Common::FormObject';

# This is a read-only XMLObject, so we don't need any
# of the accessor methods, just create the list of
# items and be on your way.
#

sub _init
{
    my ($self, %args) = @_;

    $self->SUPER::_init(%args);

    $self->{ArtistRole} = [];
	my $collection = RPS::DB::Item::ArtistRole->GetAll();

    # !!! We require there to be a list of labels.
    # !!! If there isn't at least one, then we have not set up this client correctly.
    #
    assert($collection->size() > 0);

	while ($collection->hasNext())
	{
		my $obj = $collection->next();
		push @{$self->{ArtistRole}}, RPS::ArtistRole->new(_dbItem => $obj);
	}

    return $self;
}


1;
