File Coverage

blib/lib/Activiti/Rest/Client.pm
Criterion Covered Total %
statement 21 290 7.2
branch 0 4 0.0
condition n/a
subroutine 7 94 7.4
pod 7 86 8.1
total 35 474 7.3


line stmt bran cond sub pod time code
1             package Activiti::Rest::Client;
2 1     1   79669 use Activiti::Sane;
  1         3  
  1         5  
3 1     1   35 use Carp qw(confess);
  1         2  
  1         47  
4 1     1   578 use Moo;
  1         11960  
  1         11  
5 1     1   2080 use Data::Util qw(:check :validate);
  1         808  
  1         214  
6 1     1   741 use JSON qw(decode_json encode_json);
  1         12930  
  1         5  
7 1     1   596 use URI::Escape qw(uri_escape);
  1         1266  
  1         58  
8 1     1   439 use Activiti::Rest::Response;
  1         4  
  1         6894  
9              
10             our $VERSION = "0.1259";
11              
12             #see: http://www.activiti.org/userguide
13              
14             =head1 NAME
15              
16             Activiti::Rest::Client - Low level client for the Activiti Rest API
17              
18             =head1 AUTHORS
19              
20             Nicolas Franck C<< >>
21              
22             =head1 NOTE
23              
24             This is a work in progress. More documentation will be added in time
25              
26             =head1 PROJECT
27              
28             see http://www.activiti.org/userguide
29              
30             =head1 SYNOPSIS
31              
32             my $client = Activiti::Rest::Client->new(
33             url => 'http://kermit:kermit@localhost:8080/activiti-rest/service'
34             );
35              
36             my $res = $client->process_definitions;
37              
38             die("no parsed content") unless $res->has_parsed_content;
39              
40             my $pdefs = $res->parsed_content;
41              
42             my @ids = map { $_->{id} } @{ $pdefs->{data} };
43             for my $id(@ids){
44             print Dumper($client->process_definition(processDefinitionId => $id)->parsed_content);
45             }
46              
47             =head1 CONSTRUCTOR parameters
48              
49             =head2 url
50              
51             base url of the activiti rest api
52             activiti-rest uses basic http authentication, so username and password should be included in the url
53              
54             e.g.
55              
56             http://kermit:kermit@localhost:8080/activiti-rest/service
57              
58             =cut
59              
60             has url => (
61             is => 'ro',
62             isa => sub { $_[0] =~ /^https?:\/\//o or die("url must be a valid web url\n"); },
63             required => 1
64             );
65              
66             =head2 timeout
67              
68             timeout in seconds when connecting to the activiti rest api
69              
70             default value is 180
71              
72             =cut
73              
74             has timeout => (
75             is => 'ro',
76             isa => sub { is_integer($_[0]) && $_[0] >= 0 || die("timeout should be natural number"); },
77             lazy => 1,
78             default => sub { 180; }
79             );
80             has ua => (
81             is => 'ro',
82             lazy => 1,
83             builder => '_build_ua'
84             );
85             sub _build_ua {
86 0     0     require Activiti::Rest::UserAgent::LWP;
87 0           Activiti::Rest::UserAgent::LWP->new(
88             url => $_[0]->url(),
89             timeout => $_[0]->timeout()
90             );
91             }
92              
93             =head1 METHODS
94              
95             =head2 deployments
96              
97             Retrieve list of Deployments
98              
99             parameters: see user guide (http://www.activiti.org/userguide/index.html#N13293)
100              
101             equal to rest call:
102              
103             GET repository/deployments
104              
105             =cut
106             sub deployments {
107 0     0 1   my($self,%args)=@_;
108 0           my $res = $self->ua->request(
109             path => "/repository/deployments",
110             params => \%args,
111             method => "GET"
112             );
113 0           Activiti::Rest::Response->from_http_response($res);
114             }
115             =head2 deployment
116              
117             Get a deployment
118              
119             parameters:
120             deploymentId
121              
122             other parameters: see user guide (http://www.activiti.org/userguide/index.html#N1332E)
123              
124             equal to rest call:
125              
126             GET repository/deployments/:deploymentId
127              
128             =cut
129              
130             sub deployment {
131 0     0 0   my($self,%args)=@_;
132             my $res = $self->ua->request(
133 0           path => "/repository/deployments/".uri_escape($args{deploymentId}),
134             params => {},
135             method => "GET"
136             );
137 0           Activiti::Rest::Response->from_http_response($res);
138             }
139             =head2 deployment_resources
140              
141             List resources in a deployment
142              
143             parameters:
144              
145             deploymentId
146              
147             other parameters: see user guide (http://www.activiti.org/userguide/index.html#N133F1)
148              
149             equal to rest call:
150              
151             GET repository/deployments/:deploymentId/resources
152              
153             =cut
154              
155             sub deployment_resources {
156 0     0 0   my($self,%args)=@_;
157             my $res = $self->ua->request(
158 0           path => "/repository/deployments/".uri_escape($args{deploymentId})."/resources",
159             params => {},
160             method => "GET"
161             );
162 0           Activiti::Rest::Response->from_http_response($res);
163             }
164              
165             =head2 deployment_resource
166              
167             Get a deployment resource
168              
169             parameters:
170              
171             deploymentId
172             resourceId
173              
174             other parameters: see user guide (http://www.activiti.org/userguide/index.html#N1345B)
175              
176             equal to rest call:
177              
178             GET repository/deployments/:deploymentId/resources/:resourceId
179              
180             =cut
181              
182             sub deployment_resource {
183 0     0 1   my($self,%args)=@_;
184             my $res = $self->ua->request(
185 0           path => "/repository/deployments/".uri_escape($args{deploymentId})."/resources/".uri_escape($args{resourceId}),
186             params => {},
187             method => "GET"
188             );
189 0           Activiti::Rest::Response->from_http_response($res);
190             }
191             =head2 process_definitions
192              
193             List of process definitions
194              
195             parameters: see user guide (http://www.activiti.org/userguide/index.html#N13520)
196              
197             equal to rest call:
198              
199             GET repository/process-definitions
200              
201             =cut
202              
203             sub process_definitions {
204 0     0 0   my($self,%args)=@_;
205 0           my $res = $self->ua->request(
206             path => "/repository/process-definitions",
207             params => \%args,
208             method => "GET"
209             );
210 0           Activiti::Rest::Response->from_http_response($res);
211             }
212             =head2 process_definition
213              
214             Get a process definition
215              
216             parameters:
217              
218             processDefinitionId
219              
220             other parameters: see user guide (http://www.activiti.org/userguide/index.html#N13605)
221              
222             equal to rest call:
223              
224             GET repository/process-definitions/:processDefinitionId
225              
226             =cut
227              
228             sub process_definition {
229 0     0 0   my($self,%args)=@_;
230             my $res = $self->ua->request(
231 0           path => "/repository/process-definitions/".uri_escape($args{processDefinitionId}),
232             params => {},
233             method => "GET"
234             );
235 0           Activiti::Rest::Response->from_http_response($res);
236             }
237             =head2 process_definition_resource_data
238              
239             Get a process definition resource content
240              
241             parameters:
242              
243             processDefinitionId
244              
245             equal to rest call:
246              
247             GET repository/process-definitions/:processDefinitionId/resourcedata
248              
249             =cut
250              
251             sub process_definition_resource_data {
252 0     0 0   my($self,%args)=@_;
253             my $res = $self->ua->request(
254 0           path => "/repository/process-definitions/".uri_escape($args{processDefinitionId})."/resourcedata",
255             params => {},
256             method => "GET"
257             );
258 0           Activiti::Rest::Response->from_http_response($res);
259             }
260              
261             =head2 process_definition_model
262              
263             Get a process definition BPMN model
264              
265             parameters:
266              
267             processDefinitionId
268              
269             equal to rest call:
270              
271             GET repository/process-definitions/:processDefinitionId/model
272              
273             =cut
274              
275             sub process_definition_model {
276 0     0 1   my($self,%args)=@_;
277             my $res = $self->ua->request(
278 0           path => "/repository/process-definitions/".uri_escape($args{processDefinitionId})."/model",
279             params => {},
280             method => "GET"
281             );
282 0           Activiti::Rest::Response->from_http_response($res);
283             }
284             =head2 process_definition_identity_links
285              
286             Get all candidate starters for a process-definition
287              
288             parameters:
289              
290             processDefinitionId
291              
292             equal to rest call:
293              
294             GET repository/process-definitions/:processDefinitionId/identitylinks
295              
296             =cut
297             sub process_definition_identity_links {
298 0     0 0   my($self,%args)=@_;
299             my $res = $self->ua->request(
300 0           path => "/repository/process-definitions/".uri_escape($args{processDefinitionId})."/identitylinks",
301             params => {},
302             method => "GET"
303             );
304 0           Activiti::Rest::Response->from_http_response($res);
305             }
306             =head2 process_definition_identity_link
307              
308             Get a candidate starter from a process definition
309              
310             parameters: (see http://www.activiti.org/userguide/index.html#N138A9)
311              
312             processDefinitionId
313             family
314             identityId
315              
316             equal to rest call:
317              
318             GET repository/process-definitions/:processDefinitionId/identitylinks/:family/:identityId
319              
320             =cut
321             sub process_definition_identity_link {
322 0     0 0   my($self,%args)=@_;
323             my $res = $self->ua->request(
324 0           path => "/repository/process-definitions/".uri_escape($args{processDefinitionId})."/identitylinks/".uri_escape($args{family})."/".uri_escape($args{identityId}),
325             params => {},
326             method => "GET"
327             );
328 0           Activiti::Rest::Response->from_http_response($res);
329             }
330             =head2 models
331              
332             Get a list of models
333              
334             Parameters: see user guide (http://www.activiti.org/userguide/index.html#N1390A)
335              
336             equal to rest call:
337              
338             GET repository/models
339              
340             =cut
341             sub models {
342 0     0 0   my($self,%args)=@_;
343 0           my $res = $self->ua->request(
344             path => "/repository/models",
345             params => \%args,
346             method => "GET"
347             );
348 0           Activiti::Rest::Response->from_http_response($res);
349             }
350             =head2 models
351              
352             Get a model
353              
354             Parameters:
355              
356             modelId
357              
358             equal to rest call:
359              
360             GET repository/models/:modelId
361              
362             =cut
363              
364             sub model {
365 0     0 0   my($self,%args)=@_;
366             my $res = $self->ua->request(
367 0           path => "/repository/models/".uri_escape($args{modelId}),
368             params => {},
369             method => "GET"
370             );
371 0           Activiti::Rest::Response->from_http_response($res);
372             }
373             =head2 process_instances
374              
375             List of process instances
376              
377             Parameters: see user guide (http://www.activiti.org/userguide/index.html#restProcessInstancesGet)
378              
379             equal to rest call:
380              
381             GET runtime/process-instances
382              
383             =cut
384              
385             sub process_instances {
386 0     0 0   my($self,%args)=@_;
387 0           my $res = $self->ua->request(
388             path => "/runtime/process-instances",
389             params => \%args,
390             method => "GET"
391             );
392 0           Activiti::Rest::Response->from_http_response($res);
393             }
394             =head2 process_instance
395              
396             Get a process instance
397              
398             Parameters:
399              
400             processInstanceId
401              
402             equal to rest call:
403              
404             GET runtime/process-instances/:processInstanceId
405              
406             =cut
407              
408             sub process_instance {
409 0     0 0   my($self,%args)=@_;
410             my $res = $self->ua->request(
411 0           path => "/runtime/process-instances/".uri_escape($args{processInstanceId}),
412             params => {},
413             method => "GET"
414             );
415 0           Activiti::Rest::Response->from_http_response($res);
416             }
417             sub delete_process_instance {
418 0     0 0   my($self,%args)=@_;
419             my $res = $self->ua->request(
420             path => "/runtime/process-instances/".uri_escape($args{processInstanceId}),
421             params => { deleteReason => $args{deleteReason} },
422 0           method => "DELETE"
423             );
424 0           Activiti::Rest::Response->from_http_response($res);
425             }
426             sub suspend_process_instance {
427 0     0 0   my($self,%args)=@_;
428             my $res = $self->ua->request(
429 0           path => "/runtime/process-instances/".uri_escape($args{processInstanceId}),
430             params => {},
431             headers => {
432             'Content-Type' => "application/json",
433             Content => encode_json({ action => "suspend" })
434             },
435             method => "PUT"
436             );
437 0           Activiti::Rest::Response->from_http_response($res);
438             }
439             sub activate_process_instance {
440 0     0 0   my($self,%args)=@_;
441             my $res = $self->ua->request(
442 0           path => "/runtime/process-instances/".uri_escape($args{processInstanceId}),
443             params => {},
444             headers => {
445             'Content-Type' => "application/json",
446             Content => encode_json({ action => "activate" })
447             },
448             method => "PUT"
449             );
450 0           Activiti::Rest::Response->from_http_response($res);
451             }
452              
453             =head2 query_process_instances
454              
455             Query process instances
456              
457             Parameters: see user guide (http://www.activiti.org/userguide/index.html#N13E2A)
458              
459             equal to rest call:
460              
461             POST runtime/process-instances
462              
463             =cut
464              
465             sub query_process_instances {
466 0     0 1   my($self,%args)=@_;
467             my $res = $self->ua->request(
468             path => "/query/process-instances",
469             params => {},
470             method => "POST",
471             headers => {
472             'Content-Type' => "application/json",
473             Content => encode_json($args{content})
474 0           }
475             );
476 0           Activiti::Rest::Response->from_http_response($res);
477             }
478             =head2 start_process_instance
479              
480             Start a process instance
481              
482             Parameters: see user guide (http://www.activiti.org/userguide/index.html#N13CE6)
483              
484             equal to rest call:
485              
486             POST runtime/process-instances
487              
488             =cut
489              
490             sub start_process_instance {
491 0     0 0   my($self,%args)=@_;
492             my $res = $self->ua->request(
493             path => "/runtime/process-instances",
494             params => {},
495             method => "POST",
496             headers => {
497             'Content-Type' => "application/json",
498             Content => encode_json($args{content})
499 0           }
500             );
501 0           Activiti::Rest::Response->from_http_response($res);
502             }
503             =head2 process_instance_identitylinks
504              
505             Get involved people for process instance
506              
507             Parameters:
508              
509             processInstanceId
510              
511             equal to rest call:
512              
513             GET runtime/process-instances/:processInstanceId/identitylinks
514              
515             =cut
516              
517             sub process_instance_identitylinks {
518 0     0 0   my($self,%args)=@_;
519             my $res = $self->ua->request(
520 0           path => "/runtime/process-instances/".uri_escape($args{processInstanceId})."/identitylinks",
521             params => {},
522             method => "GET"
523             );
524 0           Activiti::Rest::Response->from_http_response($res);
525             }
526             =head2 process_instance_variables
527              
528             List of variables for a process instance
529              
530             Parameters:
531              
532             processInstanceId
533              
534             equal to rest call:
535              
536             GET runtime/process-instances/:processInstanceId/variables
537              
538             =cut
539              
540             sub process_instance_variables {
541 0     0 0   my($self,%args)=@_;
542             my $res = $self->ua->request(
543 0           path => "/runtime/process-instances/".uri_escape($args{processInstanceId})."/variables",
544             params => {},
545             method => "GET"
546             );
547 0           Activiti::Rest::Response->from_http_response($res);
548             }
549             =head2 process_instance_variable
550              
551             Get a variable for a process instance
552              
553             Parameters:
554              
555             processInstanceId
556             variableName
557              
558             equal to rest call:
559              
560             GET runtime/process-instances/:processInstanceId/variables/:variableName
561              
562             =cut
563              
564             sub process_instance_variable {
565 0     0 0   my($self,%args)=@_;
566             my $res = $self->ua->request(
567 0           path => "/runtime/process-instances/".uri_escape($args{processInstanceId})."/variables/".uri_escape($args{variableName}),
568             params => {},
569             method => "GET"
570             );
571 0           Activiti::Rest::Response->from_http_response($res);
572             }
573             sub update_process_instance_variable {
574 0     0 0   my($self,%args)=@_;
575             my $res = $self->ua->request(
576             path => "/runtime/process-instances/".uri_escape($args{processInstanceId})."/variables/".uri_escape($args{variableName}),
577             params => {},
578             method => "PUT",
579             headers => {
580             'Content-Type' => "application/json",
581             Content => encode_json($args{content})
582 0           }
583             );
584 0           Activiti::Rest::Response->from_http_response($res);
585             }
586             #DEPRECATED!
587             sub signal_process_instance {
588 0     0 0   my($self,%args)=@_;
589             my $res = $self->ua->request(
590             path => "/process-instance/".uri_escape($args{processInstanceId})."/signal",
591             params => {},
592             method => "POST",
593             headers => {
594             'Content-Type' => "application/json",
595             Content => encode_json($args{content})
596 0           }
597             );
598 0           Activiti::Rest::Response->from_http_response($res);
599             }
600             =head2 process_instance_diagram
601              
602             Get a diagram for a process instance
603              
604             Parameters:
605              
606             processInstanceId
607              
608             equal to rest call:
609              
610             GET runtime/process-instances/:processInstanceId/diagram
611              
612             when successfull the "content_type" of the response is "image/png" and "content" is equal to the image data
613              
614             =cut
615              
616             #return: png image data
617             sub process_instance_diagram {
618 0     0 0   my($self,%args)=@_;
619             my $res = $self->ua->request(
620 0           path => "/runtime/process-instances/".uri_escape($args{processInstanceId})."/diagram",
621             params => {},
622             method => "GET"
623             );
624 0           Activiti::Rest::Response->from_http_response($res);
625             }
626             =head2 executions
627              
628             List of executions
629              
630             Parameters: see user guide (http://www.activiti.org/userguide/index.html#restExecutionsGet)
631              
632             equal to rest call:
633              
634             GET repository/executions
635              
636             =cut
637              
638             sub executions {
639 0     0 0   my($self,%args)=@_;
640 0           my $res = $self->ua->request(
641             path => "/runtime/executions",
642             params => \%args,
643             method => "GET"
644             );
645 0           Activiti::Rest::Response->from_http_response($res);
646             }
647             sub query_executions {
648 0     0 0   my($self,%args)=@_;
649             my $res = $self->ua->request(
650             path => "/query/executions",
651             params => {},
652             method => "POST",
653             headers => {
654             'Content-Type' => "application/json",
655             Content => encode_json($args{content})
656 0           }
657             );
658 0           Activiti::Rest::Response->from_http_response($res);
659             }
660             =head2 query_executions
661              
662             Query executions
663              
664             Parameters in request body (i.e. 'content' hash)
665              
666             equal to rest call:
667              
668             POST query/executions
669             =cut
670             sub signal_execution {
671 0     0 0   my($self,%args)=@_;
672             my $res = $self->ua->request(
673             path => "/runtime/executions/".uri_escape($args{executionId}),
674             params => {},
675             method => "PUT",
676             headers => {
677             'Content-Type' => "application/json",
678             Content => encode_json($args{content})
679 0           }
680             );
681 0           Activiti::Rest::Response->from_http_response($res);
682             }
683             =head2 signal_execution
684              
685             send signal to execution
686              
687             equal to rest call:
688              
689             PUT runtime/executions/{executionId}
690             =cut
691              
692             =head2 execution
693              
694             Get an execution
695              
696             Parameters:
697              
698             executionId
699              
700             equal to rest call:
701              
702             GET repository/executions/:executionId
703              
704             =cut
705              
706             sub execution {
707 0     0 1   my($self,%args)=@_;
708             my $res = $self->ua->request(
709 0           path => "/runtime/executions/".uri_escape($args{executionId}),
710             params => {},
711             method => "GET"
712             );
713 0           Activiti::Rest::Response->from_http_response($res);
714             }
715             =head2 execution_activities
716              
717             Get active activities in an execution
718              
719             Parameters:
720              
721             executionId
722              
723             equal to rest call:
724              
725             GET repository/executions/:executionId/activities
726              
727             =cut
728              
729             sub execution_activities {
730 0     0 0   my($self,%args)=@_;
731             my $res = $self->ua->request(
732 0           path => "/runtime/executions/".uri_escape($args{executionId})."/activities",
733             params => {},
734             method => "GET"
735             );
736 0           Activiti::Rest::Response->from_http_response($res);
737             }
738             =head2 execution_variables
739              
740             List of variables for an execution
741              
742             Parameters:
743              
744             executionId
745              
746             equal to rest call:
747              
748             GET repository/executions/:executionId/variables
749              
750             =cut
751              
752             sub execution_variables {
753 0     0 0   my($self,%args)=@_;
754             my $res = $self->ua->request(
755 0           path => "/runtime/executions/".uri_escape($args{executionId})."/variables",
756             params => {},
757             method => "GET"
758             );
759 0           Activiti::Rest::Response->from_http_response($res);
760             }
761             =head2 tasks
762              
763             List of tasks
764              
765             Parameters: see user guide (http://www.activiti.org/userguide/index.html#restTasksGet)
766              
767             equal to rest call:
768              
769             GET runtime/tasks
770              
771             =cut
772              
773             sub tasks {
774 0     0 0   my($self,%args)=@_;
775 0           my $res = $self->ua->request(
776             path => "/runtime/tasks",
777             params => \%args,
778             method => "GET"
779             );
780 0           Activiti::Rest::Response->from_http_response($res);
781             }
782             =head2 query_tasks
783              
784             Query for tasks
785              
786             Parameters: see user guide (http://www.activiti.org/userguide/index.html#N148B7)
787              
788             equal to rest call:
789              
790             POST query/tasks
791              
792             =cut
793              
794             sub query_tasks {
795 0     0 0   my($self,%args)=@_;
796             my $res = $self->ua->request(
797             path => "/query/tasks",
798             params => {},
799             method => "POST",
800             headers => {
801             'Content-Type' => "application/json",
802             Content => encode_json($args{content})
803 0           }
804             );
805 0           Activiti::Rest::Response->from_http_response($res);
806             }
807             sub query_historic_task_instances {
808 0     0 0   my($self,%args)=@_;
809             my $res = $self->ua->request(
810             path => "/query/historic-task-instances",
811             params => {},
812             method => "POST",
813             headers => {
814             'Content-Type' => "application/json",
815             Content => encode_json($args{content})
816 0           }
817             );
818 0           Activiti::Rest::Response->from_http_response($res);
819             }
820             =head2 task
821              
822             Get a task
823              
824             Parameters:
825              
826             taskId
827              
828             equal to rest call:
829              
830             GET runtime/tasks/:taskId
831              
832             =cut
833              
834             sub task {
835 0     0 0   my($self,%args)=@_;
836             my $res = $self->ua->request(
837 0           path => "/runtime/tasks/".uri_escape($args{taskId}),
838             params => {},
839             method => "GET"
840             );
841 0           Activiti::Rest::Response->from_http_response($res);
842             }
843             =head2 update_task
844              
845             Update a task
846              
847             Parameters:
848              
849             taskId
850              
851             Body parameters: see user guide (http://www.activiti.org/userguide/index.html#N148FA)
852              
853             equal to rest call:
854              
855             PUT runtime/tasks/:taskId
856              
857             =cut
858              
859             sub update_task {
860 0     0 0   my($self,%args)=@_;
861             my $res = $self->ua->request(
862             path => "/runtime/tasks/".uri_escape($args{taskId}),
863             params => {},
864             method => "PUT",
865             headers => {
866             'Content-Type' => "application/json",
867             Content => encode_json($args{content})
868 0           }
869             );
870 0           Activiti::Rest::Response->from_http_response($res);
871             }
872             =head2 task_variables
873              
874             Get all variables for a task
875              
876             Parameters:
877              
878             taskId
879             scope (global|local)
880              
881             equal to rest call:
882              
883             GET runtime/tasks/:taskId/variables?scope=:scope
884              
885             =cut
886              
887             sub task_variables {
888 0     0 0   my($self,%args)=@_;
889 0           my $taskId = delete $args{taskId};
890 0           my $scope = delete $args{scope};
891 0           my $params = {};
892 0 0         $params->{scope} = $scope if is_string($scope);
893 0           my $res = $self->ua->request(
894             path => "/runtime/tasks/".uri_escape($taskId)."/variables",
895             params => $params,
896             method => "GET"
897             );
898 0           Activiti::Rest::Response->from_http_response($res);
899             }
900             =head2 task_variable
901              
902             Get one variable for a task
903              
904             Parameters:
905              
906             taskId
907             scope (global|local)
908              
909             equal to rest call:
910              
911             GET runtime/tasks/:taskId/variables/:variableName?scope=:scope
912              
913             =cut
914              
915             sub task_variable {
916 0     0 0   my($self,%args)=@_;
917 0           my $taskId = delete $args{taskId};
918 0           my $variableName = delete $args{variableName};
919 0           my $scope = delete $args{scope};
920 0           my $params = {};
921 0 0         $params->{scope} = $scope if is_string($scope);
922 0           my $res = $self->ua->request(
923             path => "/runtime/tasks/".uri_escape($taskId)."/variables/$variableName",
924             params => $params,
925             method => "GET"
926             );
927 0           Activiti::Rest::Response->from_http_response($res);
928             }
929              
930             =head2 task_identity_links
931              
932             Get all identity links for a task
933              
934             Parameters:
935              
936             taskId
937              
938             equal to rest call:
939              
940             GET runtime/tasks/:taskId/identitylinks
941              
942             =cut
943              
944             sub task_identity_links {
945 0     0 1   my($self,%args)=@_;
946             my $res = $self->ua->request(
947 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/identitylinks",
948             params => {},
949             method => "GET"
950             );
951 0           Activiti::Rest::Response->from_http_response($res);
952             }
953             =head2 task_identity_links_users
954              
955             =head2 task_identity_links_groups
956              
957             Get all identity links for a task for either groups or users
958              
959             Parameters:
960              
961             taskId
962              
963             equal to rest call:
964              
965             GET runtime/tasks/:taskId/identitylinks/(users|groups)
966              
967             =cut
968              
969             sub task_identity_links_users {
970 0     0 0   my($self,%args)=@_;
971             my $res = $self->ua->request(
972 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/identitylinks/users",
973             params => {},
974             method => "GET"
975             );
976 0           Activiti::Rest::Response->from_http_response($res);
977             }
978             sub task_identity_links_groups {
979 0     0 1   my($self,%args)=@_;
980             my $res = $self->ua->request(
981 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/identitylinks/groups",
982             params => {},
983             method => "GET"
984             );
985 0           Activiti::Rest::Response->from_http_response($res);
986             }
987             sub task_identity_link {
988 0     0 0   my($self,%args)=@_;
989             my $res = $self->ua->request(
990 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/identitylinks/".uri_escape($args{family})."/".uri_escape($args{identityId}),
991             params => {},
992             method => "GET"
993             );
994 0           Activiti::Rest::Response->from_http_response($res);
995             }
996             =head2 task_comments
997              
998             Get all comments on a task
999              
1000             Parameters:
1001              
1002             taskId
1003              
1004             equal to rest call:
1005              
1006             GET runtime/tasks/:taskId/comments
1007              
1008             =cut
1009              
1010             sub task_comments {
1011 0     0 0   my($self,%args)=@_;
1012             my $res = $self->ua->request(
1013 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/comments",
1014             params => {},
1015             method => "GET"
1016             );
1017 0           Activiti::Rest::Response->from_http_response($res);
1018             }
1019             =head2 task_comment
1020              
1021             Get a comments on a task
1022              
1023             Parameters:
1024              
1025             taskId
1026             commentId
1027              
1028             equal to rest call:
1029              
1030             GET runtime/tasks/:taskId/comments/:commentId
1031              
1032             =cut
1033              
1034             sub task_comment {
1035 0     0 0   my($self,%args)=@_;
1036             my $res = $self->ua->request(
1037 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/comments/".uri_escape($args{commentId}),
1038             params => {},
1039             method => "GET"
1040             );
1041 0           Activiti::Rest::Response->from_http_response($res);
1042             }
1043             =head2 task_events
1044              
1045             Get all events for a task
1046              
1047             Parameters:
1048              
1049             taskId
1050              
1051             equal to rest call:
1052              
1053             GET runtime/tasks/:taskId/events
1054              
1055             =cut
1056              
1057             sub task_events {
1058 0     0 0   my($self,%args)=@_;
1059             my $res = $self->ua->request(
1060 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/events",
1061             params => {},
1062             method => "GET"
1063             );
1064 0           Activiti::Rest::Response->from_http_response($res);
1065             }
1066             =head2 task_event
1067              
1068             Get an event for a task
1069              
1070             Parameters:
1071              
1072             taskId
1073             eventId
1074              
1075             equal to rest call:
1076              
1077             GET runtime/tasks/:taskId/events/:eventId
1078              
1079             =cut
1080              
1081             sub task_event {
1082 0     0 0   my($self,%args)=@_;
1083             my $res = $self->ua->request(
1084 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/events/".uri_escape($args{eventId}),
1085             params => {},
1086             method => "GET"
1087             );
1088 0           Activiti::Rest::Response->from_http_response($res);
1089             }
1090             =head2 task_attachments
1091              
1092             Get all attachments on a task
1093              
1094             Parameters:
1095              
1096             taskId
1097              
1098             equal to rest call:
1099              
1100             GET runtime/tasks/:taskId/attachments
1101              
1102             =cut
1103              
1104             sub task_attachments {
1105 0     0 0   my($self,%args)=@_;
1106             my $res = $self->ua->request(
1107 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/attachments",
1108             params => {},
1109             method => "GET"
1110             );
1111 0           Activiti::Rest::Response->from_http_response($res);
1112             }
1113             =head2 task_attachment
1114              
1115             Get an attachment on a task
1116              
1117             Parameters:
1118              
1119             taskId
1120             attachmentId
1121              
1122             equal to rest call:
1123              
1124             GET runtime/tasks/:taskId/comments/:attachmentId
1125              
1126             =cut
1127              
1128             sub task_attachment {
1129 0     0 0   my($self,%args)=@_;
1130             my $res = $self->ua->request(
1131 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/attachments/".uri_escape($args{attachmentId}),
1132             params => {},
1133             method => "GET"
1134             );
1135 0           Activiti::Rest::Response->from_http_response($res);
1136             }
1137             =head2 task_attachment_content
1138              
1139             Get the content for an attachment on a task
1140              
1141             Parameters:
1142              
1143             taskId
1144             attachmentId
1145              
1146             equal to rest call:
1147              
1148             GET runtime/tasks/:taskId/attachments/:attachmentId/content
1149              
1150             =cut
1151              
1152             sub task_attachment_content {
1153 0     0 0   my($self,%args)=@_;
1154             my $res = $self->ua->request(
1155 0           path => "/runtime/tasks/".uri_escape($args{taskId})."/attachments/".uri_escape($args{attachmentId})."/content",
1156             params => {},
1157             method => "GET"
1158             );
1159 0           Activiti::Rest::Response->from_http_response($res);
1160             }
1161             =head2 historic_process_instances
1162              
1163             List of historic process instances
1164              
1165             Parameters: see user guide (http://www.activiti.org/userguide/index.html#restHistoricProcessInstancesGet)
1166              
1167             equal to rest call:
1168              
1169             GET history/historic-process-instances
1170              
1171             =cut
1172              
1173             sub historic_process_instances {
1174 0     0 0   my($self,%args)=@_;
1175 0           my $res = $self->ua->request(
1176             path => "/history/historic-process-instances",
1177             params => \%args,
1178             method => "GET"
1179             );
1180 0           Activiti::Rest::Response->from_http_response($res);
1181             }
1182             =head2 query_historic_process_instances
1183              
1184             Query for historic process instances
1185              
1186             Parameters: see user guide (http://www.activiti.org/userguide/index.html#N153C2)
1187              
1188             equal to rest call:
1189              
1190             POST history/historic-process-instances
1191              
1192             =cut
1193             sub query_historic_process_instances {
1194 0     0 0   my($self,%args)=@_;
1195             my $res = $self->ua->request(
1196             path => "/query/historic-process-instances",
1197             params => {},
1198             method => "POST",
1199             headers => {
1200             'Content-Type' => "application/json",
1201             Content => encode_json($args{content})
1202 0           }
1203             );
1204 0           Activiti::Rest::Response->from_http_response($res);
1205             }
1206             =head2 historic_process_instance
1207              
1208             Get a historic process instance
1209              
1210             Parameters:
1211              
1212             processInstanceId
1213              
1214             equal to rest call:
1215              
1216             GET history/historic-process-instances/:processInstanceId
1217              
1218             =cut
1219              
1220             sub historic_process_instance {
1221 0     0 0   my($self,%args)=@_;
1222             my $res = $self->ua->request(
1223 0           path => "/history/historic-process-instances/".uri_escape($args{processInstanceId}),
1224             params => {},
1225             method => "GET"
1226             );
1227 0           Activiti::Rest::Response->from_http_response($res);
1228             }
1229             =head2 delete_historic_process_instance
1230              
1231             Delete a historic process instance
1232              
1233             Parameters:
1234              
1235             processInstanceId
1236              
1237             equal to rest call:
1238              
1239             DELETE history/historic-process-instances/:processInstanceId
1240              
1241             =cut
1242              
1243             sub delete_historic_process_instance {
1244 0     0 0   my($self,%args)=@_;
1245             my $res = $self->ua->request(
1246 0           path => "/history/historic-process-instances/".uri_escape($args{processInstanceId}),
1247             params => {},
1248             method => "DELETE"
1249             );
1250 0           Activiti::Rest::Response->from_http_response($res);
1251             }
1252             =head2 historic_process_instance_comments
1253              
1254             Get all comments on a historic process instance
1255              
1256             Parameters:
1257              
1258             processInstanceId
1259              
1260             equal to rest call:
1261              
1262             GET history/historic-process-instances/:processInstanceId/comments
1263              
1264             =cut
1265              
1266             sub historic_process_instance_comments {
1267 0     0 0   my($self,%args)=@_;
1268             my $res = $self->ua->request(
1269 0           path => "/history/historic-process-instances/".uri_escape($args{processInstanceId})."/comments",
1270             params => {},
1271             method => "GET"
1272             );
1273 0           Activiti::Rest::Response->from_http_response($res);
1274             }
1275             =head2 historic_process_instance_comment
1276              
1277             Get a comment on a historic process instance
1278              
1279             Parameters:
1280              
1281             processInstanceId
1282             commentId
1283              
1284             equal to rest call:
1285              
1286             GET history/historic-process-instances/:processInstanceId/comments/:commentId
1287              
1288             =cut
1289              
1290             sub historic_process_instance_comment {
1291 0     0 0   my($self,%args)=@_;
1292             my $res = $self->ua->request(
1293 0           path => "/history/historic-process-instances/".uri_escape($args{processInstanceId})."/comments/".uri_escape($args{commentId}),
1294             params => {},
1295             method => "GET"
1296             );
1297 0           Activiti::Rest::Response->from_http_response($res);
1298             }
1299             =head2 historic_task_instances
1300              
1301             Get historic task instances
1302              
1303             Parameters: see user guide (http://www.activiti.org/userguide/index.html#restHistoricTaskInstancesGet)
1304              
1305             equal to rest call:
1306              
1307             GET history/historic-task-instances
1308              
1309             =cut
1310              
1311             sub historic_task_instances {
1312 0     0 0   my($self,%args)=@_;
1313 0           my $res = $self->ua->request(
1314             path => "/history/historic-task-instances",
1315             params => \%args,
1316             method => "GET"
1317             );
1318 0           Activiti::Rest::Response->from_http_response($res);
1319             }
1320             =head2 historic_variable_instances
1321              
1322             Get historic variable instances, either from tasks or process instances
1323              
1324             Parameters: see user guide (http://www.activiti.org/userguide/index.html#restHistoricVariableInstancesGet)
1325              
1326             equal to rest call:
1327              
1328             GET history/historic-variable-instances
1329              
1330             =cut
1331              
1332             sub historic_variable_instances {
1333 0     0 0   my($self,%args) = @_;
1334 0           my $res = $self->ua->request(
1335             path => "/history/historic-variable-instances",
1336             params => \%args,
1337             method => "GET"
1338             );
1339 0           Activiti::Rest::Response->from_http_response($res);
1340             }
1341             =head2 query_historic_variable_instances
1342              
1343             Query historic variable instances, either from tasks or process instances
1344              
1345             Parameters: see user guide (http://www.activiti.org/userguide/index.html#N15B00)
1346              
1347             equal to rest call:
1348              
1349             POST query/historic-variable-instances
1350              
1351             =cut
1352              
1353             sub query_historic_variable_instances {
1354 0     0 0   my($self,%args)=@_;
1355             my $res = $self->ua->request(
1356             path => "/query/historic-variable-instances",
1357             params => {},
1358             method => "POST",
1359             headers => {
1360             'Content-Type' => "application/json",
1361             Content => encode_json($args{content})
1362 0           }
1363             );
1364 0           Activiti::Rest::Response->from_http_response($res);
1365             }
1366             =head2 historic_task_instance
1367              
1368             Get a historic task instance
1369              
1370             Parameters:
1371              
1372             taskId
1373              
1374             equal to rest call:
1375              
1376             GET history/historic-task-instances/:taskId
1377              
1378             =cut
1379              
1380             sub historic_task_instance {
1381 0     0 0   my($self,%args)=@_;
1382             my $res = $self->ua->request(
1383 0           path => "/history/historic-task-instances/".uri_escape($args{taskInstanceId}),
1384             params => {},
1385             method => "GET"
1386             );
1387 0           Activiti::Rest::Response->from_http_response($res);
1388             }
1389             =head2 historic_task_instance_identity_links
1390              
1391             Get the identity links of a historic task instance
1392              
1393             Parameters:
1394              
1395             taskId
1396              
1397             equal to rest call:
1398              
1399             GET history/historic-task-instances/:taskId/identitylinks
1400              
1401             =cut
1402              
1403             sub historic_task_instance_identity_links {
1404 0     0 0   my($self,%args)=@_;
1405             my $res = $self->ua->request(
1406 0           path => "/history/historic-task-instances/".uri_escape($args{taskInstanceId})."/identitylinks",
1407             params => {},
1408             method => "GET"
1409             );
1410 0           Activiti::Rest::Response->from_http_response($res);
1411             }
1412             sub historic_activity_instances {
1413 0     0 0   my($self,%args)=@_;
1414 0           my $res = $self->ua->request(
1415             path => "/history/historic-activity-instances",
1416             params => \%args,
1417             method => "GET"
1418             );
1419 0           Activiti::Rest::Response->from_http_response($res);
1420             }
1421             sub historic_activity_instance {
1422 0     0 0   my($self,%args)=@_;
1423             my $res = $self->ua->request(
1424 0           path => "/history/historic-activity-instances/".uri_escape($args{activityInstanceId}),
1425             params => {},
1426             method => "GET"
1427             );
1428 0           Activiti::Rest::Response->from_http_response($res);
1429             }
1430             sub historic_detail {
1431 0     0 0   my($self,%args)=@_;
1432 0           my $res = $self->ua->request(
1433             path => "/history/historic-detail",
1434             params => \%args,
1435             method => "GET"
1436             );
1437 0           Activiti::Rest::Response->from_http_response($res);
1438             }
1439             sub query_historic_detail {
1440 0     0 0   my($self,%args)=@_;
1441             my $res = $self->ua->request(
1442             path => "/query/historic-detail",
1443             params => {},
1444             method => "POST",
1445             headers => {
1446             'Content-Type' => "application/json",
1447             Content => encode_json($args{content})
1448 0           }
1449             );
1450 0           Activiti::Rest::Response->from_http_response($res);
1451             }
1452             sub users {
1453 0     0 0   my($self,%args)=@_;
1454 0           my $res = $self->ua->request(
1455             path => "/identity/users",
1456             params => \%args,
1457             method => "GET"
1458             );
1459 0           Activiti::Rest::Response->from_http_response($res);
1460             }
1461             sub user {
1462 0     0 0   my($self,%args)=@_;
1463             my $res = $self->ua->request(
1464 0           path => "/identity/users/".uri_escape($args{userId}),
1465             params => {},
1466             method => "GET"
1467             );
1468 0           Activiti::Rest::Response->from_http_response($res);
1469             }
1470             sub user_info {
1471 0     0 0   my($self,%args)=@_;
1472             my $res = $self->ua->request(
1473 0           path => "/identity/users/".uri_escape($args{userId})."/info",
1474             params => {},
1475             method => "GET"
1476             );
1477 0           Activiti::Rest::Response->from_http_response($res);
1478             }
1479              
1480             sub groups {
1481 0     0 0   my($self,%args)=@_;
1482 0           my $res = $self->ua->request(
1483             path => "/identity/groups",
1484             params => \%args,
1485             method => "GET"
1486             );
1487 0           Activiti::Rest::Response->from_http_response($res);
1488             }
1489             sub group {
1490 0     0 0   my($self,%args)=@_;
1491             my $res = $self->ua->request(
1492 0           path => "/identity/groups/".uri_escape($args{groupId}),
1493             params => {},
1494             method => "GET"
1495             );
1496 0           Activiti::Rest::Response->from_http_response($res);
1497             }
1498              
1499             #forms
1500             sub form {
1501 0     0 0   my($self,%args)=@_;
1502 0           my $res = $self->ua->request(
1503             path => "/form/form-data",
1504             params => \%args,
1505             method => "GET"
1506             );
1507 0           Activiti::Rest::Response->from_http_response($res);
1508             }
1509             sub update_form {
1510 0     0 0   my($self,%args)=@_;
1511             my $res = $self->ua->request(
1512             path => "/form/form-data",
1513             params => \%args,
1514             method => "POST",
1515             headers => {
1516             'Content-Type' => "application/json",
1517             Content => encode_json($args{content})
1518 0           }
1519             );
1520 0           Activiti::Rest::Response->from_http_response($res);
1521             }
1522              
1523             sub jobs {
1524 0     0 0   my($self,%args)=@_;
1525 0           my $res = $self->ua->request(
1526             path => "/management/jobs",
1527             params => \%args,
1528             method => "GET"
1529             );
1530 0           Activiti::Rest::Response->from_http_response($res);
1531             }
1532             sub job {
1533 0     0 0   my($self,%args)=@_;
1534             my $res = $self->ua->request(
1535 0           path => "/management/jobs/".uri_escape($args{jobId}),
1536             params => {},
1537             method => "GET"
1538             );
1539 0           Activiti::Rest::Response->from_http_response($res);
1540             }
1541             sub job_exception_stacktrace {
1542 0     0 0   my($self,%args)=@_;
1543             my $res = $self->ua->request(
1544 0           path => "/management/jobs/".uri_escape($args{jobId})."/exception-stacktrace",
1545             params => {},
1546             method => "GET"
1547             );
1548 0           Activiti::Rest::Response->from_http_response($res);
1549             }
1550              
1551             sub delete_job {
1552 0     0 0   my($self,%args)=@_;
1553             my $res = $self->ua->request(
1554 0           path => "/management/jobs/".uri_escape($args{jobId}),
1555             params => {},
1556             method => "DELETE"
1557             );
1558 0           Activiti::Rest::Response->from_http_response($res);
1559             }
1560             sub execute_job {
1561 0     0 0   my($self,%args)=@_;
1562             my $res = $self->ua->request(
1563 0           path => "/management/jobs/".uri_escape($args{jobId}),
1564             params => {},
1565             method => "POST",
1566             headers => {
1567             'Content-Type' => "application/json",
1568             Content => encode_json({ action => "execute" })
1569             }
1570             );
1571 0           Activiti::Rest::Response->from_http_response($res);
1572             }
1573              
1574             sub deadletter_jobs {
1575 0     0 0   my($self,%args)=@_;
1576 0           my $res = $self->ua->request(
1577             path => "/management/deadletter-jobs",
1578             params => \%args,
1579             method => "GET"
1580             );
1581 0           Activiti::Rest::Response->from_http_response($res);
1582             }
1583              
1584             sub deadletter_job {
1585 0     0 0   my($self,%args)=@_;
1586             my $res = $self->ua->request(
1587 0           path => "/management/deadletter-jobs/".uri_escape($args{jobId}),
1588             params => {},
1589             method => "GET"
1590             );
1591 0           Activiti::Rest::Response->from_http_response($res);
1592             }
1593              
1594             #always plain text, no matter what. Header "Content-Type" not be trusted.
1595             sub deadletter_job_exception_stacktrace {
1596 0     0 0   my($self,%args)=@_;
1597             my $res = $self->ua->request(
1598 0           path => "/management/deadletter-jobs/".uri_escape($args{jobId})."/exception-stacktrace",
1599             params => {},
1600             method => "GET",
1601             headers => {
1602             "Accept" => "text/plain"
1603             }
1604             );
1605 0           Activiti::Rest::Response->from_http_response($res);
1606             }
1607              
1608             sub delete_deadletter_job {
1609 0     0 0   my($self,%args)=@_;
1610             my $res = $self->ua->request(
1611 0           path => "/management/deadletter-jobs/".uri_escape($args{jobId}),
1612             params => {},
1613             method => "DELETE"
1614             );
1615 0           Activiti::Rest::Response->from_http_response($res);
1616             }
1617              
1618             sub execute_deadletter_job {
1619 0     0 0   my($self,%args)=@_;
1620             my $res = $self->ua->request(
1621 0           path => "/management/deadletter-jobs/".uri_escape($args{jobId}),
1622             params => {},
1623             method => "POST",
1624             headers => {
1625             'Content-Type' => "application/json",
1626             Content => encode_json({ action => "move" })
1627             }
1628             );
1629 0           Activiti::Rest::Response->from_http_response($res);
1630             }
1631              
1632             sub timer_jobs {
1633 0     0 0   my($self,%args)=@_;
1634 0           my $res = $self->ua->request(
1635             path => "/management/timer-jobs",
1636             params => \%args,
1637             method => "GET"
1638             );
1639 0           Activiti::Rest::Response->from_http_response($res);
1640             }
1641              
1642             sub timer_job {
1643 0     0 0   my($self,%args)=@_;
1644             my $res = $self->ua->request(
1645 0           path => "/management/timer-jobs/".uri_escape($args{jobId}),
1646             params => {},
1647             method => "GET"
1648             );
1649 0           Activiti::Rest::Response->from_http_response($res);
1650             }
1651              
1652             sub execute_timer_job {
1653 0     0 0   my($self,%args)=@_;
1654             my $res = $self->ua->request(
1655 0           path => "/management/timer-jobs/".uri_escape($args{jobId}),
1656             params => {},
1657             method => "POST",
1658             headers => {
1659             'Content-Type' => "application/json",
1660             Content => encode_json({ action => "move" })
1661             }
1662             );
1663 0           Activiti::Rest::Response->from_http_response($res);
1664             }
1665              
1666             sub suspended_jobs {
1667 0     0 0   my($self,%args)=@_;
1668 0           my $res = $self->ua->request(
1669             path => "/management/suspended-jobs",
1670             params => \%args,
1671             method => "GET"
1672             );
1673 0           Activiti::Rest::Response->from_http_response($res);
1674             }
1675              
1676             sub suspended_job {
1677 0     0 0   my($self,%args)=@_;
1678             my $res = $self->ua->request(
1679 0           path => "/management/suspended-jobs/".uri_escape($args{jobId}),
1680             params => {},
1681             method => "GET"
1682             );
1683 0           Activiti::Rest::Response->from_http_response($res);
1684             }
1685              
1686             =head1 LICENSE AND COPYRIGHT
1687              
1688             This program is free software; you can redistribute it and/or modify it
1689             under the terms of either: the GNU General Public License as published
1690             by the Free Software Foundation; or the Artistic License.
1691              
1692             See L for more information.
1693              
1694             =cut
1695              
1696             1;