1.) Fixed deleting gateway issue (deleting it from the database)

This commit is contained in:
girish
2011-01-28 12:31:29 +00:00
parent 345f3d9f7b
commit da180d9ea6
5 changed files with 29 additions and 45 deletions

View File

@@ -1398,18 +1398,37 @@ class processMap {
/* /*
* Delete a gateway * Delete a gateway
* @param string $sProcessUID
* @param string $sGatewayUID * @param string $sGatewayUID
* @return boolean * @return boolean
*/ */
function deleteGateway($sGatewayUID = '') { function deleteGateway($sProcessUID = '', $sGatewayUID = '') {
try { try {
//First get all routes information related to $sGatewayUID
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn('ROU_UID');
$oCriteria->add(RoutePeer::PRO_UID, $sProcessUID);
$oCriteria->add(RoutePeer::GAT_UID, $sGatewayUID);
$oDataset = RoutePeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while($aRow = $oDataset->getRow()){
$aRoutes [] = $aRow ['ROU_UID'];
$oDataset->next();
}
$oGateway = new Gateway ( ); $oGateway = new Gateway ( );
if($oGateway->gatewayExists($sGatewayUID)) if($oGateway->gatewayExists($sGatewayUID))
{ {
$oTasks = new Tasks ( ); $oTasks = new Tasks ( );
$oTasks->deleteRoutesusingGateway($sGatewayUID);
$res = $oGateway->remove($sGatewayUID); $res = $oGateway->remove($sGatewayUID);
if($res){
$oRoute = new Route( );
foreach($aRoutes as $sRouteId){
$oRoute->remove($sRouteId);
}
}
} }
return; return;
} catch (Exception $oError) { } catch (Exception $oError) {

View File

@@ -393,29 +393,6 @@ class Tasks
throw($oError); throw($oError);
} }
} }
/*
* Delete a route using gatewayUID
* @param string $sGatewayUID
* @return boolean
*/
public function deleteRoutesusingGateway($sGatewayUID = '')
{
try {
$oCriteria = new Criteria('workflow');
//$oCriteria->addSelectColumn('ROU_UID');
$oCriteria->add(RoutePeer::GAT_UID, $sGatewayUID);
RoutePeer::doDelete($oCriteria);
return true;
// $oDataset = RoutePeer::doSelectRS($oCriteria);
// $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
// $oDataset->next();
// $aRow = $oDataset->getRow();
}
catch (Exception $oError) {
throw($oError);
}
}
/** /**
* Assign a user to task * Assign a user to task

View File

@@ -59,7 +59,7 @@ if ( isset ($_REQUEST['action']) ) {
break; break;
case 'saveGatewayPosition': case 'saveGatewayPosition':
$sOutput = $oProcessMap->saveGatewayPosition($oData->uid, $oData->position->x, $oData->position->y); $sOutput = $oProcessMap->saveGatewayPosition($oData->uid, $oData->position->x, $oData->position->y);
echo $sOutput; //echo $sOutput;
break; break;
case 'saveTaskCordinates': case 'saveTaskCordinates':
$sOutput = $oProcessMap->saveTaskCordinates($oData->uid, $oData->position->x, $oData->position->y); $sOutput = $oProcessMap->saveTaskCordinates($oData->uid, $oData->position->x, $oData->position->y);
@@ -74,7 +74,7 @@ if ( isset ($_REQUEST['action']) ) {
echo $sOutput; echo $sOutput;
break; break;
case 'deleteGateway': case 'deleteGateway':
$sOutput = $oProcessMap->deleteGateway($oData->gat_uid); $sOutput = $oProcessMap->deleteGateway($oData->pro_uid, $oData->gat_uid);
echo $sOutput; echo $sOutput;
break; break;
case 'updateTaskName': case 'updateTaskName':

View File

@@ -1996,6 +1996,7 @@ MyWorkflow.prototype.saveRoute = function(preObj,newObj)
newObj.conn.id = resp[1]; newObj.conn.id = resp[1];
//replacing old gateway UID with response UID //replacing old gateway UID with response UID
preObj.html.id = resp[0];
preObj.id = resp[0]; preObj.id = resp[0];
} }
} }
@@ -2126,13 +2127,15 @@ MyWorkflow.prototype.getDeleteCriteria = function()
workflow.deleteRoute(route,1); workflow.deleteRoute(route,1);
break; break;
} }
workflow.deleteShape(workflow.currentSelection); if(shape.match(/Gateway/))
if(shape.match(/Gateway/))
{ {
workflow.currentSelection.actiontype = 'deleteGateway'; workflow.currentSelection.actiontype = 'deleteGateway';
workflow.deleteShape(workflow.currentSelection); workflow.deleteShape(workflow.currentSelection);
} }
else
workflow.deleteShape(workflow.currentSelection);
} }

View File

@@ -76,21 +76,6 @@ bpmnTask.prototype.paint = function () {
*/ */
this.bpmnText = new jsGraphics(this.id); this.bpmnText = new jsGraphics(this.id);
/*if(this.taskName.length <= 17)
{
var padleft = 0.025*this.getWidth();
var padtop = 0.36*this.getHeight();
var rectwidth = this.getWidth() - padleft;
var rectheight = 0.54*this.getHeight();
}
else
{
padleft = 0.1*this.getWidth();
padtop = 0.15*this.getHeight();
rectwidth = this.getWidth() - padleft;
rectheight = 0.75*this.getHeight();
}
*/
var len = this.getWidth() / 18; var len = this.getWidth() / 18;
if (len >= 6) { if (len >= 6) {
//len = 1.5; //len = 1.5;