line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Importer::Activiti::RuntimeProcessInstance; |
2
|
1
|
|
|
1
|
|
1970
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
3
|
1
|
|
|
1
|
|
314
|
use Catmandu::Util qw(:is :check :array); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
683
|
|
4
|
1
|
|
|
1
|
|
8
|
use Activiti::Rest::Client; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
5
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
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->query_process_instances( |
50
|
|
|
|
|
|
|
content => { |
51
|
|
|
|
|
|
|
%$params, |
52
|
|
|
|
|
|
|
start => $start, |
53
|
|
|
|
|
|
|
size => $size |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
)->parsed_content; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$total = $res->{total}; |
58
|
|
|
|
|
|
|
return unless @{ $res->{data} }; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$results = $res->{data}; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$start += $size; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
shift @$results; |
66
|
|
|
|
|
|
|
}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 NAME |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Catmandu::Importer::Activiti::RuntimeProcessInstance - Package that imports runtime process instances from Activiti |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SYNOPSIS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
use Catmandu::Importer::Activiti::RuntimeProcessInstance; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $importer = Catmandu::Importer::Activiti::RuntimeProcessInstance->new( |
78
|
|
|
|
|
|
|
url => 'http://user:password@localhost:8080/activiti-rest/service', |
79
|
|
|
|
|
|
|
params => { |
80
|
|
|
|
|
|
|
includeProcessVariables => "true" |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $n = $importer->each(sub { |
85
|
|
|
|
|
|
|
my $hashref = $_[0]; |
86
|
|
|
|
|
|
|
# ... |
87
|
|
|
|
|
|
|
}); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 METHODS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 new() |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Create a new importer |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Arguments: |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
url base url for the activiti rest api |
98
|
|
|
|
|
|
|
params additional filters (see: http://www.activiti.org/userguide/#restProcessInstancesGet) |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 each(&callback) |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 ... |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. The |
105
|
|
|
|
|
|
|
Catmandu::Importer::Activiti::RuntimeProcessInstance methods are not idempotent: Activiti feeds can only be read once. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SEE ALSO |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 AUTHOR |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Nicolas Franck C<< Nicolas Franck at UGent be >> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |