line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Changeset::Collection; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
63634
|
use warnings; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
121
|
|
4
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
130
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
26
|
use base qw/Class::Factory DBIx::Changeset/; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
2802
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
2340
|
use vars qw{$VERSION}; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
173
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
4
|
|
|
4
|
|
5288
|
$VERSION = '1.11'; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
DBIx::Changeset::Collection - Factory Interface to a collection of changeset files |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Factory Interface to a collection of changeset files |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Perhaps a little code snippet. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use DBIx::Changeset::Collection; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $foo = DBIx::Changeset::Collection->new('type', $opts); |
26
|
|
|
|
|
|
|
... |
27
|
|
|
|
|
|
|
$foo->find_all(); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my @ATTRS = qw/files current_index/; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@ATTRS); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 INTERFACE |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 retrieve_all |
41
|
|
|
|
|
|
|
This is the find_all interface to implement in your own class |
42
|
|
|
|
|
|
|
=cut |
43
|
0
|
|
|
0
|
1
|
0
|
sub retrieve_all { |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 retrieve_like |
49
|
|
|
|
|
|
|
This is the find_like interface to implement in your own class |
50
|
|
|
|
|
|
|
=cut |
51
|
0
|
|
|
0
|
1
|
0
|
sub retrieve_like { |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 add_changeset |
55
|
|
|
|
|
|
|
This is the add_changeset interface implement in your own class |
56
|
|
|
|
|
|
|
creates a new record based on uri and adds to end of current file list |
57
|
|
|
|
|
|
|
=cut |
58
|
0
|
|
|
0
|
1
|
0
|
sub add_changeset { |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 METHODS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 init |
64
|
|
|
|
|
|
|
Called automatically to intialise the factory objects takes params passed to new and assigns them to |
65
|
|
|
|
|
|
|
accessors if they exist |
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub init { |
69
|
6
|
|
|
6
|
1
|
7814
|
my ( $self, $params ) = @_; |
70
|
|
|
|
|
|
|
|
71
|
6
|
100
|
|
|
|
51
|
DBIx::Changeset::Exception::ObjectCreateException->throw( error => 'Attempt to create Collection Object without a changeset_location.' ) unless defined $params->{'changeset_location'}; |
72
|
|
|
|
|
|
|
|
73
|
4
|
|
|
|
|
12
|
foreach my $field ( keys %{$params} ) { |
|
4
|
|
|
|
|
19
|
|
74
|
5
|
50
|
|
|
|
144
|
$self->{ $field } = $params->{ $field } if ( $self->can($field) ); |
75
|
|
|
|
|
|
|
} |
76
|
4
|
|
|
|
|
27
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 retrieve |
80
|
|
|
|
|
|
|
Retrieve a name file |
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
sub retrieve { |
83
|
1
|
|
|
1
|
1
|
610
|
my ($self, $uri) = @_; |
84
|
|
|
|
|
|
|
|
85
|
1
|
|
|
|
|
21
|
$self->retrieve_like(qr/$uri/xm); |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
7
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 next |
91
|
|
|
|
|
|
|
The next file |
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
sub next { |
94
|
5
|
|
|
5
|
1
|
581
|
my $self = shift; |
95
|
5
|
100
|
|
|
|
23
|
if ( not defined $self->current_index ) { |
96
|
2
|
|
|
|
|
33
|
$self->current_index(0); |
97
|
|
|
|
|
|
|
} else { |
98
|
3
|
|
|
|
|
36
|
$self->current_index($self->current_index + 1); |
99
|
|
|
|
|
|
|
} |
100
|
5
|
|
|
|
|
76
|
return $self->files->[$self->current_index]; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 next_outstanding |
104
|
|
|
|
|
|
|
Returns the next file with an outstanding flag set |
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
sub next_outstanding { |
107
|
1
|
|
|
1
|
1
|
6830
|
my $self = shift; |
108
|
|
|
|
|
|
|
|
109
|
1
|
|
|
|
|
2
|
my $outstanding; |
110
|
1
|
|
|
|
|
4
|
while ( $outstanding = $self->next() ) { |
111
|
1
|
50
|
33
|
|
|
26
|
last if ( (defined $outstanding->outstanding()) && ($outstanding->outstanding() == 1) ); |
112
|
|
|
|
|
|
|
} |
113
|
1
|
|
|
|
|
12
|
return $outstanding; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 next_valid |
117
|
|
|
|
|
|
|
Returns the next file with a valid flag set |
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
sub next_valid { |
120
|
1
|
|
|
1
|
1
|
505
|
my $self = shift; |
121
|
|
|
|
|
|
|
|
122
|
1
|
|
|
|
|
2
|
my $valid; |
123
|
1
|
|
|
|
|
4
|
while ( $valid = $self->next() ) { |
124
|
1
|
50
|
|
|
|
18
|
last if $valid->valid() == 1; |
125
|
|
|
|
|
|
|
} |
126
|
1
|
|
|
|
|
10
|
return $valid; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 next_skipped |
131
|
|
|
|
|
|
|
Returns the next file with a skipped flag set |
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
sub next_skipped { |
134
|
1
|
|
|
1
|
1
|
586
|
my $self = shift; |
135
|
|
|
|
|
|
|
|
136
|
1
|
|
|
|
|
3
|
my $skipped; |
137
|
1
|
|
|
|
|
5
|
while ( $skipped = $self->next() ) { |
138
|
1
|
50
|
|
|
|
22
|
last if $skipped->skipped() == 1; |
139
|
|
|
|
|
|
|
} |
140
|
1
|
|
|
|
|
12
|
return $skipped; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 reset |
144
|
|
|
|
|
|
|
Returns to the first record in the collection |
145
|
|
|
|
|
|
|
=cut |
146
|
|
|
|
|
|
|
sub reset { |
147
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
148
|
|
|
|
|
|
|
|
149
|
1
|
|
|
|
|
4
|
$self->current_index(undef); |
150
|
1
|
|
|
|
|
11
|
return; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 total |
154
|
|
|
|
|
|
|
The total number of records |
155
|
|
|
|
|
|
|
=cut |
156
|
|
|
|
|
|
|
sub total { |
157
|
6
|
|
|
6
|
1
|
9488
|
my $self = shift; |
158
|
|
|
|
|
|
|
|
159
|
6
|
|
|
|
|
13
|
return scalar(@{$self->files}); |
|
6
|
|
|
|
|
27
|
|
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 total_outstanding |
163
|
|
|
|
|
|
|
Returns the total number of records with outstanding flag set |
164
|
|
|
|
|
|
|
=cut |
165
|
|
|
|
|
|
|
sub total_outstanding { |
166
|
1
|
|
|
1
|
1
|
523
|
my $self = shift; |
167
|
|
|
|
|
|
|
|
168
|
1
|
100
|
|
|
|
2
|
my @total = grep { defined $_->outstanding && $_->outstanding == 1 } @{$self->files}; |
|
4
|
|
|
|
|
45
|
|
|
1
|
|
|
|
|
4
|
|
169
|
|
|
|
|
|
|
|
170
|
1
|
|
|
|
|
13
|
return scalar(@total); |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 total_valid |
174
|
|
|
|
|
|
|
Returns the total number of records with valid flag set |
175
|
|
|
|
|
|
|
=cut |
176
|
|
|
|
|
|
|
sub total_valid { |
177
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
178
|
|
|
|
|
|
|
|
179
|
1
|
|
|
|
|
3
|
my @total = grep { $_->valid == 1 } @{$self->files}; |
|
4
|
|
|
|
|
41
|
|
|
1
|
|
|
|
|
4
|
|
180
|
|
|
|
|
|
|
|
181
|
1
|
|
|
|
|
13
|
return scalar(@total); |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 total_skipped |
185
|
|
|
|
|
|
|
Returns the total number of records with skipped flag set |
186
|
|
|
|
|
|
|
=cut |
187
|
|
|
|
|
|
|
sub total_skipped { |
188
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
189
|
|
|
|
|
|
|
|
190
|
1
|
100
|
|
|
|
2
|
my @total = grep { defined $_->skipped && $_->skipped == 1 } @{$self->files}; |
|
4
|
|
|
|
|
40
|
|
|
1
|
|
|
|
|
4
|
|
191
|
|
|
|
|
|
|
|
192
|
1
|
|
|
|
|
13
|
return scalar(@total); |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head1 TYPES |
196
|
|
|
|
|
|
|
Default types included |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 disk |
199
|
|
|
|
|
|
|
Simply reads files from disk expects a changeset_location of directories |
200
|
|
|
|
|
|
|
=cut |
201
|
|
|
|
|
|
|
__PACKAGE__->register_factory_type( disk => 'DBIx::Changeset::Collection::Disk' ); |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Copyright 2004-2008 Grox Pty Ltd. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
208
|
|
|
|
|
|
|
under the same terms as Perl itself. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=cut |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
1; # End of DBIx::Changeset |