line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Importer::Activiti::RuntimeTask; |
2
|
1
|
|
|
1
|
|
2289
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
218067
|
|
|
1
|
|
|
|
|
12
|
|
3
|
1
|
|
|
1
|
|
2367
|
use Catmandu::Util qw(:is :check :array); |
|
1
|
|
|
|
|
99659
|
|
|
1
|
|
|
|
|
834
|
|
4
|
1
|
|
|
1
|
|
989
|
use Activiti::Rest::Client; |
|
1
|
|
|
|
|
34644
|
|
|
1
|
|
|
|
|
34
|
|
5
|
1
|
|
|
1
|
|
8
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
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->tasks( |
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::RuntimeTasks - Package that imports historic process instances from Activiti |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SYNOPSIS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
use Catmandu::Importer::Activiti::RuntimeTasks; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $importer = Catmandu::Importer::Activiti::RuntimeTasks->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/#restTasksGet) |
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::RuntimeTasks 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; |