| 1 | 1 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Data::Conveyor::Ticket::Transaction; | ||||||||||
| 6 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | $Data::Conveyor::Ticket::Transaction::VERSION = '1.103130'; | |||||||||
| 8 | } | ||||||||||
| 9 | # ABSTRACT: Stage-based conveyor-belt-like ticket handling system | ||||||||||
| 10 | |||||||||||
| 11 | # | ||||||||||
| 12 | # Represents a single transaction as selected by txsel | ||||||||||
| 13 | 1 | ▶ | use parent 'Class::Scaffold::Storable'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | __PACKAGE__->mk_scalar_accessors(qw( | |||||||||
| 15 | payload_item object_type command type status necessity | ||||||||||
| 16 | )); | ||||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub is_optional { | ||||||||
|
Subroutine
is_optional: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 19 | 0 | my $self = shift; | |||||||||
| 20 | 0 | $self->necessity eq $self->delegate->TXN_OPTIONAL; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub update_status { | ||||||||
|
Subroutine
update_status: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 24 | 0 | my ($self, $ticket) = @_; | |||||||||
| 25 | |||||||||||
| 26 | # Apply a default value, but don't change transactions that are set to | ||||||||||
| 27 | # TXS_IGNORE. This is relevant if you manually delete exceptions (via a | ||||||||||
| 28 | # service interface) - then you also want to reset transaction stati. | ||||||||||
| 29 | 0 | ▶ | $self->status($self->delegate->TXS_RUNNING) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | if $self->status eq $self->delegate->TXS_ERROR; | ||||||||||
| 31 | 0 | ▶ | return unless $self->payload_item->has_problematic_exceptions($ticket); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | $self->status($self->delegate->TXS_ERROR); | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | # Check that the current transaction's command is allowed for the ticket's | ||||||||||
| 36 | # type. For example, a 'perscreate' must only contain 'create' commands. | ||||||||||
| 37 | # | ||||||||||
| 38 | # Don't check the value objects this transaction object consists of, like we | ||||||||||
| 39 | # do with business objects - we generated the transaction object, and we | ||||||||||
| 40 | # expect it to be correct. It should have been created with checks on, so | ||||||||||
| 41 | # illegal arguments should have been spotted then and there (probably in the | ||||||||||
| 42 | # txsel). | ||||||||||
| 43 | # | ||||||||||
| 44 | # Note that exceptions are recorded not into the exception container this | ||||||||||
| 45 | # method is given in the second arg, but into the exception container of the | ||||||||||
| 46 | # payload item this transaction points to. That's because update_status() checks | ||||||||||
| 47 | # the referenced payload item's exception container to see whether to set this | ||||||||||
| 48 | # transaction's status to TXS_ERROR; an illegal transaction given the current | ||||||||||
| 49 | # ticket type should certainly be considered a problematic exception. | ||||||||||
| 50 | 0 | ▶ | sub check { | ||||||||
|
Subroutine
check: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 51 | 0 | my ($self, $ticket) = @_[0,2]; | |||||||||
| 52 | 0 | $self->check_policy_allowed_tx_for_ticket_type($ticket); | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 0 | ▶ | sub check_policy_allowed_tx_for_ticket_type { | ||||||||
|
Subroutine
check_policy_allowed_tx_for_ticket_type: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 56 | 0 | my ($self, $ticket) = @_; | |||||||||
| 57 | return | ||||||||||
| 58 | 0 | ▶ | if $self->storage->policy_allowed_tx_for_ticket_type( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | ticket_type => $ticket->type, | ||||||||||
| 60 | object_type => $self->object_type, | ||||||||||
| 61 | command => $self->command, | ||||||||||
| 62 | txtype => $self->type, | ||||||||||
| 63 | ); | ||||||||||
| 64 | 0 | throw Data::Conveyor::Exception::CommandDenied( | |||||||||
| 65 | ticket_type => $ticket->type, | ||||||||||
| 66 | object_type => $self->object_type, | ||||||||||
| 67 | command => $self->command, | ||||||||||
| 68 | ); | ||||||||||
| 69 | } | ||||||||||
| 70 | 1 | ▶ | use constant SKIP_COMPARABLE_KEYS => ('payload_item'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 71 | 1 | 1; | |||||||||
| 72 | |||||||||||
| 73 | |||||||||||
| 74 | __END__ | ||||||||||