#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package Support::FileManagement::AssetCollection;

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

use lib '/app/tools/appuser/lib';

use lib '/app/tools/rps/lib';
use RPS::Pagination;
use RPS::AlphabeticalPagination;

use RPS::Command;

use constant kDefaultPageSize => 30;

use base 'Support::Collection';

sub _query {
    my $self = shift;

    $self->{_collection} = $self->_get_collection()
      unless ( $self->{_collection} );

    $self->{_collection}->setPagination( pageIndex => $self->{_pageIndex} - 1, pageSize => $self->{_pageSize} );

    $self->{List}->{Item} = [];

    return unless ( $self->{_collection} );

    eval "require $self->{_xmlClass}";
    die $@ if ($@);

    while ( $self->{_collection}->hasNext() ) {
        my $data = $self->{_collection}->next();
        push( @{ $self->{List}->{Item} }, $self->{_xmlClass}->new( upc => $data->{upc} ) );
    }
}

###
1;    # Play nicely.
###
