*
  • type - Class name of the Action class used by this ActionMapping. *
  • *
  • name - Name of the ActionForm class, if any, associated with this * Action.
  • *
  • input - Path of the input form to which control should be * returned if a validation error is encountered.
  • *
  • validate - Set to 1 if the validate() method of the ActionForm * class (if any) associated with this ActionMapping should be called. [0]
  • * * * @author Arnold Cano * @version $Id: ActionMapping.php,v 1.3 2007-06-20 11:01:26 afelixf Exp $ * @package Phrame */ class ActionMapping extends HashMap { /** * Type of the ActionMapping * @access protected * @var string $_type */ protected $_type; /** * Name of the ActionMapping. * @access protected * @var string $_name */ protected $_name; /** * Input URI of the ActionMapping. * @access protected * @var string $_input */ protected $_input; /** * @access protected * @var bool $_validate */ protected $_validate = false; /** * Create a ActionMapping with the specified values. * * @access public * @param string $name * @param string[] $mapping Array: [ _TYPE => string, _INPUT => string, _ACTION_FORWARDS => [[ _PATH => string, _REDIRECT => bool], ...] ] */ public function __construct( $name, $mapping ) { $this->setType( $mapping[_TYPE] ); $this->setName( $name ); $this->setInput( $mapping[_INPUT] ); if( is_array($mapping[_ACTION_FORWARDS]) ) { $this->_initActionForwards( $mapping[_ACTION_FORWARDS] ); } } //Fin del constructor /** * Initialize the ActionForwards array associated with this * ActionMapping. * * @access private * @param string[][] $forwards Array: [[ _PATH => string, _REDIRECT => bool], ...] */ private function _initActionForwards( $forwards ) { foreach( $forwards as $name => $forward ) { $actionForward = new ActionForward( $name, $forward ); $this->put( $name, $actionForward ); } } //Fin de _initActionForwards /** * Get the type of the ActionMapping. * * @access public * @return string */ function getType() { return $this->_type; } //Fin de getType /** * Set the type of the ActionMapping. * * @access public * @param string $type */ function setType( $type ) { $this->_type = $type; } //Fin de setType /** * Get the name of the ActionMapping. * * @access public * @return string */ function getName() { return $this->_name; } //Fin de getName /** * Set the name of the ActionMapping. * * @access public * @param string $name */ function setName( $name ) { $this->_name = $name; } //Fin de setName /** * Get the input URI of the ActionMapping. * * @access public * @return string */ function getInput() { return $this->_input; } //Fin de getInput /** * Set the input URI of the ActionMapping. * * @access public * @param string $input */ function setInput( $input ) { $this->_input = $input; } //Fin de setInput /** * Get the validate flag of the ActionForward. * * @access public * @return bool */ function getValidate() { return $this->_validate; } //Fin de getValidate /** * Set the validate flag of the ActionForward. * * @access public * @param bool $validate */ function setValidate( $validate ) { $this->_validate = $validate; } //Fin de setValidate /** * Returns the ActionForm to which the specified key is mapped in this identity * hash map, or null if the map contains no mapping for this key. * * @access public * @param mixed $key * @return ActionForward */ public function get( $key ) { if( $this->containsKey($key) ) { return $this->_values[$key]; } else { die( 'Error: actionForward '.$key.' no existe. Consulte el fichero de mapeos.' ); } } //Fin de get }// End ActionMapping