Saving Intermediate event completed

This commit is contained in:
girish
2011-02-15 10:17:58 +00:00
parent 8fe21ac406
commit 77c69b3153
6 changed files with 122 additions and 84 deletions

View File

@@ -6456,7 +6456,6 @@ function saveExtddEvents($oData)
$aData['EVN_POSX'] = $oData->position->x; $aData['EVN_POSX'] = $oData->position->x;
$aData['EVN_POSY'] = $oData->position->y; $aData['EVN_POSY'] = $oData->position->y;
$mode = $oData->mode;
$aData['EVN_STATUS'] = 'ACTIVE'; $aData['EVN_STATUS'] = 'ACTIVE';
$aData['EVN_WHEN'] = '1'; $aData['EVN_WHEN'] = '1';
$aData['EVN_ACTION'] = ''; $aData['EVN_ACTION'] = '';
@@ -6467,18 +6466,16 @@ function saveExtddEvents($oData)
if(preg_match("/Start/", $aData['EVN_TYPE'])){ if(preg_match("/Start/", $aData['EVN_TYPE'])){
$aData['EVN_RELATED_TO'] = 'SINGLE'; $aData['EVN_RELATED_TO'] = 'SINGLE';
} }
if($mode == 'ddEvent'){ $sEvn_uid = $oData->evn_uid;
$sEvn_uid = $oData->evn_uid; $oEventData = EventPeer::retrieveByPK($sEvn_uid);
$oEventData = EventPeer::retrieveByPK($sEvn_uid); if (is_null($oEventData)) {
if (is_null($oEventData)) { $sEvn_uid = $oEvent->create($aData);
$sEvn_uid = $oEvent->create($aData); }else{
}else{ $aData['EVN_UID'] = $sEvn_uid;
$aData['EVN_UID'] = $sEvn_uid; $oEvent->update($aData);
$oEvent->update($aData); }
} $oEncode->uid = $sEvn_uid;
} $oJSON = new Services_JSON ( );
$oEncode->uid = $sEvn_uid;
$oJSON = new Services_JSON ( );
return $oJSON->encode($oEncode); return $oJSON->encode($oEncode);
} }

View File

@@ -111,8 +111,10 @@ class Event extends BaseEvent {
} }
else { else {
$oEvent->setTasUid(''); $oEvent->setTasUid('');
$oEvent->setEvnTasUidTo( $aData['EVN_TAS_UID_TO'] ); if(isset($aData['EVN_TAS_UID_TO']))
$oEvent->setEvnTasUidFrom( $aData['EVN_TAS_UID_FROM'] ); $oEvent->setEvnTasUidTo( $aData['EVN_TAS_UID_TO'] );
if(isset($aData['EVN_TAS_UID_FROM']))
$oEvent->setEvnTasUidFrom( $aData['EVN_TAS_UID_FROM'] );
} }
} }

View File

@@ -96,13 +96,31 @@
$countRoutes = count($fields['TRANSITION']); $countRoutes = count($fields['TRANSITION']);
foreach($oData->event as $id => $value) foreach($oData->event as $id => $value)
{ {
if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_FROM'] == '' && $value['EVN_TAS_UID_TO'] == ''){ if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_FROM'] != '' && $value['EVN_TAS_UID_TO'] != ''){ //Check for Intermediate Events
$evn_uid = $value['EVN_UID'];
$idTaskFrom = $value['EVN_TAS_UID_FROM'];
$idTaskTo = $value['EVN_TAS_UID_TO'];
$fields['EVENTS'][$countEvent]['0'] = $value['EVN_UID']; $fields['EVENTS'][$countEvent]['0'] = $value['EVN_UID'];
$fields['EVENTS'][$countEvent]['1'] = $value['EVN_TYPE']; $fields['EVENTS'][$countEvent]['1'] = $value['EVN_TYPE'];
$fields['EVENTS'][$countEvent]['2'] = $value['EVN_POSX']; $fields['EVENTS'][$countEvent]['2'] = $value['EVN_POSX'];
$fields['EVENTS'][$countEvent]['3'] = $value['EVN_POSY']; $fields['EVENTS'][$countEvent]['3'] = $value['EVN_POSY'];
$fields['EVENTS'][$countEvent]['4'] = $value['TAS_UID']; $fields['EVENTS'][$countEvent]['4'] = $value['TAS_UID'];
$countEvent = $countEvent + 1; $countEvent = $countEvent + 1;
$fields['TRANSITION'][$countRoutes]['0']= G::generateUniqueID();
$fields['TRANSITION'][$countRoutes]['1']= $idTaskFrom;
$fields['TRANSITION'][$countRoutes]['2']= $evn_uid;
$fields['TRANSITION'][$countRoutes]['3']= '1';
$fields['TRANSITION'][$countRoutes]['4']= '2';
$countRoutes = $countRoutes + 1;
$fields['TRANSITION'][$countRoutes]['0']= G::generateUniqueID();
$fields['TRANSITION'][$countRoutes]['1']= $evn_uid;
$fields['TRANSITION'][$countRoutes]['2']= $idTaskTo;
$fields['TRANSITION'][$countRoutes]['3']= '2';
$fields['TRANSITION'][$countRoutes]['4']= '1';
$countRoutes = $countRoutes + 1;
} }
else if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_TO'] != ''){ //Check for Intermediate Events else if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_TO'] != ''){ //Check for Intermediate Events
$evn_uid = $value['EVN_UID']; $evn_uid = $value['EVN_UID'];
@@ -122,7 +140,33 @@
$fields['TRANSITION'][$countRoutes]['4']= '1'; $fields['TRANSITION'][$countRoutes]['4']= '1';
$countRoutes = $countRoutes + 1; $countRoutes = $countRoutes + 1;
} }
} else if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_FROM'] != ''){ //Check for Intermediate Events
$evn_uid = $value['EVN_UID'];
$idTask = $value['EVN_TAS_UID_FROM'];
$fields['EVENTS'][$countEvent]['0'] = $value['EVN_UID'];
$fields['EVENTS'][$countEvent]['1'] = $value['EVN_TYPE'];
$fields['EVENTS'][$countEvent]['2'] = $value['EVN_POSX'];
$fields['EVENTS'][$countEvent]['3'] = $value['EVN_POSY'];
$fields['EVENTS'][$countEvent]['4'] = $value['TAS_UID'];
$countEvent = $countEvent + 1;
$fields['TRANSITION'][$countRoutes]['0']= G::generateUniqueID();
$fields['TRANSITION'][$countRoutes]['1']= $idTask;
$fields['TRANSITION'][$countRoutes]['2']= $evn_uid;
$fields['TRANSITION'][$countRoutes]['3']= '1';
$fields['TRANSITION'][$countRoutes]['4']= '2';
$countRoutes = $countRoutes + 1;
}
else if($value['TAS_UID'] == '' && $value['EVN_TAS_UID_FROM'] == '' && $value['EVN_TAS_UID_TO'] == ''){
$fields['EVENTS'][$countEvent]['0'] = $value['EVN_UID'];
$fields['EVENTS'][$countEvent]['1'] = $value['EVN_TYPE'];
$fields['EVENTS'][$countEvent]['2'] = $value['EVN_POSX'];
$fields['EVENTS'][$countEvent]['3'] = $value['EVN_POSY'];
$fields['EVENTS'][$countEvent]['4'] = $value['TAS_UID'];
$countEvent = $countEvent + 1;
}
}
//Get all the standalone Gateway //Get all the standalone Gateway
$countGateway = count($fields['GATEWAYS']); $countGateway = count($fields['GATEWAYS']);

View File

@@ -1163,7 +1163,6 @@ MyWorkflow.prototype.saveShape= function(oNewShape)
//if(typeof oNewShape.workflow != 'undefined' && oNewShape.workflow != null) //if(typeof oNewShape.workflow != 'undefined' && oNewShape.workflow != null)
// tas_uid = oNewShape.workflow.taskUid[0].value; // tas_uid = oNewShape.workflow.taskUid[0].value;
var evn_type = oNewShape.type; var evn_type = oNewShape.type;
var mode = oNewShape.mode;
var evn_uid = oNewShape.id; var evn_uid = oNewShape.id;
urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","tas_uid":"'+tas_uid+'","evn_type":"'+evn_type+'","position":'+pos+',"mode":"'+mode+'","evn_uid":"'+evn_uid+'"}'; urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","tas_uid":"'+tas_uid+'","evn_type":"'+evn_type+'","position":'+pos+',"mode":"'+mode+'","evn_uid":"'+evn_uid+'"}';
break; break;
@@ -1178,7 +1177,6 @@ MyWorkflow.prototype.saveShape= function(oNewShape)
var mode = oNewShape.mode; var mode = oNewShape.mode;
urlparams = '?action='+actiontype+'&data={"pro_uid":"'+ pro_uid +'","gat_uid":"'+gat_uid +'","gat_type":"'+gat_type+'","position":'+pos+',"mode":"'+mode+'"}'; urlparams = '?action='+actiontype+'&data={"pro_uid":"'+ pro_uid +'","gat_uid":"'+gat_uid +'","gat_type":"'+gat_type+'","position":'+pos+',"mode":"'+mode+'"}';
break; break;
} }
//var urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","position":'+pos+'}'; //var urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","position":'+pos+'}';
@@ -1187,37 +1185,35 @@ MyWorkflow.prototype.saveShape= function(oNewShape)
url: "processes_Ajax.php"+ urlparams, url: "processes_Ajax.php"+ urlparams,
success: function(response) { success: function(response) {
//Ext.Msg.alert (response.responseText); //Ext.Msg.alert (response.responseText);
if(response.responseText != 1 && response.responseText != "") if(response.responseText != 1 && response.responseText != ""){
{ this.workflow.newTaskInfo = Ext.util.JSON.decode(response.responseText);
this.workflow.newTaskInfo = Ext.util.JSON.decode(response.responseText); oNewShape.html.id = this.workflow.newTaskInfo.uid;
oNewShape.html.id = this.workflow.newTaskInfo.uid; oNewShape.id = this.workflow.newTaskInfo.uid;
oNewShape.id = this.workflow.newTaskInfo.uid; if(oNewShape.type == 'bpmnTask' && oNewShape.boundaryEvent != true){
if(oNewShape.type == 'bpmnTask' && oNewShape.boundaryEvent != true){ oNewShape.taskName = this.workflow.newTaskInfo.label;
oNewShape.taskName = this.workflow.newTaskInfo.label; workflow.redrawTaskText(oNewShape);
workflow.redrawTaskText(oNewShape); //After Figure is added, Update Start Event connected to Task
//After Figure is added, Update Start Event connected to Task if(typeof this.workflow.preSelectedObj != 'undefined' ){
if(typeof this.workflow.preSelectedObj != 'undefined' ) var preSelectedFigure = this.workflow.preSelectedObj;
{ if(preSelectedFigure.type.match(/Start/) && preSelectedFigure.type.match(/Event/))
var preSelectedFigure = this.workflow.preSelectedObj; this.workflow.saveEvents(preSelectedFigure,oNewShape.id);
if(preSelectedFigure.type.match(/Start/) && preSelectedFigure.type.match(/Event/)) else if(preSelectedFigure.type.match(/Task/))
this.workflow.saveEvents(preSelectedFigure,oNewShape.id); this.workflow.saveRoute(preSelectedFigure,oNewShape);
else if (preSelectedFigure.type.match(/Gateway/))
if(preSelectedFigure.type.match(/Task/)) //preSelectedFigure.rou_type = 'SEQUENTIAL';
this.workflow.saveRoute(preSelectedFigure,oNewShape); this.workflow.saveRoute(preSelectedFigure,oNewShape);
else if (preSelectedFigure.type.match(/Inter/)) {
if (preSelectedFigure.type.match(/Gateway/)) //preSelectedFigure.rou_type = 'SEQUENTIAL';
//preSelectedFigure.rou_type = 'SEQUENTIAL'; this.workflow.saveEvents(preSelectedFigure,oNewShape);
this.workflow.saveRoute(preSelectedFigure,oNewShape); }
}
if (preSelectedFigure.type.match(/Inter/)) { }
//preSelectedFigure.rou_type = 'SEQUENTIAL'; else if(oNewShape.type == 'bpmnSubProcess'){
this.workflow.saveEvents(preSelectedFigure,oNewShape); oNewShape.subProcessName = this.workflow.newTaskInfo.label;
} }
} else if(oNewShape.type.match(/Inter/) && oNewShape.type.match(/Start/)){
} workflow.saveEvents(oNewShape);
else if(oNewShape.type == 'bpmnSubProcess'){ }
oNewShape.subProcessName = this.workflow.newTaskInfo.label;
}
} }
}, },
failure: function(){ failure: function(){

View File

@@ -308,33 +308,27 @@ InputPort.prototype.onDrop = function (port) {
} }
//Routing from task to task //Routing from task to task
else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Task/)){ else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Task/)){
preObj = this.workflow.currentSelection; preObj = workflow.currentSelection;
newObj = port.parentNode; newObj = port.parentNode;
newObj.conn = _4070.connection; newObj.conn = _4070.connection;
newObj.sPortType =port.properties.name; newObj.sPortType =port.properties.name;
preObj.sPortType =this.properties.name; preObj.sPortType =this.properties.name;
this.workflow.saveRoute(newObj,preObj); workflow.saveRoute(newObj,preObj);
} }
//Routing from task to gateway //Routing from task to gateway
else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Gateway/)){ else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Gateway/)){
var shape = new Array(); var shape = new Array();
shape.type = ''; shape.type = '';
preObj = this.workflow.currentSelection; preObj = workflow.currentSelection;
newObj = port.parentNode; newObj = port.parentNode;
this.workflow.saveRoute(newObj,shape); workflow.saveRoute(newObj,shape);
} }
//Routing from task to Intermediate event //Routing from task to Intermediate event
else if(port.parentNode.type.match(/Inter/) && port.parentNode.type.match(/Event/) && bpmnType.match(/Task/)){ else if(port.parentNode.type.match(/Inter/) && port.parentNode.type.match(/Event/) && bpmnType.match(/Task/)){
var taskFrom = workflow.getStartEventConn(this,'targetPort','OutputPort'); workflow.saveEvents(port.parentNode);
var taskTo = workflow.getStartEventConn(this,'sourcePort','InputPort'); }
if(typeof taskFrom[0] != 'undefined' || typeof taskTo[0] != 'undefined'){ else if(port.parentNode.type.match(/Task/) && bpmnType.match(/Inter/) && bpmnType.match(/Event/)){
preObj.type = 'Task'; workflow.saveEvents(workflow.currentSelection);
preObj.taskFrom = taskFrom[0].value;
preObj.taskTo = taskTo[0].value;
//save Event First
tas_uid = port.parentNode.id;
this.workflow.saveEvents(preObj,workflow.currentSelection);
}
} }
} }
}; };
@@ -374,19 +368,22 @@ OutputPort.prototype.onDrop = function (port) {
var newObj = port.parentNode; var newObj = port.parentNode;
newObj.conn = _4070.connection; newObj.conn = _4070.connection;
this.workflow.saveRoute(preObj,newObj); this.workflow.saveRoute(preObj,newObj);
}/*else if(port.parentNode.type.match(/Task/) && bpmnType.match(/Inter/) && bpmnType.match(/Event/)){ }else if(port.parentNode.type.match(/Task/) && bpmnType.match(/Inter/) && bpmnType.match(/Event/)){
var taskFrom = workflow.getStartEventConn(this,'sourcePort','InputPort'); //var taskFrom = workflow.getStartEventConn(this,'sourcePort','InputPort');
var taskTo = workflow.getStartEventConn(this,'targetPort','OutputPort'); //var taskTo = workflow.getStartEventConn(this,'targetPort','OutputPort');
if(typeof taskFrom[0] != 'undefined' || typeof taskTo[0] != 'undefined'){ //if(typeof taskFrom[0] != 'undefined' || typeof taskTo[0] != 'undefined'){
preObj.type = 'Task'; //preObj.type = 'Task';
preObj.taskFrom = taskFrom[0].value; //preObj.taskFrom = taskFrom[0].value;
preObj.taskTo = taskTo[0].value; //preObj.taskTo = taskTo[0].value;
//save Event First //save Event First
tas_uid = port.parentNode.id; // tas_uid = port.parentNode.id;
this.workflow.saveEvents(workflow.currentSelection,preObj); this.workflow.saveEvents(workflow.currentSelection);
} // }
}*/else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Task/)){ }else if(port.parentNode.type.match(/Event/) && port.parentNode.type.match(/Inter/) && bpmnType.match(/Task/)){
this.workflow.saveEvents(port.parentNode);
}
else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Task/)){
preObj = this.workflow.currentSelection; preObj = this.workflow.currentSelection;
newObj = port.parentNode; newObj = port.parentNode;
newObj.conn = _4070.connection; newObj.conn = _4070.connection;
@@ -432,14 +429,13 @@ this.command.setNewPorts(_410d,line.getTarget());
//If Input Port /Output Port is connected to respective ports, then should not connected //If Input Port /Output Port is connected to respective ports, then should not connected
if(this.command.newSourcePort.type == this.command.newTargetPort.type) if(this.command.newSourcePort.type == this.command.newTargetPort.type)
return; return;
else else{
{ this.command.newTargetPort.parentNode.conn = this.command.con;
this.command.newTargetPort.parentNode.conn = this.command.con; this.command.newTargetPort.parentNode.sPortType = this.command.newTargetPort.properties.name;
this.command.newTargetPort.parentNode.sPortType = this.command.newTargetPort.properties.name; this.command.newSourcePort.parentNode.sPortType = this.command.newSourcePort.properties.name;
this.command.newSourcePort.parentNode.sPortType = this.command.newSourcePort.properties.name; this.command.newTargetPort.parentNode.conn = this.command.con;
this.command.newTargetPort.parentNode.conn = this.command.con; this.workflow.saveRoute(this.command.newSourcePort.parentNode,this.command.newTargetPort.parentNode);
this.workflow.saveRoute(this.command.newSourcePort.parentNode,this.command.newTargetPort.parentNode); this.getWorkflow().getCommandStack().execute(this.command);
this.getWorkflow().getCommandStack().execute(this.command);
} }
} }
this.command=null; this.command=null;
@@ -765,6 +761,9 @@ bpmnTask.prototype.addShapes = function (oStore) {
conn.setTarget(newShape.getPort("input2")); conn.setTarget(newShape.getPort("input2"));
conn.setSource(workflow.currentSelection.getPort("output1")); conn.setSource(workflow.currentSelection.getPort("output1"));
workflow.addFigure(conn); workflow.addFigure(conn);
newShape.conn = conn;
newShape.actiontype = 'addEvent';
workflow.saveShape(newShape);
} }
if (newShape.type.match(/Task/)) { if (newShape.type.match(/Task/)) {
conn.setTarget(newShape.getPort("input2")); conn.setTarget(newShape.getPort("input2"));

View File

@@ -16,7 +16,7 @@ new Ext.KeyMap(document, {
}); });
Ext.onReady ( function() { Ext.onReady ( function() {
var _BROWSER = getBrowserInf(); //var _BROWSER = getBrowserInf();
workflow = new MyWorkflow("paintarea"); workflow = new MyWorkflow("paintarea");
workflow.setEnableSmoothFigureHandling(false); workflow.setEnableSmoothFigureHandling(false);