@Override @Secured public void removeTestExecution(TestExecution testExecution) throws ServiceException { TestExecution freshTestExecution = testExecutionDAO.get(testExecution.getId()); if (freshTestExecution == null) { throw new ServiceException("serviceException.testExecutionNotFound", testExecution.getName()); } for (TestExecutionParameter testExecutionParameter : freshTestExecution.getParameters()) { testExecutionParameterDAO.remove(testExecutionParameter); } for (Value value : freshTestExecution.getValues()) { for (ValueParameter valueParameter : value.getParameters()) { valueParameterDAO.remove(valueParameter); } valueDAO.remove(value); } Iterator<TestExecutionAttachment> allTestExecutionAttachments = freshTestExecution.getAttachments().iterator(); while (allTestExecutionAttachments.hasNext()) { testExecutionAttachmentDAO.remove(allTestExecutionAttachments.next()); allTestExecutionAttachments.remove(); } testExecutionDAO.remove(freshTestExecution); }
@Override @Secured public void removeValue(Value value) throws ServiceException { TestExecution exec = testExecutionDAO.get(value.getTestExecution().getId()); if (exec == null) { throw new ServiceException( "serviceException.removeValue.testExecutionNotFound", value.getTestExecution().getName()); } Value v = valueDAO.get(value.getId()); for (ValueParameter vp : v.getParameters()) { valueParameterDAO.remove(vp); } valueDAO.remove(v); }