|
@@ -20,7 +20,11 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import ua.be.wee.model.EnactmentController;
|
|
|
import ua.be.wee.model.nodes.Activity;
|
|
|
import ua.be.wee.model.nodes.Artifact;
|
|
|
+import ua.be.wee.model.nodes.FinalNode;
|
|
|
+import ua.be.wee.model.nodes.Node;
|
|
|
+import ua.be.wee.model.nodes.ports.ControlOutputPort;
|
|
|
import ua.be.wee.model.pm.PM;
|
|
|
+import ua.be.wee.model.pt.Event;
|
|
|
import ua.be.wee.model.pt.PT;
|
|
|
import ua.be.wee.model.repository.FusekiWrapper;
|
|
|
|
|
@@ -47,6 +51,8 @@ public class EnactementControllerMVC {
|
|
|
if (!env.getProperty("endpoint").equals("")) {
|
|
|
model.addAttribute("savedEndpoint", env.getProperty("endpoint"));
|
|
|
model.addAttribute("hasEndpoint", true);
|
|
|
+ } else {
|
|
|
+ model.addAttribute("hasEndpoint", false);
|
|
|
}
|
|
|
return "index";
|
|
|
}
|
|
@@ -74,13 +80,19 @@ public class EnactementControllerMVC {
|
|
|
} else {
|
|
|
PM pm = controller.getPM(pmiri);
|
|
|
PT trace = controller.createTrace(pm);
|
|
|
- List<Activity> acts = controller.findFirstActivity(pm);
|
|
|
+ List<String> iris = controller.findNextNodes(pm.getInitial().getIri());
|
|
|
+ List<Node> acts = new ArrayList<Node>();
|
|
|
+ for (String iri : iris) {
|
|
|
+ acts.add(pm.getNode(iri));
|
|
|
+ }
|
|
|
model.addAttribute("error", false);
|
|
|
request.getSession().setAttribute("pm", pm);
|
|
|
request.getSession().setAttribute("trace", trace);
|
|
|
+ request.getSession().setAttribute("previous", pm.getInitial().getIri());
|
|
|
model.addAttribute("acts",acts);
|
|
|
model.addAttribute("arts", null);
|
|
|
model.addAttribute("current", "1");
|
|
|
+ model.addAttribute("hidden_iri",pm.getInitial().getIri());
|
|
|
return "enact";
|
|
|
}
|
|
|
}
|
|
@@ -89,12 +101,24 @@ public class EnactementControllerMVC {
|
|
|
public String startActivity(Model model, @RequestParam String activity, HttpServletRequest request) throws Exception {
|
|
|
PM pm = (PM)request.getSession().getAttribute("pm");
|
|
|
PT pt = (PT)request.getSession().getAttribute("trace");
|
|
|
- Activity act = (Activity)pm.getNode(activity);
|
|
|
- List<Artifact> arts = new ArrayList<>();
|
|
|
- controller.addStartEvent(pm,pt,act,arts);
|
|
|
- //request.getSession().setAttribute("trace", pt);
|
|
|
- model.addAttribute("act",act);
|
|
|
- return "enactEnd";
|
|
|
+ Node node = pm.getNode(activity);
|
|
|
+ if (node instanceof Activity) {
|
|
|
+ List<Artifact> arts = new ArrayList<>();
|
|
|
+ controller.addStartEvent(pt,(Activity)node,arts);
|
|
|
+ //request.getSession().setAttribute("trace", pt);
|
|
|
+ model.addAttribute("act",node);
|
|
|
+ return "enactEnd";
|
|
|
+ } else if (node instanceof FinalNode) {
|
|
|
+ String previous = (String)request.getSession().getAttribute("previous");
|
|
|
+ Event endTraceEvent = controller.addEndTraceEvent(pt.getIri(), previous, pm.getIri());
|
|
|
+ pt.addEvent(endTraceEvent);
|
|
|
+ controller.updatePT(pt);
|
|
|
+ return "endEnactment";
|
|
|
+ } else {
|
|
|
+ return "error";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@PostMapping("/endAct")
|
|
@@ -102,10 +126,24 @@ public class EnactementControllerMVC {
|
|
|
PM pm = (PM)request.getSession().getAttribute("pm");
|
|
|
PT pt = (PT)request.getSession().getAttribute("trace");
|
|
|
Activity act = (Activity)pm.getNode(activity);
|
|
|
+ List<ControlOutputPort> ctrlOutPorts = act.getCtrlOutPorts();
|
|
|
+ ControlOutputPort p = null;
|
|
|
+ for (ControlOutputPort out : ctrlOutPorts) {
|
|
|
+ if (out.getIri().equals(port)) {
|
|
|
+ p = out;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> iris = controller.findNextNodes(p.getIri());
|
|
|
+ List<Node> acts = new ArrayList<Node>();
|
|
|
+ for (String iri : iris) {
|
|
|
+ acts.add(pm.getNode(iri));
|
|
|
+ }
|
|
|
List<Artifact> arts = new ArrayList<>();
|
|
|
- controller.addEndEvent(pm,pt,act,arts);
|
|
|
+
|
|
|
+ controller.addEndEvent(pt,act,arts,p);
|
|
|
request.getSession().setAttribute("trace", pt);
|
|
|
- List<Activity> acts = controller.findNextActivity(pm,act);
|
|
|
+ request.getSession().setAttribute("previous", p.getIri());
|
|
|
model.addAttribute("acts",acts);
|
|
|
model.addAttribute("arts", null);
|
|
|
model.addAttribute("current", "1");
|
|
@@ -115,13 +153,23 @@ public class EnactementControllerMVC {
|
|
|
@RequestMapping("/inarts")
|
|
|
public String selectActivity(Model model, @RequestParam String iri, HttpServletRequest request) throws Exception {
|
|
|
PM pm = (PM)request.getSession().getAttribute("pm");
|
|
|
+ String previous = (String)request.getSession().getAttribute("previous");
|
|
|
if (!iri.equals("1")) {
|
|
|
- Activity act = (Activity)pm.getNode(iri);
|
|
|
- model.addAttribute("arts", act.getInputs() == null ? (new ArrayList<Artifact>()) : act.getInputs());
|
|
|
+ if (pm.getNode(iri) instanceof Activity) {
|
|
|
+ Activity act = (Activity)pm.getNode(iri);
|
|
|
+ model.addAttribute("arts", act.getInputs() == null ? (new ArrayList<Artifact>()) : act.getInputs());
|
|
|
+ } else {
|
|
|
+ model.addAttribute("endBool", true);
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
model.addAttribute("arts", null);
|
|
|
}
|
|
|
- List<Activity> acts = controller.findFirstActivity(pm);
|
|
|
+ List<String> iris = controller.findNextNodes(previous);
|
|
|
+ List<Node> acts = new ArrayList<Node>();
|
|
|
+ for (String iric : iris) {
|
|
|
+ acts.add(pm.getNode(iric));
|
|
|
+ }
|
|
|
model.addAttribute("acts",acts);
|
|
|
model.addAttribute("current", iri);
|
|
|
return "enact";
|