Skip to content

Commit

Permalink
BZ823855 - Accessing a finished process instance - Delete & Diagram b…
Browse files Browse the repository at this point in the history
…ehavior
  • Loading branch information
mswiderski committed May 22, 2012
1 parent f610e49 commit cb6c9f6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
Expand Up @@ -295,15 +295,20 @@ public void onResult(boolean doIt)
{
if (doIt)
{
ProcessInstanceRef selection = getSelection();
selection.setState(ProcessInstanceRef.STATE.ENDED);
selection.setEndResult(ProcessInstanceRef.RESULT.OBSOLETE);
controller.handleEvent(
new Event(
StateChangeAction.ID,
selection
)
);
ProcessInstanceRef selection = getSelection();
if (selection.getState().equals(ProcessInstanceRef.STATE.ENDED)) {
MessageBox.alert("Info", "Process is already completed");
} else {

selection.setState(ProcessInstanceRef.STATE.ENDED);
selection.setEndResult(ProcessInstanceRef.RESULT.OBSOLETE);
controller.handleEvent(
new Event(
StateChangeAction.ID,
selection
)
);
}
}
}
});
Expand Down Expand Up @@ -334,14 +339,18 @@ public void onResult(boolean doIt)
{
try {
ProcessInstanceRef selection = getSelection();
selection.setState(ProcessInstanceRef.STATE.ENDED);

controller.handleEvent(
new Event(
DeleteInstanceAction.ID,
selection
)
);
if (selection.getState().equals(ProcessInstanceRef.STATE.ENDED)) {
MessageBox.alert("Info", "Process is already completed");
} else {
selection.setState(ProcessInstanceRef.STATE.ENDED);

controller.handleEvent(
new Event(
DeleteInstanceAction.ID,
selection
)
);
}
} catch (Exception e) {
MessageBox.alert("Warning", e.getMessage());
}
Expand Down
Expand Up @@ -23,6 +23,7 @@

import java.util.List;

import org.gwt.mosaic.ui.client.MessageBox;
import org.jboss.bpm.console.client.URLBuilder;
import org.jboss.bpm.console.client.common.AbstractRESTAction;
import org.jboss.bpm.console.client.model.ActiveNodeInfo;
Expand Down Expand Up @@ -61,11 +62,14 @@ public void handleSuccessfulResponse(
final Controller controller, final Object event, Response response)
{
ProcessInstanceRef inst = (ProcessInstanceRef)event;

List<ActiveNodeInfo> activeNodeInfos = DTOParser.parseActiveNodeInfo(response.getText());
// update view
ActivityDiagramView view = (ActivityDiagramView) controller.getView(ActivityDiagramView.ID);
view.update(new ActivityDiagramResultEvent(URLBuilder.getInstance().getProcessImageURL(inst.getDefinitionId()), activeNodeInfos));
if (inst.getState().equals(ProcessInstanceRef.STATE.ENDED) || response.getText().length() == 0) {
MessageBox.alert("Info", "Process is already completed");
} else {
List<ActiveNodeInfo> activeNodeInfos = DTOParser.parseActiveNodeInfo(response.getText());
// update view
ActivityDiagramView view = (ActivityDiagramView) controller.getView(ActivityDiagramView.ID);
view.update(new ActivityDiagramResultEvent(URLBuilder.getInstance().getProcessImageURL(inst.getDefinitionId()), activeNodeInfos));
}
}

}

0 comments on commit cb6c9f6

Please sign in to comment.