blob: ac27cc5abd94a99b153f8faade74f2f5ad4b952d [file] [log] [blame]
<?php
/**
* File containing the ezcWorkflowNodeExclusiveChoice class.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* @package Workflow
* @version //autogen//
* @copyright Copyright (C) 2005-2010 eZ Systems AS. All rights reserved.
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
*/
/**
* This node implements the Exclusive Choice workflow pattern.
*
* The Exclusive Choice workflow pattern defines multiple possible paths
* for the workflow of which exactly one is chosen based on the conditions
* set for the out nodes.
*
* Incoming nodes: 1
* Outgoing nodes: 2..*
*
* This example displays how you can use an exclusive choice to select one of two
* possible branches depending on the workflow variable 'value' which is read using
* an input node.
*
* <code>
* <?php
* $workflow = new ezcWorkflow( 'Test' );
*
* // wait for input into the workflow variable value.
* $input = new ezcWorkflowNodeInput( array( 'value' => new ezcWorkflowConditionIsInt ) );
* $workflow->startNode->addOutNode( $input );
*
* // create the exclusive choice branching node
* $choice = new ezcWorkflowNodeExclusiveChoice;
* $intput->addOutNode( $choice );
*
* $branch1 = ....; // create nodes for the first branch of execution here..
* $branch2 = ....; // create nodes for the second branch of execution here..
*
* // add the outnodes and set the conditions on the exclusive choice
* $choice->addConditionalOutNode( new ezcWorkflowConditionVariable( 'value',
* new ezcWorkflowConditionGreaterThan( 10 ) ),
* $branch1 );
* $choice->addConditionalOutNode( new ezcWorkflowConditionVariable( 'value',
* new ezcWorkflowConditionLessThan( 11 ) ),
* $branch2 );
*
* // Merge the two branches together and continue execution.
* $merge = new ezcWorkflowNodeSimpleMerge();
* $merge->addInNode( $branch1 );
* $merge->addInNode( $branch2 );
* $merge->addOutNode( $workflow->endNode );
* ?>
* </code>
*
* @package Workflow
* @version //autogen//
*/
class ezcWorkflowNodeExclusiveChoice extends ezcWorkflowNodeConditionalBranch
{
/**
* Constraint: The minimum number of conditional outgoing nodes this node
* has to have. Set to false to disable this constraint.
*
* @var integer
*/
protected $minConditionalOutNodes = 2;
/**
* Constraint: The minimum number of conditional outgoing nodes this node
* has to activate. Set to false to disable this constraint.
*
* @var integer
*/
protected $minActivatedConditionalOutNodes = 1;
/**
* Constraint: The maximum number of conditional outgoing nodes this node
* may activate. Set to false to disable this constraint.
*
* @var integer
*/
protected $maxActivatedConditionalOutNodes = 1;
}
?>