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
* @param string $sProcessUID
* @param string $sGatewayUID
* @return boolean
*/
function deleteGateway($sGatewayUID = '') {
function deleteGateway($sProcessUID = '', $sGatewayUID = '') {
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 ( );
if($oGateway->gatewayExists($sGatewayUID))
{
$oTasks = new Tasks ( );
$oTasks->deleteRoutesusingGateway($sGatewayUID);
$res = $oGateway->remove($sGatewayUID);
if($res){
$oRoute = new Route( );
foreach($aRoutes as $sRouteId){
$oRoute->remove($sRouteId);
}
}
}
return;
} catch (Exception $oError) {

View File

@@ -393,29 +393,6 @@ class Tasks
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

View File

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

View File

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