@Override @Secured public Long addAttachment(TestExecutionAttachment attachment) throws ServiceException { TestExecution exec = testExecutionDAO.get(attachment.getTestExecution().getId()); if (exec == null) { throw new ServiceException( "serviceException.addAttachment.testExecutionNotFound", attachment.getTestExecution().getName()); } attachment.setTestExecution(exec); TestExecutionAttachment newAttachment = testExecutionAttachmentDAO.create(attachment); return newAttachment.getId(); }
@Override @Secured public void removeAttachment(TestExecutionAttachment attachment) throws ServiceException { TestExecution exec = testExecutionDAO.get(attachment.getTestExecution().getId()); if (exec == null) { throw new ServiceException( "serviceException.removeAttachment.testExecutionNotFound", attachment.getTestExecution().getName()); } TestExecutionAttachment freshAttachment = testExecutionAttachmentDAO.get(attachment.getId()); if (freshAttachment != null) { testExecutionAttachmentDAO.remove(freshAttachment); } }