@Test public void testDeleteAttribute() { try { entityManager.getTransaction().begin(); boolean result = nominalAttributeResourceFacadeImp.deleteAttribute(nominalAttribute.getNominalAttributeId()); entityManager.getTransaction().commit(); assertEquals(true, result); nominalAttribute=null; } catch (PropertyNotSetException e) { logger.error("PropertyNotSetException while deleting nominal attribute "+e.getMessage()); fail("testdeleteAttribute failed"); } }
@Override public boolean deleteAttribute(Long attributeID) throws PropertyNotSetException { NominalAttribute attribute = getEntityManager().find(NominalAttribute.class, attributeID); if (attribute != null) { try { NominalAttribute managed = getEntityManager().merge(attribute); getEntityManager().remove(managed); } catch (HibernateException he) { logger.error("Error occured while removing Attribute with ID = " + attributeID + "\n" + he.getStackTrace()); return false; } return true; } else { return false; } }
NominalAttributeResourceFacadeImp extends CoreDBServiceFacadeImp<NominalAttribute, Long> implements NominalAttributeResourceFacade { @Override public boolean deleteAttribute(Long attributeID) throws PropertyNotSetException { NominalAttribute attribute = getEntityManager().find(NominalAttribute.class, attributeID); if (attribute != null) { try { NominalAttribute managed = getEntityManager().merge(attribute); getEntityManager().remove(managed); } catch (HibernateException he) { logger.error("Error occured while removing Attribute with ID = " + attributeID + "\n" + he.getStackTrace()); return false; } return true; } else { return false; } } }
NominalAttributeResourceFacadeImp extends CoreDBServiceFacadeImp<NominalAttribute, Long> implements NominalAttributeResourceFacade { @Override public boolean deleteAttribute(Long attributeID) throws PropertyNotSetException { NominalAttribute attribute = getEntityManager().find(NominalAttribute.class, attributeID); if (attribute != null) { try { NominalAttribute managed = getEntityManager().merge(attribute); getEntityManager().remove(managed); } catch (HibernateException he) { logger.error("Error occured while removing Attribute with ID = " + attributeID + "\n" + he.getStackTrace()); return false; } return true; } else { return false; } } NominalAttributeResourceFacadeImp(); }
NominalAttributeResourceFacadeImp extends CoreDBServiceFacadeImp<NominalAttribute, Long> implements NominalAttributeResourceFacade { @Override public boolean deleteAttribute(Long attributeID) throws PropertyNotSetException { NominalAttribute attribute = getEntityManager().find(NominalAttribute.class, attributeID); if (attribute != null) { try { NominalAttribute managed = getEntityManager().merge(attribute); getEntityManager().remove(managed); } catch (HibernateException he) { logger.error("Error occured while removing Attribute with ID = " + attributeID + "\n" + he.getStackTrace()); return false; } return true; } else { return false; } } NominalAttributeResourceFacadeImp(); @Override NominalAttributeDTO addAttribute(NominalAttributeDTO attribute); @Override NominalAttributeDTO editAttribute(NominalAttributeDTO attribute); @Override boolean deleteAttribute(Long attributeID); @Override NominalAttributeDTO getAttributeByID(Long attributeID); @Override List<NominalAttributeDTO> getAllAttributes(); @Override Long isAttributeExists(String attributeCode); @Override @SuppressWarnings("unchecked") List<CrisisAttributesDTO> getAllAttributesExceptCrisis(Long crisisID); }
NominalAttributeResourceFacadeImp extends CoreDBServiceFacadeImp<NominalAttribute, Long> implements NominalAttributeResourceFacade { @Override public boolean deleteAttribute(Long attributeID) throws PropertyNotSetException { NominalAttribute attribute = getEntityManager().find(NominalAttribute.class, attributeID); if (attribute != null) { try { NominalAttribute managed = getEntityManager().merge(attribute); getEntityManager().remove(managed); } catch (HibernateException he) { logger.error("Error occured while removing Attribute with ID = " + attributeID + "\n" + he.getStackTrace()); return false; } return true; } else { return false; } } NominalAttributeResourceFacadeImp(); @Override NominalAttributeDTO addAttribute(NominalAttributeDTO attribute); @Override NominalAttributeDTO editAttribute(NominalAttributeDTO attribute); @Override boolean deleteAttribute(Long attributeID); @Override NominalAttributeDTO getAttributeByID(Long attributeID); @Override List<NominalAttributeDTO> getAllAttributes(); @Override Long isAttributeExists(String attributeCode); @Override @SuppressWarnings("unchecked") List<CrisisAttributesDTO> getAllAttributesExceptCrisis(Long crisisID);  }