* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class DataSetCriteria extends BaseFrameworkSystem implements StoreableCriteria {
+ /**
+ * Table name
+ */
+ private $tableName = "";
+
+ /**
+ * Table columns (criteria) to store
+ */
+ private $tableColumns = array();
+
+ /**
+ * Unique key
+ */
+ private $uniqueKey = "";
+
/**
* Protected constructor
*
$this->setObjectDescription("Storeable data set for databases");
// Create unique ID number
- $this->createUniqueID();
+ $this->generateUniqueId();
// Clean up a little
$this->removeNumberFormaters();
}
/**
- * Add extra criteria
+ * Add criteria
*
* @param $criteriaKey Criteria key
* @param $criteriaValue Criteria value
* @return void
*/
public function addCriteria ($criteriaKey, $criteriaValue) {
- die("STUB!");
+ $this->tableColumns[(string) $criteriaKey] = $criteriaValue;
+ }
+
+ /**
+ * Add configured criteria
+ *
+ * @param $criteriaKey Criteria key
+ * @param $configEntry Configuration entry
+ * @return void
+ */
+ public function addConfiguredCriteria ($criteriaKey, $configEntry) {
+ // Add configuration entry as criteria
+ $value = $this->getConfigInstance()->readConfig($configEntry);
+ $this->addCriteria($criteriaKey, $value);
+ }
+
+ /**
+ * Setter for table name
+ *
+ * @param $tableName Name of the table to set
+ * @return void
+ */
+ public final function setTableName ($tableName) {
+ $this->tableName = (string) $tableName;
+ }
+
+ /**
+ * Getter for table name
+ *
+ * @return $tableName Name of the table to set
+ */
+ public final function getTableName () {
+ return $this->tableName;
+ }
+
+ /**
+ * Setter for unique key
+ *
+ * @param $uniqueKey Column to use as unique key
+ * @return void
+ */
+ public final function setUniqueKey ($uniqueKey) {
+ $this->uniqueKey = (string) $uniqueKey;
+ }
+
+ /**
+ * Getter for unique key
+ *
+ * @return $uniqueKey Column to use as unique key
+ */
+ public final function getUniqueKey () {
+ return $this->uniqueKey;
+ }
+
+ /**
+ * Getter for unique key value
+ *
+ * @return $uniqueValue Value of the unique key
+ */
+ public final function getUniqueValue () {
+ return $this->tableColumns[$this->getUniqueKey()];
+ }
+
+ /**
+ * Getter for criteria array
+ *
+ * @return $tableColumns
+ */
+ public final function getCriteriaArray () {
+ return $this->tableColumns;
}
}