From 80fd2ecd6c85fef1927242996994bb4f68c76db4 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Mon, 27 Oct 2014 11:25:17 -0400 Subject: [PATCH] PM-475 "16052 - Revisar problema de self-service con Value-based de grupos" SOLVED Issue: El CasesList es lento cuando existen casos con tipo de asignacion "Self Service Value Based Assignment" Cause: Para todos los casos se esta verificando si su asignacion es de tipo "Self Service Value Based Assignment" Solution: - Se ha creado una nueva tabla "APP_ASSIGN_SELF_SERVICE_VALUE", en la misma se registraran los casos con asignacion "Self Service Value Based Assignment" - Se ha agregado la opcion "database-generate-self-service-by-value" al comando "./processmaker", para poder generar los registros de la nueva tabla. Ej: $ ./processmaker database-generate-self-service-by-value myWorkspace --- workflow/engine/bin/tasks/cliWorkspaces.php | 37 +- workflow/engine/classes/class.case.php | 22 +- workflow/engine/classes/class.derivation.php | 14 + workflow/engine/classes/class.wsTools.php | 35 +- .../model/AppAssignSelfServiceValue.php | 124 +++ .../model/AppAssignSelfServiceValuePeer.php | 5 + .../engine/classes/model/AppCacheView.php | 84 +- .../AppAssignSelfServiceValueMapBuilder.php | 80 ++ .../om/BaseAppAssignSelfServiceValue.php | 745 ++++++++++++++++++ .../om/BaseAppAssignSelfServiceValuePeer.php | 547 +++++++++++++ workflow/engine/config/schema.xml | 20 + workflow/engine/data/mssql/schema.sql | 38 + workflow/engine/data/mysql/schema.sql | 16 + workflow/engine/data/oracle/schema.sql | 17 + 14 files changed, 1723 insertions(+), 61 deletions(-) create mode 100644 workflow/engine/classes/model/AppAssignSelfServiceValue.php create mode 100644 workflow/engine/classes/model/AppAssignSelfServiceValuePeer.php create mode 100644 workflow/engine/classes/model/map/AppAssignSelfServiceValueMapBuilder.php create mode 100644 workflow/engine/classes/model/om/BaseAppAssignSelfServiceValue.php create mode 100644 workflow/engine/classes/model/om/BaseAppAssignSelfServiceValuePeer.php diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index ef4f93176..d89727167 100755 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -172,6 +172,20 @@ CLI::taskOpt("workspace", "Select which workspace to migrate the cases folders, "w:", "workspace="); CLI::taskRun("runStructureDirectories"); +CLI::taskName("database-generate-self-service-by-value"); +CLI::taskDescription(<<workspaceExists()) { throw new Exception("Workspace '{$workspace->name}' not found"); - } + } } - + //If this is a relative path, put the file in the backups directory if (strpos($filename, "/") === false && strpos($filename, '\\') === false){ $filename = PATH_DATA . "backups/$filename"; @@ -494,4 +508,23 @@ function runStructureDirectories($command, $args) { } } +function run_database_generate_self_service_by_value($args, $opts) +{ + try { + $arrayWorkspace = get_workspaces_from_args($args); + + foreach ($arrayWorkspace as $value) { + $workspace = $value; + + try { + echo "Generating the table \"self-service by value\" for " . pakeColor::colorize($workspace->name, "INFO") . "\n"; + $workspace->appAssignSelfServiceValueTableGenerateData(); + } catch (Exception $e) { + echo "Errors generating the table \"self-service by value\" of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n"; + } + } + } catch (Exception $e) { + echo CLI::error($e->getMessage()) . "\n"; + } +} diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 37625de1a..ec641c3f6 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -1039,6 +1039,15 @@ class Cases if ($this->appSolr != null) { $this->appSolr->updateApplicationSearchIndex($sAppUid); } + + if ($Fields["APP_STATUS"] == "COMPLETED") { + //Delete records of the table APP_ASSIGN_SELF_SERVICE_VALUE + $appAssignSelfServiceValue = new AppAssignSelfServiceValue(); + + $appAssignSelfServiceValue->remove($sAppUid); + } + + //Return return $Fields; } catch (exception $e) { throw ($e); @@ -1130,6 +1139,11 @@ class Cases $oCriteria2->add(SubApplicationPeer::APP_PARENT, $sAppUid); SubApplicationPeer::doDelete($oCriteria2); + //Delete records of the table APP_ASSIGN_SELF_SERVICE_VALUE + $appAssignSelfServiceValue = new AppAssignSelfServiceValue(); + + $appAssignSelfServiceValue->remove($sAppUid); + //Delete records of the Report Table $this->reportTableDeleteRecord($sAppUid); @@ -1193,6 +1207,11 @@ class Cases if ($this->appSolr != null) { $this->appSolr->updateApplicationSearchIndex($sAppUid); } + + //Delete record of the table APP_ASSIGN_SELF_SERVICE_VALUE + $appAssignSelfServiceValue = new AppAssignSelfServiceValue(); + + $appAssignSelfServiceValue->remove($sAppUid, $iDelIndex); } catch (exception $e) { throw ($e); } @@ -6756,4 +6775,5 @@ class Cases return $unserializedData; } -} \ No newline at end of file +} + diff --git a/workflow/engine/classes/class.derivation.php b/workflow/engine/classes/class.derivation.php index 0d4919dfe..ab2d99692 100755 --- a/workflow/engine/classes/class.derivation.php +++ b/workflow/engine/classes/class.derivation.php @@ -601,6 +601,20 @@ class Derivation if ($canDerivate) { $aSP = isset( $aSP ) ? $aSP : null; $iNewDelIndex = $this->doDerivation( $currentDelegation, $nextDel, $appFields, $aSP ); + + //Create record in table APP_ASSIGN_SELF_SERVICE_VALUE + $task = new Task(); + $arrayNextTaskData = $task->load($nextDel["TAS_UID"]); + + if ($arrayNextTaskData["TAS_ASSIGN_TYPE"] == "SELF_SERVICE" && trim($arrayNextTaskData["TAS_GROUP_VARIABLE"]) != "") { + $nextTaskGroupVariable = trim($arrayNextTaskData["TAS_GROUP_VARIABLE"], " @#"); + + if (isset($appFields["APP_DATA"][$nextTaskGroupVariable]) && trim($appFields["APP_DATA"][$nextTaskGroupVariable]) != "") { + $appAssignSelfServiceValue = new AppAssignSelfServiceValue(); + + $appAssignSelfServiceValue->create($appFields["APP_UID"], $iNewDelIndex, array("PRO_UID" => $appFields["PRO_UID"], "TAS_UID" => $nextDel["TAS_UID"], "GRP_UID" => trim($appFields["APP_DATA"][$nextTaskGroupVariable]))); + } + } } else { //when the task doesnt generate a new AppDelegation $iAppThreadIndex = $appFields['DEL_THREAD']; diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index e949db059..ae92533c0 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -428,7 +428,7 @@ class workspaceTools * @return database connection */ private function getDatabase($rbac = false) - { + { if (isset($this->db) && $this->db->isConnected() && $rbac == false) { return $this->db; } @@ -1074,7 +1074,7 @@ class workspaceTools public function exportDatabase($path, $onedb = false) { $dbInfo = $this->getDBInfo(); - + if ($onedb) { $databases = array("rb", "rp"); } else if ($dbInfo['DB_NAME'] == $dbInfo['DB_RBAC_NAME']) { @@ -1084,8 +1084,8 @@ class workspaceTools } $dbNames = array(); - - foreach ($databases as $db) { + + foreach ($databases as $db) { $dbInfo = $this->getDBCredentials($db); $oDbMaintainer = new DataBaseMaintenance($dbInfo["host"], $dbInfo["user"], $dbInfo["pass"]); CLI::logging("Saving database {$dbInfo["name"]}\n"); @@ -1146,7 +1146,7 @@ class workspaceTools * @param bool $compress specifies wheter the backup is compressed or not */ public function backup($backupFile, $compress = true) - { + { /* $filename can be a string, in which case it's used as the filename of * the backup, or it can be a previously created tar, which allows for * multiple workspaces in one backup. @@ -1447,13 +1447,13 @@ class workspaceTools throw new Exception("Backup version {$metadata->version} not supported"); } $backupWorkspace = $metadata->WORKSPACE_NAME; - + if (strpos($metadata->DB_RBAC_NAME, 'rb_') === false) { $onedb = true; } else { $onedb = false; } - + if (isset($dstWorkspace)) { $workspaceName = $dstWorkspace; $createWorkspace = true; @@ -1468,7 +1468,7 @@ class workspaceTools CLI::logging("> Restoring " . CLI::info($backupWorkspace) . " to " . CLI::info($workspaceName) . "\n"); } $workspace = new workspaceTools($workspaceName); - + if ($workspace->workspaceExists()) { if ($overwrite) { @@ -1515,7 +1515,7 @@ class workspaceTools $newDBNames = $workspace->resetDBInfo($dbHost, $createWorkspace, $onedb); foreach ($metadata->databases as $db) { - if ($dbName != $newDBNames[$db->name]) { + if ($dbName != $newDBNames[$db->name]) { $dbName = $newDBNames[$db->name]; CLI::logging("+> Restoring database {$db->name} to $dbName\n"); $workspace->executeSQLScript($dbName, "$tempDirectory/{$db->name}.sql",$aParameters); @@ -1761,5 +1761,22 @@ class workspaceTools $res = $tr->save (); } } + + /** + * Generate data for table APP_ASSIGN_SELF_SERVICE_VALUE + * + * return void + */ + public function appAssignSelfServiceValueTableGenerateData() + { + try { + $this->initPropel(true); + + $appAssignSelfServiceValue = new AppAssignSelfServiceValue(); + $appAssignSelfServiceValue->generateData(); + } catch (Exception $e) { + throw $e; + } + } } diff --git a/workflow/engine/classes/model/AppAssignSelfServiceValue.php b/workflow/engine/classes/model/AppAssignSelfServiceValue.php new file mode 100644 index 000000000..02674c5b7 --- /dev/null +++ b/workflow/engine/classes/model/AppAssignSelfServiceValue.php @@ -0,0 +1,124 @@ +fromArray($arrayData, BasePeer::TYPE_FIELDNAME); + + $appAssignSelfServiceValue->setAppUid($applicationUid); + $appAssignSelfServiceValue->setDelIndex($delIndex); + + if ($appAssignSelfServiceValue->validate()) { + $cnn->begin(); + + $result = $appAssignSelfServiceValue->save(); + + $cnn->commit(); + } else { + $msg = ""; + + foreach ($appAssignSelfServiceValue->getValidationFailures() as $validationFailure) { + $msg .= (($msg != "")? "\n" : "") . $validationFailure->getMessage(); + } + + throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : "")); + } + } catch (Exception $e) { + $cnn->rollback(); + + throw $e; + } + } catch (Exception $e) { + throw $e; + } + } + + /** + * Remove record + * + * @param string $applicationUid Unique id of Case + * @param int $delIndex Delegation index + * + * return void + */ + public function remove($applicationUid, $delIndex = 0) + { + try { + $criteria = new Criteria("workflow"); + + $criteria->add(AppAssignSelfServiceValuePeer::APP_UID, $applicationUid, Criteria::EQUAL); + + if ($delIndex != 0) { + $criteria->add(AppAssignSelfServiceValuePeer::DEL_INDEX, $delIndex, Criteria::EQUAL); + } + + $result = AppAssignSelfServiceValuePeer::doDelete($criteria); + } catch (Exception $e) { + throw $e; + } + } + + /** + * Generate data + * + * return void + */ + public function generateData() + { + try { + G::LoadClass("case"); + + AppAssignSelfServiceValuePeer::doDeleteAll(); //Delete all records + + //Generate data + $case = new Cases(); + + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(AppDelegationPeer::APP_UID); + $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); + $criteria->addSelectColumn(ApplicationPeer::APP_DATA); + $criteria->addSelectColumn(AppDelegationPeer::PRO_UID); + $criteria->addSelectColumn(TaskPeer::TAS_UID); + $criteria->addSelectColumn(TaskPeer::TAS_GROUP_VARIABLE); + $criteria->addJoin(AppDelegationPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN); + $criteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN); + $criteria->add(TaskPeer::TAS_ASSIGN_TYPE, "SELF_SERVICE", Criteria::EQUAL); + $criteria->add(TaskPeer::TAS_GROUP_VARIABLE, "", Criteria::NOT_EQUAL); + $criteria->add(AppDelegationPeer::USR_UID, "", Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN", Criteria::EQUAL); + + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $applicationData = $case->unserializeData($row["APP_DATA"]); + $taskGroupVariable = trim($row["TAS_GROUP_VARIABLE"], " @#"); + + if ($taskGroupVariable != "" && isset($applicationData[$taskGroupVariable]) && trim($applicationData[$taskGroupVariable]) != "") { + $this->create($row["APP_UID"], $row["DEL_INDEX"], array("PRO_UID" => $row["PRO_UID"], "TAS_UID" => $row["TAS_UID"], "GRP_UID" => trim($applicationData[$taskGroupVariable]))); + } + } + } catch (Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/classes/model/AppAssignSelfServiceValuePeer.php b/workflow/engine/classes/model/AppAssignSelfServiceValuePeer.php new file mode 100644 index 000000000..a4f24d68f --- /dev/null +++ b/workflow/engine/classes/model/AppAssignSelfServiceValuePeer.php @@ -0,0 +1,5 @@ +getActiveGroupsForAnUser($userUid); + $arrayApplicationUid = array(); - $c = new Criteria(); - $c->clearSelectColumns(); - $c->addSelectColumn(TaskPeer::TAS_UID); - $c->addSelectColumn(TaskPeer::PRO_UID); - $c->addSelectColumn(TaskPeer::TAS_GROUP_VARIABLE); - $c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN); - $c->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN); - $c->add(ProcessPeer::PRO_STATUS, 'ACTIVE'); - $c->add(TaskPeer::TAS_ASSIGN_TYPE, 'SELF_SERVICE'); - $c->add(TaskPeer::TAS_GROUP_VARIABLE, '', Criteria::NOT_EQUAL); - $rs = TaskPeer::doSelectRS($c); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); + //Get APP_UIDs + $group = new Groups(); - if ($rs->getRecordCount() > 0) { - if (!class_exists('Cases')) { - G::loadClass('case'); - } - $caseInstance = new Cases(); - while ($row = $rs->getRow()) { - $tasGroupVariable = str_replace(array('@', '#'), '', $row['TAS_GROUP_VARIABLE']); - $c2 = new Criteria(); - $c2->clearSelectColumns(); - $c2->addSelectColumn(AppDelegationPeer::APP_UID); - $c2->addSelectColumn(ApplicationPeer::APP_DATA); - $c2->addJoin(AppDelegationPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN); - $c2->add(AppDelegationPeer::TAS_UID, $row['TAS_UID']); - $c2->add(AppDelegationPeer::USR_UID, ''); - $c2->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN'); - $rs2 = AppDelegationPeer::doSelectRS($c2); - $rs2->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs2->next(); - while ($row2 = $rs2->getRow()) { - $caseData = $caseInstance->unserializeData($row2['APP_DATA']); + $arrayGroup = $group->getActiveGroupsForAnUser($userUid); //Get Groups of User - if (isset($caseData[$tasGroupVariable])) { - if (trim($caseData[$tasGroupVariable]) != '') { - if (in_array(trim($caseData[$tasGroupVariable]), $aGroups)) { - $cases[] = $row2['APP_UID']; - } - } - } - $rs2->next(); + if (count($arrayGroup) > 0) { + $criteria = new Criteria("workflow"); + + $criteria->setDistinct(); + $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::APP_UID); + + $arrayCondition = array(); + $arrayCondition[] = array(AppAssignSelfServiceValuePeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::EQUAL); + $arrayCondition[] = array(AppAssignSelfServiceValuePeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX, Criteria::EQUAL); + $arrayCondition[] = array(AppAssignSelfServiceValuePeer::TAS_UID, AppDelegationPeer::TAS_UID, Criteria::EQUAL); + $criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN); + + $criteria->add(AppDelegationPeer::USR_UID, "", Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN", Criteria::EQUAL); + $criteria->add(AppAssignSelfServiceValuePeer::GRP_UID, $arrayGroup, Criteria::IN); + + $rsCriteria = AppAssignSelfServiceValuePeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $arrayApplicationUid[] = $row["APP_UID"]; } - $rs->next(); } + + //Return + return $arrayApplicationUid; + } catch (Exception $e) { + throw $e; } - return $cases; } /** @@ -1210,7 +1196,7 @@ class AppCacheView extends BaseAppCacheView $rs1 = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); $rs1->next(); $row = $rs1->getRow(); - + if ($row['PRIVILEGE_TYPE'] == 'SUPER') { $super = G::LoadTranslation('ID_TRUE'); //true; } diff --git a/workflow/engine/classes/model/map/AppAssignSelfServiceValueMapBuilder.php b/workflow/engine/classes/model/map/AppAssignSelfServiceValueMapBuilder.php new file mode 100644 index 000000000..209e95bc9 --- /dev/null +++ b/workflow/engine/classes/model/map/AppAssignSelfServiceValueMapBuilder.php @@ -0,0 +1,80 @@ +dbMap !== null); + } + + /** + * Gets the databasemap this map builder built. + * + * @return the databasemap + */ + public function getDatabaseMap() + { + return $this->dbMap; + } + + /** + * The doBuild() method builds the DatabaseMap + * + * @return void + * @throws PropelException + */ + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('workflow'); + + $tMap = $this->dbMap->addTable('APP_ASSIGN_SELF_SERVICE_VALUE'); + $tMap->setPhpName('AppAssignSelfServiceValue'); + + $tMap->setUseIdGenerator(false); + + $tMap->addColumn('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('DEL_INDEX', 'DelIndex', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addColumn('PRO_UID', 'ProUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('TAS_UID', 'TasUid', 'string', CreoleTypes::VARCHAR, true, 32); + + $tMap->addColumn('GRP_UID', 'GrpUid', 'string', CreoleTypes::VARCHAR, true, 32); + + } // doBuild() +}// AppAssignSelfServiceValueMapBuilder + diff --git a/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValue.php b/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValue.php new file mode 100644 index 000000000..f4629ba14 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValue.php @@ -0,0 +1,745 @@ +app_uid; + } + + /** + * Get the [del_index] column value. + * + * @return int + */ + public function getDelIndex() + { + + return $this->del_index; + } + + /** + * Get the [pro_uid] column value. + * + * @return string + */ + public function getProUid() + { + + return $this->pro_uid; + } + + /** + * Get the [tas_uid] column value. + * + * @return string + */ + public function getTasUid() + { + + return $this->tas_uid; + } + + /** + * Get the [grp_uid] column value. + * + * @return string + */ + public function getGrpUid() + { + + return $this->grp_uid; + } + + /** + * Set the value of [app_uid] column. + * + * @param string $v new value + * @return void + */ + public function setAppUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->app_uid !== $v) { + $this->app_uid = $v; + $this->modifiedColumns[] = AppAssignSelfServiceValuePeer::APP_UID; + } + + } // setAppUid() + + /** + * Set the value of [del_index] column. + * + * @param int $v new value + * @return void + */ + public function setDelIndex($v) + { + + // Since the native PHP type for this column is integer, + // we will cast the input value to an int (if it is not). + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->del_index !== $v || $v === 0) { + $this->del_index = $v; + $this->modifiedColumns[] = AppAssignSelfServiceValuePeer::DEL_INDEX; + } + + } // setDelIndex() + + /** + * Set the value of [pro_uid] column. + * + * @param string $v new value + * @return void + */ + public function setProUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->pro_uid !== $v) { + $this->pro_uid = $v; + $this->modifiedColumns[] = AppAssignSelfServiceValuePeer::PRO_UID; + } + + } // setProUid() + + /** + * Set the value of [tas_uid] column. + * + * @param string $v new value + * @return void + */ + public function setTasUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->tas_uid !== $v) { + $this->tas_uid = $v; + $this->modifiedColumns[] = AppAssignSelfServiceValuePeer::TAS_UID; + } + + } // setTasUid() + + /** + * Set the value of [grp_uid] column. + * + * @param string $v new value + * @return void + */ + public function setGrpUid($v) + { + + // Since the native PHP type for this column is string, + // we will cast the input to a string (if it is not). + if ($v !== null && !is_string($v)) { + $v = (string) $v; + } + + if ($this->grp_uid !== $v || $v === '') { + $this->grp_uid = $v; + $this->modifiedColumns[] = AppAssignSelfServiceValuePeer::GRP_UID; + } + + } // setGrpUid() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (1-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos. + * @param int $startcol 1-based offset column which indicates which restultset column to start with. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->app_uid = $rs->getString($startcol + 0); + + $this->del_index = $rs->getInt($startcol + 1); + + $this->pro_uid = $rs->getString($startcol + 2); + + $this->tas_uid = $rs->getString($startcol + 3); + + $this->grp_uid = $rs->getString($startcol + 4); + + $this->resetModified(); + + $this->setNew(false); + + // FIXME - using NUM_COLUMNS may be clearer. + return $startcol + 5; // 5 = AppAssignSelfServiceValuePeer::NUM_COLUMNS - AppAssignSelfServiceValuePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating AppAssignSelfServiceValue object", $e); + } + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param Connection $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AppAssignSelfServiceValuePeer::DATABASE_NAME); + } + + try { + $con->begin(); + AppAssignSelfServiceValuePeer::doDelete($this, $con); + $this->setDeleted(true); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. If the object is new, + * it inserts it; otherwise an update is performed. This method + * wraps the doSave() worker method in a transaction. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update + * @throws PropelException + * @see doSave() + */ + public function save($con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(AppAssignSelfServiceValuePeer::DATABASE_NAME); + } + + try { + $con->begin(); + $affectedRows = $this->doSave($con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Stores the object in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param Connection $con + * @return int The number of rows affected by this insert/update and any referring + * @throws PropelException + * @see save() + */ + protected function doSave($con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $pk = AppAssignSelfServiceValuePeer::doInsert($this, $con); + $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which + // should always be true here (even though technically + // BasePeer::doInsert() can insert multiple rows). + + $this->setNew(false); + } else { + $affectedRows += AppAssignSelfServiceValuePeer::doUpdate($this, $con); + } + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; + array of ValidationFailed objects otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = AppAssignSelfServiceValuePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AppAssignSelfServiceValuePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getAppUid(); + break; + case 1: + return $this->getDelIndex(); + break; + case 2: + return $this->getProUid(); + break; + case 3: + return $this->getTasUid(); + break; + case 4: + return $this->getGrpUid(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = AppAssignSelfServiceValuePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getAppUid(), + $keys[1] => $this->getDelIndex(), + $keys[2] => $this->getProUid(), + $keys[3] => $this->getTasUid(), + $keys[4] => $this->getGrpUid(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = AppAssignSelfServiceValuePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setAppUid($value); + break; + case 1: + $this->setDelIndex($value); + break; + case 2: + $this->setProUid($value); + break; + case 3: + $this->setTasUid($value); + break; + case 4: + $this->setGrpUid($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, + * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = AppAssignSelfServiceValuePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) { + $this->setAppUid($arr[$keys[0]]); + } + + if (array_key_exists($keys[1], $arr)) { + $this->setDelIndex($arr[$keys[1]]); + } + + if (array_key_exists($keys[2], $arr)) { + $this->setProUid($arr[$keys[2]]); + } + + if (array_key_exists($keys[3], $arr)) { + $this->setTasUid($arr[$keys[3]]); + } + + if (array_key_exists($keys[4], $arr)) { + $this->setGrpUid($arr[$keys[4]]); + } + + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(AppAssignSelfServiceValuePeer::DATABASE_NAME); + + if ($this->isColumnModified(AppAssignSelfServiceValuePeer::APP_UID)) { + $criteria->add(AppAssignSelfServiceValuePeer::APP_UID, $this->app_uid); + } + + if ($this->isColumnModified(AppAssignSelfServiceValuePeer::DEL_INDEX)) { + $criteria->add(AppAssignSelfServiceValuePeer::DEL_INDEX, $this->del_index); + } + + if ($this->isColumnModified(AppAssignSelfServiceValuePeer::PRO_UID)) { + $criteria->add(AppAssignSelfServiceValuePeer::PRO_UID, $this->pro_uid); + } + + if ($this->isColumnModified(AppAssignSelfServiceValuePeer::TAS_UID)) { + $criteria->add(AppAssignSelfServiceValuePeer::TAS_UID, $this->tas_uid); + } + + if ($this->isColumnModified(AppAssignSelfServiceValuePeer::GRP_UID)) { + $criteria->add(AppAssignSelfServiceValuePeer::GRP_UID, $this->grp_uid); + } + + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(AppAssignSelfServiceValuePeer::DATABASE_NAME); + + + return $criteria; + } + + /** + * Returns NULL since this table doesn't have a primary key. + * This method exists only for BC and is deprecated! + * @return null + */ + public function getPrimaryKey() + { + return null; + } + + /** + * Dummy primary key setter. + * + * This function only exists to preserve backwards compatibility. It is no longer + * needed or required by the Persistent interface. It will be removed in next BC-breaking + * release of Propel. + * + * @deprecated + */ + public function setPrimaryKey($pk) + { + // do nothing, because this object doesn't have any primary keys + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of AppAssignSelfServiceValue (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setAppUid($this->app_uid); + + $copyObj->setDelIndex($this->del_index); + + $copyObj->setProUid($this->pro_uid); + + $copyObj->setTasUid($this->tas_uid); + + $copyObj->setGrpUid($this->grp_uid); + + + $copyObj->setNew(true); + + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return AppAssignSelfServiceValue Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return AppAssignSelfServiceValuePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new AppAssignSelfServiceValuePeer(); + } + return self::$peer; + } +} + diff --git a/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValuePeer.php b/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValuePeer.php new file mode 100644 index 000000000..6b5b36c89 --- /dev/null +++ b/workflow/engine/classes/model/om/BaseAppAssignSelfServiceValuePeer.php @@ -0,0 +1,547 @@ + array ('AppUid', 'DelIndex', 'ProUid', 'TasUid', 'GrpUid', ), + BasePeer::TYPE_COLNAME => array (AppAssignSelfServiceValuePeer::APP_UID, AppAssignSelfServiceValuePeer::DEL_INDEX, AppAssignSelfServiceValuePeer::PRO_UID, AppAssignSelfServiceValuePeer::TAS_UID, AppAssignSelfServiceValuePeer::GRP_UID, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID', 'DEL_INDEX', 'PRO_UID', 'TAS_UID', 'GRP_UID', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('AppUid' => 0, 'DelIndex' => 1, 'ProUid' => 2, 'TasUid' => 3, 'GrpUid' => 4, ), + BasePeer::TYPE_COLNAME => array (AppAssignSelfServiceValuePeer::APP_UID => 0, AppAssignSelfServiceValuePeer::DEL_INDEX => 1, AppAssignSelfServiceValuePeer::PRO_UID => 2, AppAssignSelfServiceValuePeer::TAS_UID => 3, AppAssignSelfServiceValuePeer::GRP_UID => 4, ), + BasePeer::TYPE_FIELDNAME => array ('APP_UID' => 0, 'DEL_INDEX' => 1, 'PRO_UID' => 2, 'TAS_UID' => 3, 'GRP_UID' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * @return MapBuilder the map builder for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getMapBuilder() + { + include_once 'classes/model/map/AppAssignSelfServiceValueMapBuilder.php'; + return BasePeer::getMapBuilder('classes.model.map.AppAssignSelfServiceValueMapBuilder'); + } + /** + * Gets a map (hash) of PHP names to DB column names. + * + * @return array The PHP to DB name map for this peer + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this. + */ + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = AppAssignSelfServiceValuePeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants TYPE_PHPNAME, + * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. AppAssignSelfServiceValuePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(AppAssignSelfServiceValuePeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param criteria object containing the columns to add. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::APP_UID); + + $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::DEL_INDEX); + + $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::PRO_UID); + + $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::TAS_UID); + + $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::GRP_UID); + + } + + const COUNT = 'COUNT(*)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT *)'; + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria). + * @param Connection $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // clear out anything that might confuse the ORDER BY clause + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::COUNT); + } + + // just in case we're grouping: add those columns to the select statement + foreach ($criteria->getGroupByColumns() as $column) { + $criteria->addSelectColumn($column); + } + + $rs = AppAssignSelfServiceValuePeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + // no rows returned; we infer that means 0 matches. + return 0; + } + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param Connection $con + * @return AppAssignSelfServiceValue + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = AppAssignSelfServiceValuePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, $con = null) + { + return AppAssignSelfServiceValuePeer::populateObjects(AppAssignSelfServiceValuePeer::doSelectRS($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() + * method to get a ResultSet. + * + * Use this method directly if you want to just get the resultset + * (instead of an array of objects). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param Connection $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return ResultSet The resultset object with numerically-indexed fields. + * @see BasePeer::doSelect() + */ + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + AppAssignSelfServiceValuePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a Creole ResultSet, set to return + // rows indexed numerically. + return BasePeer::doSelect($criteria, $con); + } + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = AppAssignSelfServiceValuePeer::getOMClass(); + $cls = Propel::import($cls); + // populate the object(s) + while ($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * The class that the Peer will make instances of. + * + * This uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @return string path.to.ClassName + */ + public static function getOMClass() + { + return AppAssignSelfServiceValuePeer::CLASS_DEFAULT; + } + + /** + * Method perform an INSERT on the database, given a AppAssignSelfServiceValue or Criteria object. + * + * @param mixed $values Criteria or AppAssignSelfServiceValue object containing data that is used to create the INSERT statement. + * @param Connection $con the connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from AppAssignSelfServiceValue object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a AppAssignSelfServiceValue or Criteria object. + * + * @param mixed $values Criteria or AppAssignSelfServiceValue object containing data create the UPDATE statement. + * @param Connection $con The connection to use (specify Connection exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + } else { + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the APP_ASSIGN_SELF_SERVICE_VALUE table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(AppAssignSelfServiceValuePeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a AppAssignSelfServiceValue or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or AppAssignSelfServiceValue object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param Connection $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + * This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(AppAssignSelfServiceValuePeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } elseif ($values instanceof AppAssignSelfServiceValue) { + + $criteria = $values->buildCriteria(); + } else { + // it must be the primary key + $criteria = new Criteria(self::DATABASE_NAME); + // primary key is composite; we therefore, expect + // the primary key passed to be an array of pkey + // values + if (count($values) == count($values, COUNT_RECURSIVE)) { + // array is not multi-dimensional + $values = array($values); + } + $vals = array(); + foreach ($values as $value) { + + } + + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + /** + * Validates all modified columns of given AppAssignSelfServiceValue object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param AppAssignSelfServiceValue $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(AppAssignSelfServiceValue $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(AppAssignSelfServiceValuePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(AppAssignSelfServiceValuePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(AppAssignSelfServiceValuePeer::DATABASE_NAME, AppAssignSelfServiceValuePeer::TABLE_NAME, $columns); + } +} + + +// static code to register the map builder for this Peer with the main Propel class +if (Propel::isInit()) { + // the MapBuilder classes register themselves with Propel during initialization + // so we need to load them here. + try { + BaseAppAssignSelfServiceValuePeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + // even if Propel is not yet initialized, the map builder class can be registered + // now and then it will be loaded when Propel initializes. + require_once 'classes/model/map/AppAssignSelfServiceValueMapBuilder.php'; + Propel::registerMapBuilder('classes.model.map.AppAssignSelfServiceValueMapBuilder'); +} + diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 3ec91b108..891abcd52 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -3858,5 +3858,25 @@ + + + + + + + + + + + + + + + + + + + +
diff --git a/workflow/engine/data/mssql/schema.sql b/workflow/engine/data/mssql/schema.sql index d063cac36..3df6c6e14 100755 --- a/workflow/engine/data/mssql/schema.sql +++ b/workflow/engine/data/mssql/schema.sql @@ -3238,3 +3238,41 @@ CREATE TABLE WEB_ENTRY CONSTRAINT WEB_ENTRY_PK PRIMARY KEY (WE_UID) ); +/* --------------------------------------------------------------------------- */ +/* APP_ASSIGN_SELF_SERVICE_VALUE */ +/* --------------------------------------------------------------------------- */ + +IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'APP_ASSIGN_SELF_SERVICE_VALUE') +BEGIN + DECLARE @reftable_71 nvarchar(60), @constraintname_71 nvarchar(60) + DECLARE refcursor CURSOR FOR + select reftables.name tablename, cons.name constraintname + from sysobjects tables, + sysobjects reftables, + sysobjects cons, + sysreferences ref + where tables.id = ref.rkeyid + and cons.id = ref.constid + and reftables.id = ref.fkeyid + and tables.name = 'APP_ASSIGN_SELF_SERVICE_VALUE' + OPEN refcursor + FETCH NEXT from refcursor into @reftable_71, @constraintname_71 + while @@FETCH_STATUS = 0 + BEGIN + exec ('alter table ' + @reftable_71 + ' drop constraint ' + @constraintname_71) + FETCH NEXT from refcursor into @reftable_71, @constraintname_71 + END + CLOSE refcursor + DEALLOCATE refcursor + DROP TABLE [APP_ASSIGN_SELF_SERVICE_VALUE] +END + +CREATE TABLE APP_ASSIGN_SELF_SERVICE_VALUE +( + APP_UID VARCHAR(32) NOT NULL, + DEL_INDEX INT DEFAULT 0 NOT NULL, + PRO_UID VARCHAR(32) NOT NULL, + TAS_UID VARCHAR(32) NOT NULL, + GRP_UID VARCHAR(32) DEFAULT '' NOT NULL +); + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index b044eec61..d16f2bd0a 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2168,3 +2168,19 @@ CREATE TABLE IF NOT EXISTS `LICENSE_MANAGER` ( `LICENSE_TYPE` varchar(32) NOT NULL DEFAULT '0', PRIMARY KEY (`LICENSE_UID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Licenses Manager'; + +#--------------------------------------------------------------------------- +#-- APP_ASSIGN_SELF_SERVICE_VALUE +#--------------------------------------------------------------------------- + +DROP TABLE IF EXISTS APP_ASSIGN_SELF_SERVICE_VALUE; + +CREATE TABLE APP_ASSIGN_SELF_SERVICE_VALUE +( + APP_UID VARCHAR(32) NOT NULL, + DEL_INDEX INTEGER DEFAULT 0 NOT NULL, + PRO_UID VARCHAR(32) NOT NULL, + TAS_UID VARCHAR(32) NOT NULL, + GRP_UID VARCHAR(32) DEFAULT '' NOT NULL +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; + diff --git a/workflow/engine/data/oracle/schema.sql b/workflow/engine/data/oracle/schema.sql index 7e5d29b74..81f038928 100755 --- a/workflow/engine/data/oracle/schema.sql +++ b/workflow/engine/data/oracle/schema.sql @@ -1831,3 +1831,20 @@ ALTER TABLE WEB_ENTRY ADD CONSTRAINT WEB_ENTRY_PK PRIMARY KEY (WE_UID); +/* +--------------------------------------------------------------------------- +APP_ASSIGN_SELF_SERVICE_VALUE +--------------------------------------------------------------------------- +*/ + +DROP TABLE APP_ASSIGN_SELF_SERVICE_VALUE CASCADE CONSTRAINTS; + +CREATE TABLE APP_ASSIGN_SELF_SERVICE_VALUE +( + APP_UID VARCHAR2(32) NOT NULL, + DEL_INDEX NUMBER DEFAULT 0 NOT NULL, + PRO_UID VARCHAR2(32) NOT NULL, + TAS_UID VARCHAR2(32) NOT NULL, + GRP_UID VARCHAR2(32) DEFAULT '' NOT NULL +); +