class_DataSetCriteria.php

Go to the documentation of this file.
00001 <?php
00025 class DataSetCriteria extends BaseFrameworkSystem implements StoreableCriteria {
00029         private $tableName = "";
00030 
00034         private $tableColumns = array();
00035 
00039         private $uniqueKey = "";
00040 
00044         private $primaryKey = "";
00045 
00051         protected function __construct() {
00052                 // Call parent constructor
00053                 parent::__construct(__CLASS__);
00054 
00055                 // Clean up a little
00056                 $this->removeNumberFormaters();
00057                 $this->removeSystemArray();
00058         }
00059 
00066         public final static function createDataSetCriteria ($tableName) {
00067                 // Get a new instance
00068                 $criteriaInstance = new DataSetCriteria();
00069 
00070                 // Set table name
00071                 $criteriaInstance->setTableName($tableName);
00072 
00073                 // Return the instance
00074                 return $criteriaInstance;
00075         }
00076 
00084         public function addCriteria ($criteriaKey, $criteriaValue) {
00085                 $this->tableColumns[(string) $criteriaKey] = $criteriaValue;
00086         }
00087 
00095         public function addConfiguredCriteria ($criteriaKey, $configEntry) {
00096                 // Add configuration entry as criteria
00097                 $value = $this->getConfigInstance()->readConfig($configEntry);
00098                 $this->addCriteria($criteriaKey, $value);
00099         }
00100 
00107         public final function setTableName ($tableName) {
00108                 $this->tableName = (string) $tableName;
00109         }
00110 
00116         public final function getTableName () {
00117                 return $this->tableName;
00118         }
00119 
00126         public final function setUniqueKey ($uniqueKey) {
00127                 $this->uniqueKey = (string) $uniqueKey;
00128         }
00129 
00135         public final function getUniqueKey () {
00136                 return $this->uniqueKey;
00137         }
00138 
00144         public final function getUniqueValue () {
00145                 return $this->tableColumns[$this->getUniqueKey()];
00146         }
00147 
00153         public final function getCriteriaArray () {
00154                 return $this->tableColumns;
00155         }
00156 
00162         public final function getPrimaryKey () {
00163                 // Get primary key by default
00164                 $primaryKey = $this->primaryKey;
00165 
00166                 if (empty($primaryKey)) {
00167                         // Get uniqueKey
00168                         $primaryKey = $this->getUniqueKey();
00169                 } // END - if
00170 
00171                 // Return it
00172                 return $primaryKey;
00173         }
00174 
00181         public final function setPrimaryKey ($primaryKey) {
00182                 $this->primaryKey = (string) $primaryKey;
00183         }
00184 }
00185 
00186 // [EOF]
00187 ?>

Generated on Mon Dec 8 01:06:45 2008 for Ship-Simulator by  doxygen 1.5.6