-
Notifications
You must be signed in to change notification settings - Fork 10
[Feature] Simulation
Jinyoung Jang edited this page Sep 19, 2016
·
4 revisions
EditorPanel.java contains a ServiceMethod to invoke the simulatable Resource's method simulate
@ServiceMethod(callByContent = true, target = ServiceMethod.TARGET_POPUP)
public void simulate() throws Exception {
TransactionContext.getThreadLocalInstance().setSharedContext("isDevelopmentTime", true);
save();
if(getEditor() instanceof Simulatable) {
ModalWindow runner = new ModalWindow();
runner.setWidth(1000);
runner.setTitle("Simulation");
IResource resource = new DefaultResource();
resource.setPath(getResourcePath());
runner.setPanel(((Simulatable) getEditor()).simulator(resource));
MetaworksRemoteService.wrapReturn(runner);
}else
MetaworksRemoteService.wrapReturn(new ModalWindow(new Label("This resource is not supporting simulation")));
}
package org.uengine.modeling.resource.editor;
...
public class ProcessEditor extends ProcessModeler implements IEditor<ProcessDefinition>, Simulatable {
....
@Override
public Object simulator(IResource resource) {
ProcessManagerRemote processManager = MetaworksRemoteService.getComponent(ProcessManagerRemote.class);
ProcessMap processMap = new ProcessMap();
processMap.setName("[Test] " + resource.getName());
processMap.setDefId(resource.getPath().substring(resource.getPath().indexOf("/") + 1));
MetaworksRemoteService.autowire(processMap);
try {
return processMap.simulate();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
ProcessMap.java provides a starting user input form for new process instance and run process definitions as simulation instances. After instantiating a new simulation instance, mark the instances isSim = 1 in the database table bpm_procinst so that they can be distinguished with regular instances.