| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Catmandu::Importer::Activiti::HistoricTask; |
|
2
|
1
|
|
|
1
|
|
2049
|
use Catmandu::Sane; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
10
|
|
|
3
|
1
|
|
|
1
|
|
338
|
use Catmandu::Util qw(:is :check :array); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
771
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use Activiti::Rest::Client; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
38
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use Moo; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.11"; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Catmandu::Importer'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has url => ( |
|
12
|
|
|
|
|
|
|
is => 'ro', |
|
13
|
|
|
|
|
|
|
isa => sub { check_string($_[0]); }, |
|
14
|
|
|
|
|
|
|
required => 1 |
|
15
|
|
|
|
|
|
|
); |
|
16
|
|
|
|
|
|
|
has params => ( |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
isa => sub { check_hash_ref($_[0]); }, |
|
19
|
|
|
|
|
|
|
lazy => 1, |
|
20
|
|
|
|
|
|
|
default => sub { +{}; } |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
has _activiti => ( |
|
23
|
|
|
|
|
|
|
is => 'ro', |
|
24
|
|
|
|
|
|
|
lazy => 1, |
|
25
|
|
|
|
|
|
|
builder => '_build_activiti' |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
sub _build_activiti { |
|
28
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
|
29
|
0
|
|
|
|
|
|
Activiti::Rest::Client->new(url => $self->url); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub generator { |
|
33
|
|
|
|
|
|
|
my $self = $_[0]; |
|
34
|
|
|
|
|
|
|
sub { |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
state $start = 0; |
|
37
|
|
|
|
|
|
|
state $size = 100; |
|
38
|
|
|
|
|
|
|
state $total; |
|
39
|
|
|
|
|
|
|
state $results = []; |
|
40
|
|
|
|
|
|
|
state $activiti = $self->_activiti(); |
|
41
|
|
|
|
|
|
|
state $params = $self->params(); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
unless(@$results){ |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
if(defined $total){ |
|
46
|
|
|
|
|
|
|
return if $start >= $total; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $res = $activiti->historic_task_instances( |
|
50
|
|
|
|
|
|
|
%$params, |
|
51
|
|
|
|
|
|
|
start => $start, |
|
52
|
|
|
|
|
|
|
size => $size |
|
53
|
|
|
|
|
|
|
)->parsed_content; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$total = $res->{total}; |
|
56
|
|
|
|
|
|
|
return unless @{ $res->{data} }; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$results = $res->{data}; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$start += $size; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
shift @$results; |
|
64
|
|
|
|
|
|
|
}; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Catmandu::Importer::Activiti::HistoricTasks - Package that imports historic process instances from Activiti |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
use Catmandu::Importer::Activiti::HistoricTasks; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $importer = Catmandu::Importer::Activiti::HistoricTasks->new( |
|
76
|
|
|
|
|
|
|
url => 'http://user:password@localhost:8080/activiti-rest/service', |
|
77
|
|
|
|
|
|
|
params => { |
|
78
|
|
|
|
|
|
|
includeProcessVariables => "true" |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
); |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $n = $importer->each(sub { |
|
83
|
|
|
|
|
|
|
my $hashref = $_[0]; |
|
84
|
|
|
|
|
|
|
# ... |
|
85
|
|
|
|
|
|
|
}); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 METHODS |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 new() |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Create a new importer |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Arguments: |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
url base url for the activiti rest api |
|
96
|
|
|
|
|
|
|
params additional filters (see: http://www.activiti.org/userguide/#restHistoricTaskInstancesGet) |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 each(&callback) |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 ... |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. The |
|
103
|
|
|
|
|
|
|
Catmandu::Importer::Activiti::HistoricTasks methods are not idempotent: Activiti feeds can only be read once. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 AUTHOR |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Nicolas Franck C<< Nicolas Franck at UGent be >> |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; |