Mage_Dataflow_Model_Convert_Profile_Collection Class Reference

Inheritance diagram for Mage_Dataflow_Model_Convert_Profile_Collection:

Mage_Core_Model_Convert Mage_Catalog_Model_Convert

List of all members.

Public Member Functions

 getContainers ()
 getContainer ($name)
 addContainer ($name, Mage_Dataflow_Model_Convert_Container_Interface $container)
 getProfiles ()
 getProfile ($name)
 addProfile ($name, Mage_Dataflow_Model_Convert_Profile_Interface $profile=null)
 run ($profile)
 getClassNameByType ($type)
 importXml ($xml)
 importProfileXml ($name)

Protected Attributes

 $_xml
 $_containers
 $_profiles = array()
 $_simplexmlDefaultClass = 'Varien_Simplexml_Element'
 $_profileDefaultClass = 'Mage_Dataflow_Model_Convert_Profile'
 $_profileCollectionDefaultClass = 'Mage_Dataflow_Model_Convert_Profile_Collection'
 $_containerDefaultClass = 'Mage_Dataflow_Model_Convert_Container_Generic'
 $_containerCollectionDefaultClass = 'Mage_Dataflow_Model_Convert_Container_Collection'


Detailed Description

Definition at line 35 of file Collection.php.


Member Function Documentation

addContainer ( name,
Mage_Dataflow_Model_Convert_Container_Interface container 
)

Definition at line 69 of file Collection.php.

00070     {
00071         $container = $this->getContainers()->addItem($name, $container);
00072         return $container;
00073     }

addProfile ( name,
Mage_Dataflow_Model_Convert_Profile_Interface profile = null 
)

Definition at line 88 of file Collection.php.

00089     {
00090         if (is_null($profile)) {
00091             $profile = new $this->_profileDefaultClass();
00092         }
00093         $this->_profiles[$name] = $profile;
00094         return $profile;
00095     }

getClassNameByType ( type  ) 

Reimplemented in Mage_Core_Model_Convert.

Definition at line 103 of file Collection.php.

00104     {
00105         return $type;
00106     }

getContainer ( name  ) 

Definition at line 63 of file Collection.php.

00064     {
00065         return $this->getContainers()->getItem($name);
00066     }

getContainers (  ) 

Definition at line 54 of file Collection.php.

00055     {
00056         if (!$this->_containers) {
00057             $this->_containers = new $this->_containerCollectionDefaultClass();
00058             $this->_containers->setDefaultClass($this->_containerDefaultClass);
00059         }
00060         return $this->_containers;
00061     }

getProfile ( name  ) 

Definition at line 80 of file Collection.php.

00081     {
00082         if (!isset($this->_profiles[$name])) {
00083             $this->importProfileXml($name);
00084         }
00085         return $this->_profiles[$name];
00086     }

getProfiles (  ) 

Definition at line 75 of file Collection.php.

00076     {
00077         return $this->_profiles;
00078     }

importProfileXml ( name  ) 

Definition at line 131 of file Collection.php.

00132     {
00133         if (!$this->_xml) {
00134             return $this;
00135         }
00136         $nodes = $this->_xml->xpath("//profile[@name='".$name."']");
00137         if (!$nodes) {
00138             return $this;
00139         }
00140         $profileNode = $nodes[0];
00141 
00142         $profile = $this->addProfile($name);
00143         $profile->setContainers($this->getContainers());
00144         foreach ($profileNode->action as $actionNode) {
00145             $action = $profile->addAction();
00146             foreach ($actionNode->attributes() as $key=>$value) {
00147                 $action->setParam($key, (string)$value);
00148             }
00149 
00150             if ($actionNode['use']) {
00151                 $container = $profile->getContainer((string)$actionNode['use']);
00152             } else {
00153                 $action->setParam('class', $this->getClassNameByType((string)$actionNode['type']));
00154                 $container = $action->getContainer();
00155             }
00156             $action->setContainer($container);
00157             if ($action->getParam('name')) {
00158                 $this->addContainer($action->getParam('name'), $container);
00159             }
00160             foreach ($actionNode->var as $varNode) {
00161                 if ($varNode['name'] == 'map') {
00162                     $mapData = array();
00163                     foreach ($varNode->map as $mapNode) {
00164                         $mapData[(string)$mapNode['name']] = (string)$mapNode;
00165                     }
00166                     $container->setVar((string)$varNode['name'], $mapData);
00167                 }
00168                 else {
00169                     $container->setVar((string)$varNode['name'], (string)$varNode);
00170                 }
00171             }
00172         }
00173 
00174         return $this;
00175     }

importXml ( xml  ) 

Definition at line 108 of file Collection.php.

00109     {
00110         if (is_string($xml)) {
00111             $xml = @simplexml_load_string($xml, $this->_simplexmlDefaultClass);
00112         }
00113         if (!$xml instanceof SimpleXMLElement) {
00114             return $this;
00115         }
00116         $this->_xml = $xml;
00117 
00118         foreach ($xml->container as $containerNode) {
00119             if (!$containerNode['name'] || !$containerNode['type']) {
00120                 continue;
00121             }
00122             $class = $this->getClassNameByType((string)$containerNode['type']);
00123             $container = $this->addContainer((string)$containerNode['name'], new $class());
00124             foreach ($containerNode->var as $varNode) {
00125                 $container->setVar((string)$varNode['name'], (string)$varNode);
00126             }
00127         }
00128         return $this;
00129     }

run ( profile  ) 

Definition at line 97 of file Collection.php.

00098     {
00099         $this->getProfile($profile)->run();
00100         return $this;
00101     }


Member Data Documentation

$_containerCollectionDefaultClass = 'Mage_Dataflow_Model_Convert_Container_Collection' [protected]

Definition at line 52 of file Collection.php.

$_containerDefaultClass = 'Mage_Dataflow_Model_Convert_Container_Generic' [protected]

Definition at line 50 of file Collection.php.

$_containers [protected]

Definition at line 40 of file Collection.php.

$_profileCollectionDefaultClass = 'Mage_Dataflow_Model_Convert_Profile_Collection' [protected]

Definition at line 48 of file Collection.php.

$_profileDefaultClass = 'Mage_Dataflow_Model_Convert_Profile' [protected]

Definition at line 46 of file Collection.php.

$_profiles = array() [protected]

Definition at line 42 of file Collection.php.

$_simplexmlDefaultClass = 'Varien_Simplexml_Element' [protected]

Definition at line 44 of file Collection.php.

$_xml [protected]

Definition at line 38 of file Collection.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:05 2009 for Magento by  doxygen 1.5.8