| 1 | 1 | ▶ | use v5.40; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use experimental 'class'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | class Daje::Workflow::Roadmap::Load { | |||||||||
| 5 | 1 | ▶ | use Daje::Config; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | field $workflow :reader; | |||||||||
| 9 | 1 | field $path :param; | |||||||||
| 10 | 1 | field $type :param = "workflow"; | |||||||||
| 11 | |||||||||||
| 12 | 0 | ▶ | method load() { | ||||||||
|
Subroutine
load: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 13 | 0 | $workflow = Daje::Config->new( | |||||||||
| 14 | path => $path, | ||||||||||
| 15 | type => $type, | ||||||||||
| 16 | )->load(); | ||||||||||
| 17 | |||||||||||
| 18 | 0 | return 1; | |||||||||
| 19 | 1 | } | |||||||||
| 20 | |||||||||||
| 21 | # Get the entire workflow as a hashref | ||||||||||
| 22 | 0 | ▶ | method get_workflow() { | ||||||||
|
Subroutine
get_workflow: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | 0 | return $workflow->{workflow}; | |||||||||
| 24 | 1 | } | |||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | method get_state( $workflow_name, $state_name) { | ||||||||
|
Subroutine
get_state: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 27 | 0 | my $flow = $workflow->{$workflow_name}; | |||||||||
| 28 | 0 | my $length = scalar @{$flow}; | |||||||||
| 29 | 0 | my $state; | |||||||||
| 30 | 0 | ▶ | for (my $i = 0; $i < $length; $i++) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | ▶ | if (@{$flow}[$i]->{name} eq $state_name) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | $state = @{$flow}[$i]; | |||||||||
| 33 | } | ||||||||||
| 34 | } | ||||||||||
| 35 | 0 | return $state; | |||||||||
| 36 | 1 | } | |||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | method get_pre_checks( $workflow_name, $state_name) { | ||||||||
|
Subroutine
get_pre_checks: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 39 | 0 | my $state = $self->get_state($workflow_name, $state_name); | |||||||||
| 40 | 0 | return $state->{state}->{pre_checks}; | |||||||||
| 41 | 1 | } | |||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | method get_post_checks( $workflow_name, $state_name) { | ||||||||
|
Subroutine
get_post_checks: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 44 | 0 | my $state = $self->get_state($workflow_name, $state_name); | |||||||||
| 45 | 0 | return $state->{state}->{post_checks}; | |||||||||
| 46 | 1 | } | |||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | method get_next_state($workflow_name, $state_name) { | ||||||||
|
Subroutine
get_next_state: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 49 | 0 | my $state = $self->get_state($workflow_name, $state_name); | |||||||||
| 50 | 0 | return $state->{next_state}; | |||||||||
| 51 | 1 | } | |||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | method get_state_observers($workflow_name, $state_name) { | ||||||||
|
Subroutine
get_state_observers: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 54 | 0 | my $state = $self->get_state($workflow_name, $state_name); | |||||||||
| 55 | 0 | return $state->{state}->{observers}; | |||||||||
| 56 | 1 | } | |||||||||
| 57 | |||||||||||
| 58 | 0 | ▶ | method get_activity($workflow_name, $state_name, $activity_name) { | ||||||||
|
Subroutine
get_activity: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 59 | 0 | my $activity; | |||||||||
| 60 | 0 | my $activities = $self->get_state($workflow_name, $state_name)->{state}->{activities}; | |||||||||
| 61 | 0 | my $length = scalar @{$activities}; | |||||||||
| 62 | 0 | ▶ | for (my $i = 0; $i < $length; $i++) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 0 | ▶ | if (@{$activities}[$i]->{name} eq $activity_name) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | 0 | $activity = @{$activities}[$i]; | |||||||||
| 65 | } | ||||||||||
| 66 | } | ||||||||||
| 67 | 0 | return $activity; | |||||||||
| 68 | 1 | } | |||||||||
| 69 | |||||||||||
| 70 | 0 | ▶ | method get_activity_pre_checks( $workflow_name, $state_name, $activity_name) { | ||||||||
|
Subroutine
get_activity_pre_checks: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 71 | 0 | my $activity = $self->get_activity($workflow_name, $state_name, $activity_name); | |||||||||
| 72 | 0 | return $activity->{pre_checks}; | |||||||||
| 73 | 1 | } | |||||||||
| 74 | |||||||||||
| 75 | 0 | ▶ | method get_activity_post_checks( $workflow_name, $state_name, $activity_name) { | ||||||||
|
Subroutine
get_activity_post_checks: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 76 | 0 | my $activity = $self->get_activity($workflow_name, $state_name, $activity_name); | |||||||||
| 77 | 0 | return $activity->{post_checks}; | |||||||||
| 78 | 1 | } | |||||||||
| 79 | |||||||||||
| 80 | 0 | ▶ | method get_que_activities( $workflow_name, $state_name, $activity_name) { | ||||||||
|
Subroutine
get_que_activities: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 81 | 0 | my $activity = $self->get_activity($workflow_name, $state_name, $activity_name); | |||||||||
| 82 | 0 | ▶ | if(exists $activity->{que_activities}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 83 | 0 | return $activity->{que_activities}; | |||||||||
| 84 | } | ||||||||||
| 85 | 0 | return []; | |||||||||
| 86 | 1 | } | |||||||||
| 87 | } | ||||||||||
| 88 | |||||||||||
| 89 | 1 | 1; | |||||||||
| 90 | |||||||||||
| 91 | |||||||||||
| 92 | |||||||||||
| 93 | |||||||||||
| 94 | |||||||||||
| 95 | |||||||||||
| 96 | #################### pod generated by Pod::Autopod - keep this line to make pod updates possible #################### | ||||||||||
| 97 | |||||||||||
| 98 | =head1 NAME | ||||||||||
| 99 | |||||||||||
| 100 | lib::Daje::Workflow::Roadmap::Load - lib::Daje::Workflow::Roadmap::Load | ||||||||||
| 101 | |||||||||||
| 102 | |||||||||||
| 103 | =head1 DESCRIPTION | ||||||||||
| 104 | |||||||||||
| 105 | Get the entire workflow as a hashref | ||||||||||
| 106 | |||||||||||
| 107 | |||||||||||
| 108 | =head1 REQUIRES | ||||||||||
| 109 | |||||||||||
| 110 | L<Data::Dumper> | ||||||||||
| 111 | |||||||||||
| 112 | L<Daje::Config> | ||||||||||
| 113 | |||||||||||
| 114 | L<experimental> | ||||||||||
| 115 | |||||||||||
| 116 | L<v5.40> | ||||||||||
| 117 | |||||||||||
| 118 | |||||||||||
| 119 | =head1 METHODS | ||||||||||
| 120 | |||||||||||
| 121 | |||||||||||
| 122 | =cut | ||||||||||
| 123 | |||||||||||