@Test public void testAdd() throws Exception { IDataSet db = database( support.loadFlatXmlDataStream(getClass(), "user.xml"), support.loadFlatXmlDataStream(getClass(), "wf_job.xml"), support.loadFlatXmlDataStream(getClass(), "wf_task.xml") ); support.cleanInsert(support.getConnection(tx), db); tx.commit(); Task task = new Task().addId(BigDecimal.ONE); List<TaskParameter> params = Arrays.asList(dao.create().addParamRef("param.p1").addValue(ValueType.STRING, "p1Val"), dao.create().addParamRef("param.p2").addValue(ValueType.NUMBER, "1"), dao.create().addParamRef("param.p3").addValue(ValueType.NUMBER, null), dao.create().addParamRef("param.p4").addValue(ValueType.DATETIME, "2011-12-31T15:05:50+0100"), dao.create().addParamRef("param.p5").addValue(ValueType.NUMBER, "1.01"), dao.create().addParamRef("param.p6").addValue(ValueType.NUMBER, "0") ); dao.add(task.getId(), params); tx.commit(); assertEquals(task.getId(), params.get(0).getTaskId()); Map<String, String> map = dao.findAsMap(task.getId()); assertEquals(params.size(), map.size()); assertTrue(map.containsKey("param.p1")); assertEquals("p1Val", map.get("param.p1")); assertTrue(map.containsKey("param.p2")); assertEquals("1", map.get("param.p2")); assertTrue(map.containsKey("param.p3")); assertEquals(null, map.get("param.p3")); assertTrue(map.containsKey("param.p4")); assertEquals("2011-12-31T14:05:50.000Z", map.get("param.p4")); assertEquals("1.01", map.get("param.p5")); assertEquals("0", map.get("param.p6")); TaskParameterFilter filter = new TaskParameterFilter(); filter.setTaskId(task.getId()); filter.setLocale(Locale.ENGLISH); filter.setProfileName("param.p6"); List<TaskParameterView> view = dao.view(filter); assertEquals(1, view.size()); assertEquals("0", view.get(0).getValue()); assertEquals(0, BigDecimal.ZERO.compareTo(view.get(0).getValueNumber())); List<TaskParameter> result = dao.find(task.getId()); assertEquals(task.getId(), result.get(0).getTaskId()); }
@Override public void add(BigDecimal taskId, List<TaskParameter> params) { if (taskId == null) { throw new IllegalArgumentException("Unsupported missing taskId!"); } Connection c = getConnection(); DBRecord r = new DBRecord(); for (TaskParameter param : params) { param.setTaskId(taskId); r.create(tableParams); r.setBeanValues(param); r.update(c); } }
EmpireWorkflowParameterDao extends EmpireDao implements WorkflowParameterDao { @Override public void add(BigDecimal taskId, List<TaskParameter> params) { if (taskId == null) { throw new IllegalArgumentException("Unsupported missing taskId!"); } Connection c = getConnection(); DBRecord r = new DBRecord(); for (TaskParameter param : params) { param.setTaskId(taskId); r.create(tableParams); r.setBeanValues(param); r.update(c); } } }
EmpireWorkflowParameterDao extends EmpireDao implements WorkflowParameterDao { @Override public void add(BigDecimal taskId, List<TaskParameter> params) { if (taskId == null) { throw new IllegalArgumentException("Unsupported missing taskId!"); } Connection c = getConnection(); DBRecord r = new DBRecord(); for (TaskParameter param : params) { param.setTaskId(taskId); r.create(tableParams); r.setBeanValues(param); r.update(c); } } EmpireWorkflowParameterDao(ProarcDatabase db); }
EmpireWorkflowParameterDao extends EmpireDao implements WorkflowParameterDao { @Override public void add(BigDecimal taskId, List<TaskParameter> params) { if (taskId == null) { throw new IllegalArgumentException("Unsupported missing taskId!"); } Connection c = getConnection(); DBRecord r = new DBRecord(); for (TaskParameter param : params) { param.setTaskId(taskId); r.create(tableParams); r.setBeanValues(param); r.update(c); } } EmpireWorkflowParameterDao(ProarcDatabase db); @Override TaskParameter create(); @Override void add(BigDecimal taskId, List<TaskParameter> params); @Override void remove(BigDecimal taskId); @Override List<TaskParameter> find(BigDecimal taskId); Map<String, String> findAsMap(BigDecimal taskId); @Override List<TaskParameterView> view(TaskParameterFilter filter); }
EmpireWorkflowParameterDao extends EmpireDao implements WorkflowParameterDao { @Override public void add(BigDecimal taskId, List<TaskParameter> params) { if (taskId == null) { throw new IllegalArgumentException("Unsupported missing taskId!"); } Connection c = getConnection(); DBRecord r = new DBRecord(); for (TaskParameter param : params) { param.setTaskId(taskId); r.create(tableParams); r.setBeanValues(param); r.update(c); } } EmpireWorkflowParameterDao(ProarcDatabase db); @Override TaskParameter create(); @Override void add(BigDecimal taskId, List<TaskParameter> params); @Override void remove(BigDecimal taskId); @Override List<TaskParameter> find(BigDecimal taskId); Map<String, String> findAsMap(BigDecimal taskId); @Override List<TaskParameterView> view(TaskParameterFilter filter);  }