Spaces:
Sleeping
Sleeping
File size: 4,883 Bytes
07c3cdd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | <?php
/**
* AppDelay.php
* @package workflow.engine.classes.model
*/
//require_once 'classes/model/om/BaseAppDelay.php';
/**
* Skeleton subclass for representing a row from the 'APP_DELAY' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
* /**
* @package workflow.engine.classes.model
*/
class AppDelay extends BaseAppDelay
{
/**
* Create the application delay registry
* @param array $aData
* @return string
**/
public function create($aData)
{
$oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME);
try {
if ( isset ( $aData['APP_DELAY_UID'] ) && $aData['APP_DELAY_UID']== '' ) {
unset ( $aData['APP_DELAY_UID'] );
}
if ( !isset ( $aData['APP_DELAY_UID'] ) ) {
$aData['APP_DELAY_UID'] = G::generateUniqueID();
}
$oAppDelay = new AppDelay();
$oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oAppDelay->validate()) {
$oConnection->begin();
$iResult = $oAppDelay->save();
$oConnection->commit();
return $aData['APP_DELAY_UID'];
} else {
$sMessage = '';
$aValidationFailures = $oAppDelay->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
/**
* Update the application delay registry
* @param array $aData
* @return string
**/
public function update($aData)
{
$oConnection = Propel::getConnection(AppDelayPeer::DATABASE_NAME);
try {
$oAppDelay = AppDelayPeer::retrieveByPK($aData['APP_DELAY_UID']);
if (!is_null($oAppDelay)) {
$oAppDelay->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oAppDelay->validate()) {
$oConnection->begin();
$iResult = $oAppDelay->save();
$oConnection->commit();
return $iResult;
} else {
$sMessage = '';
$aValidationFailures = $oAppDelay->getValidationFailures();
foreach ($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '<br />';
}
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
}
} else {
throw(new Exception('This row doesn\'t exist!'));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
public function isPaused($appUid, $delIndex)
{
$oCriteria = new Criteria('workflow');
$oCriteria->add(AppDelayPeer::APP_UID, $appUid);
$oCriteria->add(AppDelayPeer::APP_DEL_INDEX, $delIndex);
$oCriteria->add(AppDelayPeer::APP_TYPE, 'PAUSE');
$oCriteria->add(
$oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0, Criteria::EQUAL)->addOr(
$oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL))
);
$oDataset = AppDelayPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
if ($aRow) {
return true;
} else {
return false;
}
}
/**
* Verify if the case is Paused or cancelled
*
* @param $appUid string
* @return $oDataset array
*/
public function getCasesCancelOrPaused($appUid)
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( AppDelayPeer::APP_UID );
$oCriteria->addSelectColumn( AppDelayPeer::APP_DEL_INDEX );
$oCriteria->add( AppDelayPeer::APP_UID, $appUid );
$oCriteria->add( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'PAUSE' )->addOr( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'CANCEL' ) ) );
$oCriteria->addAscendingOrderByColumn( AppDelayPeer::APP_ENABLE_ACTION_DATE );
$oDataset = AppDelayPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
return $oDataset->getRow();
}
}
|