@Test public void testUndoTaskAssignmentByTaskMap() { Map<Long, Long> taskMap = new HashMap<Long, Long>(); taskMap.put(documentDTO.getDocumentID(), user.getUserID()); entityManager.getTransaction().begin(); int result = taskAssignmentResourceFacadeImp.undoTaskAssignment(taskMap); entityManager.getTransaction().commit(); assertEquals(1,result); taskAssignment=null; }
@Override public int undoTaskAssignment(List<DocumentDTO> taskList, Long userID) { if (taskList != null && !taskList.isEmpty()) { try { int deleteCount = 0; for (Iterator<DocumentDTO> it = taskList.iterator(); it.hasNext();){ DocumentDTO tb = (DocumentDTO) it.next(); TaskAssignment taskAssignment = (TaskAssignment) getTaskAssignment(tb.getDocumentID(), userID); delete(taskAssignment); em.flush(); ++deleteCount; } return deleteCount; } catch (Exception e) { logger.error("Error in undo operation!"); } } return 0; }
TaskAssignmentResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAssignment, Long> implements TaskAssignmentResourceFacade { @Override public int undoTaskAssignment(List<DocumentDTO> taskList, Long userID) { if (taskList != null && !taskList.isEmpty()) { try { int deleteCount = 0; for (Iterator<DocumentDTO> it = taskList.iterator(); it.hasNext();){ DocumentDTO tb = (DocumentDTO) it.next(); TaskAssignment taskAssignment = (TaskAssignment) getTaskAssignment(tb.getDocumentID(), userID); delete(taskAssignment); em.flush(); ++deleteCount; } return deleteCount; } catch (Exception e) { logger.error("Error in undo operation!"); } } return 0; } }
TaskAssignmentResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAssignment, Long> implements TaskAssignmentResourceFacade { @Override public int undoTaskAssignment(List<DocumentDTO> taskList, Long userID) { if (taskList != null && !taskList.isEmpty()) { try { int deleteCount = 0; for (Iterator<DocumentDTO> it = taskList.iterator(); it.hasNext();){ DocumentDTO tb = (DocumentDTO) it.next(); TaskAssignment taskAssignment = (TaskAssignment) getTaskAssignment(tb.getDocumentID(), userID); delete(taskAssignment); em.flush(); ++deleteCount; } return deleteCount; } catch (Exception e) { logger.error("Error in undo operation!"); } } return 0; } TaskAssignmentResourceFacadeImp(); }
TaskAssignmentResourceFacadeImp extends CoreDBServiceFacadeImp<TaskAssignment, Long> implements TaskAssignmentResourceFacade { @Override public int undoTaskAssignment(List<DocumentDTO> taskList, Long userID) { if (taskList != null && !taskList.isEmpty()) { try { int deleteCount = 0; for (Iterator<DocumentDTO> it = taskList.iterator(); it.hasNext();){ DocumentDTO tb = (DocumentDTO) it.next(); TaskAssignment taskAssignment = (TaskAssignment) getTaskAssignment(tb.getDocumentID(), userID); delete(taskAssignment); em.flush(); ++deleteCount; } return deleteCount; } catch (Exception e) { logger.error("Error in undo operation!"); } } 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 undoTaskAssignment(List<DocumentDTO> taskList, Long userID) { if (taskList != null && !taskList.isEmpty()) { try { int deleteCount = 0; for (Iterator<DocumentDTO> it = taskList.iterator(); it.hasNext();){ DocumentDTO tb = (DocumentDTO) it.next(); TaskAssignment taskAssignment = (TaskAssignment) getTaskAssignment(tb.getDocumentID(), userID); delete(taskAssignment); em.flush(); ++deleteCount; } return deleteCount; } catch (Exception e) { logger.error("Error in undo operation!"); } } 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);  }