#---------------------------------------------------------------
# ____                   _ _         ____  _
#|  _ \ ___  _   _  __ _| | |_ _   _/ ___|| |__   __ _ _ __ ___
#| |_) / _ \| | | |/ _` | | __| | | \___ \| '_ \ / _` | '__/ _ \
#|  _ < (_) | |_| | (_| | | |_| |_| |___) | | | | (_| | | |  __/
#|_| \_\___/ \__, |\__,_|_|\__|\__, |____/|_| |_|\__,_|_|  \___|
#            |___/             |___/
#
# Copyright (C) 2011 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#---------------------------------------------------------------
package Support::BookPub::POSFileList;
use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::Assert;
use lib '/app/tools/bookpub/lib';
use BookPub::DB::Item::POSFile;
use BookPub::POS::Tracker::File;

use base 'Common::FormObject::List::NumericPaged';

sub _itemName { return 'PosFile'; }

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

    my $files = BookPub::DB::Item::POSFile->GetAllSorted(
        sort_by   => $args{sortBy},
        sort_desc => $args{reverseSort},
    );

    $files->setPagination( pageIndex => $args{page}, pageSize => $args{pageSize} );
    $self->{TotalRecords} = $files->totalSize;

    return $files;
}

sub _getObj {
    my ( $self, $dbItem ) = @_;
    assert($dbItem);

    return BookPub::POS::Tracker::File->new( dbItem => $dbItem, readOnly => 1 );
}

1;
