#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::Statement::Mechanical::StatementPublisherTransactionList;

use strict;
use warnings;
use Carp;

use Data::Dumper;

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

use lib '/app/tools/rps/lib';

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

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

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

    my $statementID = $args{mechanicalStatementID};
    my $publisherID = $args{publisherID};

    $self->{MechanicalStatementPublisherTransaction} = [];
    if ( $statementID && $publisherID ) {
        my $collection = $self->_getStatementPublisherTransactionCollection( $statementID, $publisherID );

        while ( $collection->hasNext() ) {
            my $obj = $collection->next();

            my $trans = $self->_getStatementPublisherTransaction($obj);
            push @{ $self->{MechanicalStatementPublisherTransaction} }, $trans;
        }
    }

    return $self;
}

sub _getStatementPublisherTransactionCollection {
    my ( $self, $statementID ) = @_;
    assert( 0, 'override this' );
}

sub _getStatementPublisherTransaction {
    my ( $self, $dbItem ) = @_;
    assert( 0, 'override this' );
}

sub getList {
    my ($self) = @_;

    return $self->{MechanicalStatementPublisherTransaction};
}

1;
