private void handleProceedPlaceholder(WorkItemRecord enabledWorkItem) { connect(); try { WorkItemRecord childWorkItem = checkOut(enabledWorkItem.getID(), _handle); AdviceQuery query = new AdviceQuery(); List<Advice> advs = query.getByAdviceName(enabledWorkItem.getSpecURI()); System.out.println(">>>> Number of the same advices are " + advs.size()); if ((advs != null) && (advs.size() > 0)) { System.out.println(">>>> Number of the launched advices are " + advs.size()); do { advs = query.getByAdviceCaseID(enabledWorkItem.getCaseID()); } while ((advs == null) || (advs.size() == 0)); System.out.println(">>>> Number of the launched advices are " + advs.size()); Advice advice = (Advice) advs.get(0); advice.setSynched(true); advice.setProceedName(enabledWorkItem.getTaskName()); advice.setProceedID(childWorkItem.getID()); this._Persister.beginTransaction(); this._Persister.update(advice); this._Persister.commit(); System.out.println(">>>> Proceed Name is " + advice.getProceedName()); System.out.println(">>>> Proceed ID is " + advice.getProceedID()); org.jdom2.Element d = getDataforCase( advice.getParentSpecName(), advice.getParentCaseID(), _ibClient.getCaseData(enabledWorkItem.getCaseID(), _handle)); this._ixClient.updateCaseData(advice.getParentCaseID(), d, _handle); weaving(advice.getParentCaseID(), advice.getAdjpID(), false); } } catch (IOException | YAWLException e) { e.printStackTrace(); } }
private void ItemPreConstraint(WorkItemRecord wir, String data) { Collection<String> advices = evaluateRule(wir.getSpecURI(), wir.getTaskName(), data); if (advices.size() > 0) { suspendCase(wir.getCaseID().substring(0, wir.getCaseID().indexOf('.'))); for (String s : advices) { try { uploadAdvice(s); String res = mapItemParamsToAdviceCaseParams(s, getInputParams(getAdviceID(s)), data); Advice advice = new Advice(); advice.setParentSpecID(wir.getSpecIdentifier()); advice.setParentSpecName(wir.getSpecURI()); advice.setParentCaseID(wir.getCaseID().substring(0, wir.getCaseID().indexOf('.'))); advice.setAdjpID(wir.getID()); advice.setAdjpDataString(data); advice.setAdviceName(s); advice.setSynched(false); this._Persister.beginTransaction(); this._Persister.insert(advice); this._Persister.commit(); String adviceCaseID = launchAdvice(getAdviceID(s), res); advice.setAdviceCaseID(adviceCaseID); this._Persister.beginTransaction(); this._Persister.update(advice); this._Persister.commit(); } catch (IOException e) { e.printStackTrace(); } } } }