@Test public void testDeleteCrisisType() { CrisisTypeDTO addCrisisType = new CrisisTypeDTO(); addCrisisType.setName(sampleCrisisTypeName); entityManager.getTransaction().begin(); CrisisTypeDTO result = crisisTypeResourceFacadeImp .addCrisisType(addCrisisType); entityManager.getTransaction().commit(); entityManager.getTransaction().begin(); int delResult = crisisTypeResourceFacadeImp.deleteCrisisType(result .getCrisisTypeId()); entityManager.getTransaction().commit(); assertEquals(1, delResult); }
@Override public Integer deleteCrisisType(Long id) { CrisisType crisisType = getById(id); if (crisisType != null) { this.delete(crisisType); return 1; } else { logger.error("CrisisType requested to be deleted does not exist! id = " + id); throw new RuntimeException("CrisisType requested to be deleted does not exist! id = " + id); } }
CrisisTypeResourceFacadeImp extends CoreDBServiceFacadeImp<CrisisType, Long> implements CrisisTypeResourceFacade { @Override public Integer deleteCrisisType(Long id) { CrisisType crisisType = getById(id); if (crisisType != null) { this.delete(crisisType); return 1; } else { logger.error("CrisisType requested to be deleted does not exist! id = " + id); throw new RuntimeException("CrisisType requested to be deleted does not exist! id = " + id); } } }
CrisisTypeResourceFacadeImp extends CoreDBServiceFacadeImp<CrisisType, Long> implements CrisisTypeResourceFacade { @Override public Integer deleteCrisisType(Long id) { CrisisType crisisType = getById(id); if (crisisType != null) { this.delete(crisisType); return 1; } else { logger.error("CrisisType requested to be deleted does not exist! id = " + id); throw new RuntimeException("CrisisType requested to be deleted does not exist! id = " + id); } } CrisisTypeResourceFacadeImp(); }
CrisisTypeResourceFacadeImp extends CoreDBServiceFacadeImp<CrisisType, Long> implements CrisisTypeResourceFacade { @Override public Integer deleteCrisisType(Long id) { CrisisType crisisType = getById(id); if (crisisType != null) { this.delete(crisisType); return 1; } else { logger.error("CrisisType requested to be deleted does not exist! id = " + id); throw new RuntimeException("CrisisType requested to be deleted does not exist! id = " + id); } } CrisisTypeResourceFacadeImp(); @Override List<CrisisTypeDTO> getAllCrisisTypes(); @Override CrisisTypeDTO addCrisisType(CrisisTypeDTO crisisType); @Override CrisisTypeDTO editCrisisType(CrisisTypeDTO crisisType); @Override Integer deleteCrisisType(Long id); @Override List<CrisisTypeDTO> findByCriteria(String columnName, Object value); @Override CrisisTypeDTO findCrisisTypeByID(Long id); @Override boolean isCrisisTypeExists(Long id); @Override List<CollectionDTO> getAllCrisisForCrisisTypeID(Long id); }
CrisisTypeResourceFacadeImp extends CoreDBServiceFacadeImp<CrisisType, Long> implements CrisisTypeResourceFacade { @Override public Integer deleteCrisisType(Long id) { CrisisType crisisType = getById(id); if (crisisType != null) { this.delete(crisisType); return 1; } else { logger.error("CrisisType requested to be deleted does not exist! id = " + id); throw new RuntimeException("CrisisType requested to be deleted does not exist! id = " + id); } } CrisisTypeResourceFacadeImp(); @Override List<CrisisTypeDTO> getAllCrisisTypes(); @Override CrisisTypeDTO addCrisisType(CrisisTypeDTO crisisType); @Override CrisisTypeDTO editCrisisType(CrisisTypeDTO crisisType); @Override Integer deleteCrisisType(Long id); @Override List<CrisisTypeDTO> findByCriteria(String columnName, Object value); @Override CrisisTypeDTO findCrisisTypeByID(Long id); @Override boolean isCrisisTypeExists(Long id); @Override List<CollectionDTO> getAllCrisisForCrisisTypeID(Long id);  }