| 1 | package ETLp::Audit::Browser::Model::FileProcess; | ||
| 2 | |||
| 3 | use MooseX::Declare; | ||
| 4 | |||
| 5 | class ETLp::Audit::Browser::Model::FileProcess with | ||
| 6 | (ETLp::Role::Config, ETLp::Role::Schema, ETLp::Role::Audit, | ||
| 7 | ETLp::Role::Browser) { | ||
| 8 | |||
| 9 | method get_file_processes(Maybe[Int] :$page?, Maybe[Int] :$item_id?, Maybe[Int] :$file_id?) { | ||
| 10 | |||
| 11 | my $criteria = {}; | ||
| 12 | $criteria->{item_id} = $item_id if ($item_id); | ||
| 13 | $criteria->{file_id} = $file_id if ($file_id); | ||
| 14 | |||
| 15 | my $processes = $self->EtlpFileProcess()->search( | ||
| 16 | $criteria, | ||
| 17 | { | ||
| 18 | page => $page, | ||
| 19 | rows => $self->pagesize, | ||
| 20 | order_by => 'date_updated desc, file_proc_id desc' | ||
| 21 | } | ||
| 22 | ); | ||
| 23 | return $processes; | ||
| 24 | } | ||
| 25 | |||
| 26 | method get_canonical_file(Int $file_id) { | ||
| 27 | return $self->EtlpFile()->find($file_id); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | =head1 NAME | ||
| 32 | |||
| 33 | ETLp::Audit::Browser::Model::FileProcess - Model Class for interacting | ||
| 34 | with Runtime FileProcess Audit Records | ||
| 35 | |||
| 36 | =head1 SYNOPSIS | ||
| 37 | |||
| 38 | use ETLp::Audit::Browser::Model::FileProcess; | ||
| 39 | |||
| 40 | my $model = ETLp::Audit::Browser::Model::FileProcess->new(); | ||
| 41 | my $processes = $model->get_file_processes(item_id => 1013); | ||
| 42 | |||
| 43 | =head1 METHODS | ||
| 44 | |||
| 45 | =head2 get_file_processes | ||
| 46 | |||
| 47 | Returns a resultset on the ep_process table. It will grab 20 rows at | ||
| 48 | a time, and is ordered by date_updated descending | ||
| 49 | |||
| 50 | =head3 Parameters | ||
| 51 | |||
| 52 | * item_id. Optional. Filter by the parent item | ||
| 53 | * file_id. Optional. Specific file processed | ||
| 54 | * page. Integer. The page you wish to return. Defaults to 1 | ||
| 55 | |||
| 56 | =head3 Returns | ||
| 57 | |||
| 58 | * A DBIx::Class resultset | ||
| 59 | |||
| 60 | =head2 get_canonical_file | ||
| 61 | |||
| 62 | Given a file_id, return the canonical file record | ||
| 63 | |||
| 64 | =head1 LICENSE AND COPYRIGHT | ||
| 65 | |||
| 66 | Copyright 2010 Redbone Systems Ltd | ||
| 67 | |||
| 68 | This program is free software; you can redistribute it and/or modify it | ||
| 69 | under the terms of either: the GNU General Public License as published | ||
| 70 | by the Free Software Foundation; or the Artistic License. | ||
| 71 | |||
| 72 | The terms are in the LICENSE file that accompanies this application | ||
| 73 | |||
| 74 | =cut |