Solstice::State::Transition - Representation of the transition between Solstice::State objects.


Solstice documentation Contained in the Solstice distribution.

Index


Code Index:

NAME

Top

Solstice::State::Transition - Representation of the transition between Solstice::State objects.

SYNOPSIS

Top

use Solstice::State::Transition;

my $transition = new Solstice::State::Transition( $action, $targetState, $pageflow, {update => $update, revert => $revert, freshen => $freshen, commit => $commit, validate => $validate});

$pageFlow->addTransition($transition);

Methods

new ($action, $targetState, $onBack, $pageflow, {update => $update, revert => $revert, freshen => $freshen, commit => $commit, validate => $validate})

Creates a new Solstice::State::Transition object.

$action - the keyword on which to transition. $targetState - the name of the state to transition to. $onBack - the error message for using the back button (undef if allowed). $pageflow - global transtions can specify what page flow they will start in $update - whether to update on transition. $revert - whether to revert on transition. $freshen - whether to freshen data on transition. $commit - whether to commit data on transition. $validate - whether to validate on transition.

returns - a new state transition object.

getName()

returns - the name of the transition (the action)

getTargetState()

returns - the name of the state to transition to.

getBackErrorMessage()

returns - the error message for using the back button (undef if allowed).

requiresUpdate()

returns - whether the transition requires an update.

requiresRevert()

returns - whether the transition requires a revert.

requiresFresh()

returns - whether the transition requires a freshen.

requiresCommit()

returns - whether the transition requires a commit.

requiresValidation()

returns - whether the transition requires a validation.

COPYRIGHT

Top


Solstice documentation Contained in the Solstice distribution.
package Solstice::State::Transition;


use 5.006_000;
use strict;
use warnings;


sub new {
    my ($classname, $action, $target_state, $on_back, $pageflow, $operations) = @_;

    my $self = bless {}, $classname;
    $self->{_action} = $action;
    $self->{_targetState} = $target_state;
    $self->{_onBack} = $on_back;
    $self->{_pageflow} = $pageflow;
    $self->{_update} = $operations->{update} || 0;
    $self->{_revert} = $operations->{revert} || 0;
    $self->{_freshen} = $operations->{freshen} || 0;
    $self->{_commit} = $operations->{commit} || 0;
    $self->{_validate} = $operations->{validate} || 0;

    return $self;
}


sub getName {
    my ($self) = @_;
    return $self->{_action};
}

sub getTargetPageFlow {
    my $self = shift;
    return $self->{'_pageflow'};
}
sub getTargetState {
    my ($self) = @_;
    return $self->{_targetState};
}


sub getBackErrorMessage {
    my ($self) = @_;
    return $self->{_onBack};
}


sub requiresUpdate {
    my ($self) = @_;
    return $self->{_update};
}


sub requiresRevert {
    my ($self) = @_;
    return $self->{_revert};
}

sub requiresFresh {
    my ($self) = @_;
    return $self->{_freshen};
}

sub requiresCommit {
    my ($self) = @_;
    return $self->{_commit};
}

sub requiresValidation {
    my ($self) = @_;
    return $self->{_validate};
}


1;