| 1 | # Base class, shouldnt be directly instantiated | ||
| 2 | |||
| 3 | { | ||
| 4 | package Workflow::Aline::Pluggable; | ||
| 5 | |||
| 6 | Class::Maker::class | ||
| 7 | { | ||
| 8 | public => | ||
| 9 | { | ||
| 10 | string => [qw( id )], | ||
| 11 | }, | ||
| 12 | }; | ||
| 13 | |||
| 14 | sub plug : method | ||
| 15 | { | ||
| 16 | my $this = shift; | ||
| 17 | |||
| 18 | $this->_plug_proximal; | ||
| 19 | |||
| 20 | $this->_plug_distal; | ||
| 21 | } | ||
| 22 | |||
| 23 | sub _plug_distal : method | ||
| 24 | { | ||
| 25 | my $this = shift; | ||
| 26 | |||
| 27 | if( defined $this->distal ) | ||
| 28 | { | ||
| 29 | $this->distal->proximal( $this ) if $this->distal->isa( 'Workflow::Aline::Pluggable::OneProximal' ); | ||
| 30 | |||
| 31 | push @{ $this->distal->proximal }, $this if $this->distal->isa( 'Workflow::Aline::Pluggable::ManyProximal' ); | ||
| 32 | } | ||
| 33 | } | ||
| 34 | |||
| 35 | sub _plug_proximal : method | ||
| 36 | { | ||
| 37 | my $this = shift; | ||
| 38 | |||
| 39 | if( defined $this->proximal ) | ||
| 40 | { | ||
| 41 | $this->proximal->distal( $this ) if $this->proximal->isa( 'Workflow::Aline::Pluggable::OneDistal' ); | ||
| 42 | |||
| 43 | push @{ $this->proximal->distal }, $this if $this->proximal->isa( 'Workflow::Aline::Pluggable::ManyDistal' ); | ||
| 44 | } | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | { | ||
| 49 | package Workflow::Aline::Pluggable::OneProximal; | ||
| 50 | |||
| 51 | Class::Maker::class | ||
| 52 | { | ||
| 53 | isa => [qw(Workflow::Aline::Pluggable)], | ||
| 54 | |||
| 55 | public => | ||
| 56 | { | ||
| 57 | ref => [qw( proximal )], | ||
| 58 | }, | ||
| 59 | }; | ||
| 60 | } | ||
| 61 | |||
| 62 | { | ||
| 63 | package Workflow::Aline::Pluggable::ManyProximal; | ||
| 64 | |||
| 65 | Class::Maker::class | ||
| 66 | { | ||
| 67 | isa => [qw(Workflow::Aline::Pluggable)], | ||
| 68 | |||
| 69 | public => | ||
| 70 | { | ||
| 71 | array => [qw( proximal )], | ||
| 72 | }, | ||
| 73 | }; | ||
| 74 | } | ||
| 75 | |||
| 76 | { | ||
| 77 | package Workflow::Aline::Pluggable::OneDistal; | ||
| 78 | |||
| 79 | Class::Maker::class | ||
| 80 | { | ||
| 81 | isa => [qw(Workflow::Aline::Pluggable)], | ||
| 82 | |||
| 83 | public => | ||
| 84 | { | ||
| 85 | ref => [qw( distal )], | ||
| 86 | }, | ||
| 87 | }; | ||
| 88 | } | ||
| 89 | |||
| 90 | { | ||
| 91 | package Workflow::Aline::Pluggable::ManyDistal; | ||
| 92 | |||
| 93 | Class::Maker::class | ||
| 94 | { | ||
| 95 | isa => [qw(Workflow::Aline::Pluggable)], | ||
| 96 | |||
| 97 | public => | ||
| 98 | { | ||
| 99 | array => [qw( distal )], | ||
| 100 | }, | ||
| 101 | }; | ||
| 102 | } | ||
| 103 | |||
| 104 | # Here the composites begin | ||
| 105 | |||
| 106 | { | ||
| 107 | package Workflow::Aline::Pluggable::OneProximalOneDistal; | ||
| 108 | |||
| 109 | Class::Maker::class | ||
| 110 | { | ||
| 111 | isa => [qw(Workflow::Aline::Pluggable::OneProximal Workflow::Aline::Pluggable::OneDistal)], | ||
| 112 | }; | ||
| 113 | } | ||
| 114 | |||
| 115 | { | ||
| 116 | package Workflow::Aline::Pluggable::OneProximalManyDistal; | ||
| 117 | |||
| 118 | Class::Maker::class | ||
| 119 | { | ||
| 120 | isa => [qw(Workflow::Aline::Pluggable::OneProximal Workflow::Aline::Pluggable::ManyDistal)], | ||
| 121 | }; | ||
| 122 | } | ||
| 123 | |||
| 124 | { | ||
| 125 | package Workflow::Aline::Pluggable::ManyProximalManyDistal; | ||
| 126 | |||
| 127 | Class::Maker::class | ||
| 128 | { | ||
| 129 | isa => [qw(Workflow::Aline::Pluggable::ManyProximal Workflow::Aline::Pluggable::ManyDistal)], | ||
| 130 | }; | ||
| 131 | } | ||
| 132 | |||
| 133 | { | ||
| 134 | package Workflow::Aline::Pluggable::ManyProximalOneDistal; | ||
| 135 | |||
| 136 | Class::Maker::class | ||
| 137 | { | ||
| 138 | isa => [qw(Workflow::Aline::Pluggable::ManyProximal Workflow::Aline::Pluggable::OneDistal)], | ||
| 139 | }; | ||
| 140 | } | ||
| 141 | |||
| 142 | 1; |