/** * Returns the list of updated applications * array of Entity_AppSolrQueue */ public function getListUpdatedApplications() { $updatedApplications = array(); try { $c = new Criteria(); $c->addSelectColumn(AppSolrQueuePeer::APP_UID); $c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED); //"WHERE $c->add(AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL); $rs = AppSolrQueuePeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); //echo $c->toString(); $rs->next(); $row = $rs->getRow(); while (is_array($row)) { $appSolrQueue = Entity_AppSolrQueue::createEmpty(); $appSolrQueue->appUid = $row['APP_UID']; $appSolrQueue->appUpdated = $row['APP_UPDATED']; $updatedApplications[] = $appSolrQueue; $rs->next(); $row = $rs->getRow(); } return $updatedApplications; } catch (Exception $e) { $con->rollback(); throw $e; } }
/** * Implementation for 'GET' method for Rest API * * @param mixed $appUid Primary key * * @return array $result Returns array within multiple records or a single record depending if * a single selection was requested passing id(s) as param */ protected function get($appUid = null) { $result = array(); try { $noArguments = true; $argumentList = func_get_args(); foreach ($argumentList as $arg) { if (!is_null($arg)) { $noArguments = false; } } if ($noArguments) { $criteria = new Criteria('workflow'); $criteria->addSelectColumn(AppSolrQueuePeer::APP_UID); $criteria->addSelectColumn(AppSolrQueuePeer::APP_UPDATED); $dataset = AppEventPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($dataset->next()) { $result[] = $dataset->getRow(); } } else { $record = AppSolrQueuePeer::retrieveByPK($appUid); if ($record) { $result = $record->toArray(BasePeer::TYPE_FIELDNAME); } else { $paramValues = ""; foreach ($argumentList as $arg) { $paramValues .= strlen($paramValues) ? ', ' : ''; if (!is_null($arg)) { $paramValues .= "{$arg}"; } else { $paramValues .= "NULL"; } } throw new RestException(417, "table AppSolrQueue ({$paramValues})"); } } } catch (RestException $e) { throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } return $result; }
/** * Returns the list of updated applications * array of Entity_AppSolrQueue */ public function getListUpdatedApplications($updated = true, $deleted = true) { $updatedApplications = array(); try { $c = new Criteria(); $c->addSelectColumn(AppSolrQueuePeer::APP_UID); $c->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_DATE); $c->addSelectColumn(AppSolrQueuePeer::APP_CHANGE_TRACE); $c->addSelectColumn(AppSolrQueuePeer::APP_UPDATED); //"WHERE if ($updated == true && $deleted == true) { $c->add(AppSolrQueuePeer::APP_UPDATED, 0, Criteria::NOT_EQUAL); } if ($updated == true && $deleted == false) { $c->add(AppSolrQueuePeer::APP_UPDATED, 1, Criteria::EQUAL); } if ($updated == false && $deleted == true) { $c->add(AppSolrQueuePeer::APP_UPDATED, 2, Criteria::EQUAL); } $rs = AppSolrQueuePeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); //echo $c->toString(); $rs->next(); $row = $rs->getRow(); while (is_array($row)) { $appSolrQueue = Entity_AppSolrQueue::createEmpty(); $appSolrQueue->appUid = $row["APP_UID"]; $appSolrQueue->appChangeDate = $row["APP_CHANGE_DATE"]; $appSolrQueue->appChangeTrace = $row["APP_CHANGE_TRACE"]; $appSolrQueue->appUpdated = $row["APP_UPDATED"]; $updatedApplications[] = $appSolrQueue; $rs->next(); $row = $rs->getRow(); } return $updatedApplications; } catch (Exception $e) { $con->rollback(); throw $e; } }
public function removeCase($sAppUid) { try { $this->getExecuteTriggerProcess($sAppUid, 'DELETED'); $oAppDelegation = new AppDelegation(); $oAppDocument = new AppDocument(); //Delete the delegations of a application $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(AppDelegationPeer::APP_UID, $sAppUid); $oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2); $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); while ($aRow2 = $oDataset2->getRow()) { $oAppDelegation->remove($sAppUid, $aRow2['DEL_INDEX']); $oDataset2->next(); } //Delete the documents assigned to a application $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(AppDocumentPeer::APP_UID, $sAppUid); $oDataset2 = AppDocumentPeer::doSelectRS($oCriteria2); $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); while ($aRow2 = $oDataset2->getRow()) { $oAppDocument->remove($aRow2['APP_DOC_UID'], $aRow2['DOC_VERSION']); $oDataset2->next(); } //Delete the actions from a application $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(AppDelayPeer::APP_UID, $sAppUid); AppDelayPeer::doDelete($oCriteria2); //Delete the messages from a application $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(AppMessagePeer::APP_UID, $sAppUid); AppMessagePeer::doDelete($oCriteria2); //Delete the threads from a application $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(AppThreadPeer::APP_UID, $sAppUid); AppThreadPeer::doDelete($oCriteria2); //Delete the events from a application $criteria = new Criteria("workflow"); $criteria->add(AppEventPeer::APP_UID, $sAppUid); AppEventPeer::doDelete($criteria); //Delete the histories from a application $criteria = new Criteria("workflow"); $criteria->add(AppHistoryPeer::APP_UID, $sAppUid); AppHistoryPeer::doDelete($criteria); //Delete the notes from a application $criteria = new Criteria("workflow"); $criteria->add(AppNotesPeer::APP_UID, $sAppUid); AppNotesPeer::doDelete($criteria); //Delete the owners from a application $criteria = new Criteria("workflow"); $criteria->add(AppOwnerPeer::APP_UID, $sAppUid); AppOwnerPeer::doDelete($criteria); //Delete the SolrQueue from a application $criteria = new Criteria("workflow"); $criteria->add(AppSolrQueuePeer::APP_UID, $sAppUid); AppSolrQueuePeer::doDelete($criteria); //Before delete verify if is a child case $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(SubApplicationPeer::APP_UID, $sAppUid); $oCriteria2->add(SubApplicationPeer::SA_STATUS, 'ACTIVE'); if (SubApplicationPeer::doCount($oCriteria2) > 0) { G::LoadClass('derivation'); $oDerivation = new Derivation(); $oDerivation->verifyIsCaseChild($sAppUid); } //Delete the registries in the table SUB_APPLICATION $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(SubApplicationPeer::APP_UID, $sAppUid); SubApplicationPeer::doDelete($oCriteria2); $oCriteria2 = new Criteria('workflow'); $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); //Delete record of the APPLICATION table (trigger: delete records of the APP_CACHE_VIEW table) $application = new Application(); $result = $application->remove($sAppUid); //delete application from index if ($this->appSolr != null) { $this->appSolr->deleteApplicationSearchIndex($sAppUid); } /*----------------------------------********---------------------------------*/ return $result; } catch (exception $e) { throw ($e); } }
/** * 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 = AppSolrQueuePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setAppUid($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setAppChangeDate($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setAppChangeTrace($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setAppUpdated($arr[$keys[3]]); } }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param Connection $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(AppSolrQueuePeer::APP_UID, $pks, Criteria::IN); $objs = AppSolrQueuePeer::doSelect($criteria, $con); } return $objs; }