Beispiel #1
0
    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);

        }

    }
 /**
  * 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(AppEventPeer::DATABASE_NAME);
     }
     try {
         $con->begin();
         AppEventPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }