@Test public void testInsertTaskAnswer() { taskAnswer.setAnswer("test_sample_answer1"); entityManager.getTransaction().begin(); taskAnswerResourceFacadeImp.insertTaskAnswer(taskAnswer); entityManager.getTransaction().commit(); taskAnswer = taskAnswerResourceFacadeImp.getTaskAnswer(documentDTO.getDocumentID(), user.getUserID()); assertEquals(documentDTO.getDocumentID(),taskAnswer.getDocumentID()); }
@Override public void insertTaskAnswer(TaskAnswerDTO taskAnswer) { if (taskAnswer != null) { logger.debug("Going to insert answer = " + taskAnswer.getAnswer() + " for documentId = " + taskAnswer.getDocumentID()); try { TaskAnswerDTO answer = getTaskAnswer(taskAnswer.getDocumentID(), taskAnswer.getUserID()); if(answer == null) { TaskAnswer t = taskAnswer.toEntity(); em.persist(t); em.flush(); } } catch (Exception e) { logger.error("Unable to save taskAnswer: " + taskAnswer.getDocumentID() + ", " + taskAnswer.getUserID() + ", " + taskAnswer.getAnswer(), e); } } else { logger.warn("Warning! Attempted to insert null task answer!"); } }
TaskAnswerResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAnswer, Long> implements TaskAnswerResourceFacade { @Override public void insertTaskAnswer(TaskAnswerDTO taskAnswer) { if (taskAnswer != null) { logger.debug("Going to insert answer = " + taskAnswer.getAnswer() + " for documentId = " + taskAnswer.getDocumentID()); try { TaskAnswerDTO answer = getTaskAnswer(taskAnswer.getDocumentID(), taskAnswer.getUserID()); if(answer == null) { TaskAnswer t = taskAnswer.toEntity(); em.persist(t); em.flush(); } } catch (Exception e) { logger.error("Unable to save taskAnswer: " + taskAnswer.getDocumentID() + ", " + taskAnswer.getUserID() + ", " + taskAnswer.getAnswer(), e); } } else { logger.warn("Warning! Attempted to insert null task answer!"); } } }
TaskAnswerResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAnswer, Long> implements TaskAnswerResourceFacade { @Override public void insertTaskAnswer(TaskAnswerDTO taskAnswer) { if (taskAnswer != null) { logger.debug("Going to insert answer = " + taskAnswer.getAnswer() + " for documentId = " + taskAnswer.getDocumentID()); try { TaskAnswerDTO answer = getTaskAnswer(taskAnswer.getDocumentID(), taskAnswer.getUserID()); if(answer == null) { TaskAnswer t = taskAnswer.toEntity(); em.persist(t); em.flush(); } } catch (Exception e) { logger.error("Unable to save taskAnswer: " + taskAnswer.getDocumentID() + ", " + taskAnswer.getUserID() + ", " + taskAnswer.getAnswer(), e); } } else { logger.warn("Warning! Attempted to insert null task answer!"); } } protected  TaskAnswerResourceFacadeImp(); }
TaskAnswerResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAnswer, Long> implements TaskAnswerResourceFacade { @Override public void insertTaskAnswer(TaskAnswerDTO taskAnswer) { if (taskAnswer != null) { logger.debug("Going to insert answer = " + taskAnswer.getAnswer() + " for documentId = " + taskAnswer.getDocumentID()); try { TaskAnswerDTO answer = getTaskAnswer(taskAnswer.getDocumentID(), taskAnswer.getUserID()); if(answer == null) { TaskAnswer t = taskAnswer.toEntity(); em.persist(t); em.flush(); } } catch (Exception e) { logger.error("Unable to save taskAnswer: " + taskAnswer.getDocumentID() + ", " + taskAnswer.getUserID() + ", " + taskAnswer.getAnswer(), e); } } else { logger.warn("Warning! Attempted to insert null task answer!"); } } protected  TaskAnswerResourceFacadeImp(); @Override void insertTaskAnswer(TaskAnswerDTO taskAnswer); @Override List<TaskAnswerDTO> getTaskAnswer(Long documentID); @Override TaskAnswerDTO getTaskAnswer(Long documentID, Long userID); @Override int undoTaskAnswer(Long documentID, Long userID); @Override boolean deleteTaskAnswer(Long documentID); }
TaskAnswerResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAnswer, Long> implements TaskAnswerResourceFacade { @Override public void insertTaskAnswer(TaskAnswerDTO taskAnswer) { if (taskAnswer != null) { logger.debug("Going to insert answer = " + taskAnswer.getAnswer() + " for documentId = " + taskAnswer.getDocumentID()); try { TaskAnswerDTO answer = getTaskAnswer(taskAnswer.getDocumentID(), taskAnswer.getUserID()); if(answer == null) { TaskAnswer t = taskAnswer.toEntity(); em.persist(t); em.flush(); } } catch (Exception e) { logger.error("Unable to save taskAnswer: " + taskAnswer.getDocumentID() + ", " + taskAnswer.getUserID() + ", " + taskAnswer.getAnswer(), e); } } else { logger.warn("Warning! Attempted to insert null task answer!"); } } protected  TaskAnswerResourceFacadeImp(); @Override void insertTaskAnswer(TaskAnswerDTO taskAnswer); @Override List<TaskAnswerDTO> getTaskAnswer(Long documentID); @Override TaskAnswerDTO getTaskAnswer(Long documentID, Long userID); @Override int undoTaskAnswer(Long documentID, Long userID); @Override boolean deleteTaskAnswer(Long documentID);  }