@Test public void testAddCrisisType() { CrisisTypeDTO addCrisisType = new CrisisTypeDTO(); addCrisisType.setName(sampleCrisisTypeName); entityManager.getTransaction().begin(); CrisisTypeDTO result = crisisTypeResourceFacadeImp .addCrisisType(addCrisisType); entityManager.getTransaction().commit(); assertEquals(sampleCrisisTypeName, result.getName()); entityManager.getTransaction().begin(); crisisTypeResourceFacadeImp.deleteCrisisType(result.getCrisisTypeId()); entityManager.getTransaction().commit(); }
@Override public CrisisTypeDTO addCrisisType(CrisisTypeDTO crisisType) { try { CrisisType cType = crisisType.toEntity(); em.persist(cType); em.flush(); em.refresh(cType); return new CrisisTypeDTO(cType); } catch (Exception e) { e.printStackTrace(); return null; } }
CrisisTypeResourceFacadeImp extends CoreDBServiceFacadeImp<CrisisType, Long> implements CrisisTypeResourceFacade { @Override public CrisisTypeDTO addCrisisType(CrisisTypeDTO crisisType) { try { CrisisType cType = crisisType.toEntity(); em.persist(cType); em.flush(); em.refresh(cType); return new CrisisTypeDTO(cType); } catch (Exception e) { e.printStackTrace(); return null; } } }
CrisisTypeResourceFacadeImp extends CoreDBServiceFacadeImp<CrisisType, Long> implements CrisisTypeResourceFacade { @Override public CrisisTypeDTO addCrisisType(CrisisTypeDTO crisisType) { try { CrisisType cType = crisisType.toEntity(); em.persist(cType); em.flush(); em.refresh(cType); return new CrisisTypeDTO(cType); } catch (Exception e) { e.printStackTrace(); return null; } } CrisisTypeResourceFacadeImp(); }
CrisisTypeResourceFacadeImp extends CoreDBServiceFacadeImp<CrisisType, Long> implements CrisisTypeResourceFacade { @Override public CrisisTypeDTO addCrisisType(CrisisTypeDTO crisisType) { try { CrisisType cType = crisisType.toEntity(); em.persist(cType); em.flush(); em.refresh(cType); return new CrisisTypeDTO(cType); } catch (Exception e) { e.printStackTrace(); return null; } } 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 CrisisTypeDTO addCrisisType(CrisisTypeDTO crisisType) { try { CrisisType cType = crisisType.toEntity(); em.persist(cType); em.flush(); em.refresh(cType); return new CrisisTypeDTO(cType); } catch (Exception e) { e.printStackTrace(); return null; } } 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);  }