eZ Publish  [4.0]
ezimportlookuptable.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZImportLookupTable class
00004 //
00005 // Created on: <08-Mar-2004 16:09:21 kk>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*! \file ezimportlookuptable.php
00032 
00033   This class is for storing node and object id transformations which occur during import of objects.
00034 */
00035 
00036 class eZImportLookupTable
00037 {
00038     /*!
00039      Constructor
00040     */
00041     function eZImportLookupTable()
00042     {
00043     }
00044 
00045     /*!
00046      Add node transformation lookup
00047 
00048      \param old node id
00049      \param old node path
00050      \param new node id
00051      \param new node path
00052     */
00053     function addNodeLookup( $oldNodeID, $oldNodePath, $newNodeID, $newNodePath )
00054     {
00055         $this->NodeIDTable[(string)$oldNodeID] = $newNodeID;
00056         $this->NodePathTable[(string)$oldNodePath] = $newNodePath;
00057     }
00058 
00059     /*!
00060      Add object transformation lookup
00061 
00062      \param old object id
00063      \param new object id
00064     */
00065     function addObjectLookup( $oldObjectID, $newObjectID )
00066     {
00067         $this->ObjectIDTable[(string)$oldObjectID] = $newObjectID;
00068     }
00069 
00070     /*!
00071      Get new Node id from old node id
00072 
00073      \param old node id
00074 
00075      \return new node id
00076     */
00077     function newNodeID( $oldNodeID )
00078     {
00079         return $this->NodeIDTable[(string)$oldNodeID];
00080     }
00081 
00082     /*!
00083      Get new Node path from old node path
00084 
00085      \param old node path
00086 
00087      \return new node path
00088     */
00089     function newNodePath( $oldNodePath )
00090     {
00091         return $this->NodePathTable[(string)$oldNodePath];
00092     }
00093 
00094     /*!
00095      Get new Object id from old object id
00096 
00097      \param old object id
00098 
00099      \return new object id
00100     */
00101     function newObjectID( $oldObjectID )
00102     {
00103         return $this->ObjectIDTable[(string)$oldObjectID];
00104     }
00105 
00106     /*!
00107      \static
00108 
00109      Fetch instance of eZImportLookupTable
00110 
00111      \param force new instance (optional), default false
00112     */
00113     static function instance( $forceNewInstance = false )
00114     {
00115         if ( $forceNewInstance === true )
00116         {
00117             $GLOBALS['eZImportLookupTable'] = new eZImportLookupTable();
00118         }
00119 
00120         $object =& $GLOBALS['eZImportLookupTable'];
00121         if ( !$object )
00122         {
00123             $GLOBALS['eZImportLookupTable'] = new eZImportLookupTable();
00124             $object =& $GLOBALS['eZImportLookupTable'];
00125         }
00126 
00127         return $object;
00128     }
00129 
00130     public $NodeIDTable = array();
00131     public $NodePathTable = array();
00132     public $ObjectIDTable = array();
00133     public $ObjectPathTable = array();
00134 }
00135 ?>