@Test public void testInsertTaskAssignment() { if(taskAssignment!=null){ entityManager.getTransaction().begin(); taskAssignmentResourceFacadeImp.undoTaskAssignment(documentDTO.getDocumentID(), user.getUserID()); entityManager.getTransaction().commit(); } List<DocumentDTO> documentDTOs = new ArrayList<DocumentDTO>(); documentDTOs.add(documentDTO); entityManager.getTransaction().begin(); int result = taskAssignmentResourceFacadeImp.insertTaskAssignment(documentDTOs, user.getUserID()); entityManager.getTransaction().commit(); taskAssignment = taskAssignmentResourceFacadeImp.findTaskAssignment(documentDTO.getDocumentID(), user.getUserID()); assertEquals(1, result); }
@Override public int insertTaskAssignment(List<DocumentDTO> taskList, Long userID) { logger.debug("[insertTaskAssignment] Going to insert/create task list of size = " + taskList.size() + ", for userID: " + userID); try { for (DocumentDTO documentDTO : taskList) { TaskAssignment taskAssignment = new TaskAssignment(documentDTO.getDocumentID(), userID, new Date()); save(taskAssignment); em.flush(); } return 1; } catch (Exception e) { logger.error("Error in insert operation!", e); return 0; } }
TaskAssignmentResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAssignment, Long> implements TaskAssignmentResourceFacade { @Override public int insertTaskAssignment(List<DocumentDTO> taskList, Long userID) { logger.debug("[insertTaskAssignment] Going to insert/create task list of size = " + taskList.size() + ", for userID: " + userID); try { for (DocumentDTO documentDTO : taskList) { TaskAssignment taskAssignment = new TaskAssignment(documentDTO.getDocumentID(), userID, new Date()); save(taskAssignment); em.flush(); } return 1; } catch (Exception e) { logger.error("Error in insert operation!", e); return 0; } } }
TaskAssignmentResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAssignment, Long> implements TaskAssignmentResourceFacade { @Override public int insertTaskAssignment(List<DocumentDTO> taskList, Long userID) { logger.debug("[insertTaskAssignment] Going to insert/create task list of size = " + taskList.size() + ", for userID: " + userID); try { for (DocumentDTO documentDTO : taskList) { TaskAssignment taskAssignment = new TaskAssignment(documentDTO.getDocumentID(), userID, new Date()); save(taskAssignment); em.flush(); } return 1; } catch (Exception e) { logger.error("Error in insert operation!", e); return 0; } } TaskAssignmentResourceFacadeImp(); }
TaskAssignmentResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAssignment, Long> implements TaskAssignmentResourceFacade { @Override public int insertTaskAssignment(List<DocumentDTO> taskList, Long userID) { logger.debug("[insertTaskAssignment] Going to insert/create task list of size = " + taskList.size() + ", for userID: " + userID); try { for (DocumentDTO documentDTO : taskList) { TaskAssignment taskAssignment = new TaskAssignment(documentDTO.getDocumentID(), userID, new Date()); save(taskAssignment); em.flush(); } return 1; } catch (Exception e) { logger.error("Error in insert operation!", e); return 0; } } TaskAssignmentResourceFacadeImp(); @Override int insertTaskAssignment(List<DocumentDTO> taskList, Long userID); @Override int insertOneTaskAssignment(Long documentID, Long userID); @Override int undoTaskAssignment(List<DocumentDTO> taskList, Long userID); @Override int undoTaskAssignment(Map<Long, Long> taskMap); @Override int undoTaskAssignment(Long documentID, Long userID); @Override void undoTaskAssignmentByTimer(); @Override TaskAssignmentDTO findTaskAssignment(Long documentID, Long userID); @Override List<TaskAssignmentDTO> findTaskAssignmentByID(Long documentID); @Override Integer getPendingTaskCount(Long userID); }
TaskAssignmentResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAssignment, Long> implements TaskAssignmentResourceFacade { @Override public int insertTaskAssignment(List<DocumentDTO> taskList, Long userID) { logger.debug("[insertTaskAssignment] Going to insert/create task list of size = " + taskList.size() + ", for userID: " + userID); try { for (DocumentDTO documentDTO : taskList) { TaskAssignment taskAssignment = new TaskAssignment(documentDTO.getDocumentID(), userID, new Date()); save(taskAssignment); em.flush(); } return 1; } catch (Exception e) { logger.error("Error in insert operation!", e); return 0; } } TaskAssignmentResourceFacadeImp(); @Override int insertTaskAssignment(List<DocumentDTO> taskList, Long userID); @Override int insertOneTaskAssignment(Long documentID, Long userID); @Override int undoTaskAssignment(List<DocumentDTO> taskList, Long userID); @Override int undoTaskAssignment(Map<Long, Long> taskMap); @Override int undoTaskAssignment(Long documentID, Long userID); @Override void undoTaskAssignmentByTimer(); @Override TaskAssignmentDTO findTaskAssignment(Long documentID, Long userID); @Override List<TaskAssignmentDTO> findTaskAssignmentByID(Long documentID); @Override Integer getPendingTaskCount(Long userID);  }