@Test public void testEditNominalLabel() { try { nominalLabel.setName("sample_Name_on_edit"); entityManager.getTransaction().begin(); nominalLabel = nominalLabelResourceFacadeImp.editNominalLabel(nominalLabel); entityManager.getTransaction().commit(); assertEquals("sample_Name_on_edit", nominalLabel.getName()); } catch (PropertyNotSetException e) { logger.error("PropertyNotSetException while editting nominal label "+e.getMessage()); fail("testEditNominalLabel failed"); } }
@Override public NominalLabelDTO editNominalLabel(NominalLabelDTO nominalLabel) throws PropertyNotSetException { try { NominalLabel label = nominalLabel.toEntity(); NominalLabel oldLabel = getById(label.getNominalLabelId()); if (oldLabel != null) { label.setSequence(oldLabel.getSequence()); oldLabel = em.merge(label); em.flush(); em.refresh(oldLabel); return (oldLabel != null) ? new NominalLabelDTO(oldLabel) : null; } else { throw new RuntimeException("Not found"); } } catch (Exception e) { logger.error("Exception in merging/updating nominalLabel: " + nominalLabel.getNominalLabelId(), e); } return null; }
NominalLabelResourceFacadeImp extends CoreDBServiceFacadeImp<NominalLabel, Long> implements NominalLabelResourceFacade { @Override public NominalLabelDTO editNominalLabel(NominalLabelDTO nominalLabel) throws PropertyNotSetException { try { NominalLabel label = nominalLabel.toEntity(); NominalLabel oldLabel = getById(label.getNominalLabelId()); if (oldLabel != null) { label.setSequence(oldLabel.getSequence()); oldLabel = em.merge(label); em.flush(); em.refresh(oldLabel); return (oldLabel != null) ? new NominalLabelDTO(oldLabel) : null; } else { throw new RuntimeException("Not found"); } } catch (Exception e) { logger.error("Exception in merging/updating nominalLabel: " + nominalLabel.getNominalLabelId(), e); } return null; } }
NominalLabelResourceFacadeImp extends CoreDBServiceFacadeImp<NominalLabel, Long> implements NominalLabelResourceFacade { @Override public NominalLabelDTO editNominalLabel(NominalLabelDTO nominalLabel) throws PropertyNotSetException { try { NominalLabel label = nominalLabel.toEntity(); NominalLabel oldLabel = getById(label.getNominalLabelId()); if (oldLabel != null) { label.setSequence(oldLabel.getSequence()); oldLabel = em.merge(label); em.flush(); em.refresh(oldLabel); return (oldLabel != null) ? new NominalLabelDTO(oldLabel) : null; } else { throw new RuntimeException("Not found"); } } catch (Exception e) { logger.error("Exception in merging/updating nominalLabel: " + nominalLabel.getNominalLabelId(), e); } return null; } protected  NominalLabelResourceFacadeImp(); }
NominalLabelResourceFacadeImp extends CoreDBServiceFacadeImp<NominalLabel, Long> implements NominalLabelResourceFacade { @Override public NominalLabelDTO editNominalLabel(NominalLabelDTO nominalLabel) throws PropertyNotSetException { try { NominalLabel label = nominalLabel.toEntity(); NominalLabel oldLabel = getById(label.getNominalLabelId()); if (oldLabel != null) { label.setSequence(oldLabel.getSequence()); oldLabel = em.merge(label); em.flush(); em.refresh(oldLabel); return (oldLabel != null) ? new NominalLabelDTO(oldLabel) : null; } else { throw new RuntimeException("Not found"); } } catch (Exception e) { logger.error("Exception in merging/updating nominalLabel: " + nominalLabel.getNominalLabelId(), e); } return null; } protected  NominalLabelResourceFacadeImp(); @Override void saveNominalLabel(NominalLabelDTO nominalLabel); @Override NominalLabelDTO addNominalLabel(NominalLabelDTO nominalLabel); @Override NominalLabelDTO editNominalLabel(NominalLabelDTO nominalLabel); @Override Integer deleteNominalLabel(NominalLabelDTO nominalLabel); @Override Integer deleteNominalLabelByID(Long nominalLabelID); @Override NominalLabelDTO getNominalLabelByID(Long nominalLabelID); @Override NominalLabelDTO getNominalLabelWithAllFieldsByID(Long nominalLabelID); @Override NominalLabelDTO getNominalLabelByCode(String code); @Override NominalLabelDTO getNominalLabelWithAllFieldsByCode(String code); @Override List<NominalLabelDTO> getAllNominalLabels(); @Override Boolean isNominalLabelExists(Long nominalLabelID); @Override Boolean isNominalLabelExists(String code); @Override List<NominalLabelDTO> getNominalLabelByAttributeID(Long attributeID); @Override List<Long> getNominalLabelIdsByAttributeID(Long attributeID); @Override Long getNominalLabelCountForCollectionID(Long collectionId); }
NominalLabelResourceFacadeImp extends CoreDBServiceFacadeImp<NominalLabel, Long> implements NominalLabelResourceFacade { @Override public NominalLabelDTO editNominalLabel(NominalLabelDTO nominalLabel) throws PropertyNotSetException { try { NominalLabel label = nominalLabel.toEntity(); NominalLabel oldLabel = getById(label.getNominalLabelId()); if (oldLabel != null) { label.setSequence(oldLabel.getSequence()); oldLabel = em.merge(label); em.flush(); em.refresh(oldLabel); return (oldLabel != null) ? new NominalLabelDTO(oldLabel) : null; } else { throw new RuntimeException("Not found"); } } catch (Exception e) { logger.error("Exception in merging/updating nominalLabel: " + nominalLabel.getNominalLabelId(), e); } return null; } protected  NominalLabelResourceFacadeImp(); @Override void saveNominalLabel(NominalLabelDTO nominalLabel); @Override NominalLabelDTO addNominalLabel(NominalLabelDTO nominalLabel); @Override NominalLabelDTO editNominalLabel(NominalLabelDTO nominalLabel); @Override Integer deleteNominalLabel(NominalLabelDTO nominalLabel); @Override Integer deleteNominalLabelByID(Long nominalLabelID); @Override NominalLabelDTO getNominalLabelByID(Long nominalLabelID); @Override NominalLabelDTO getNominalLabelWithAllFieldsByID(Long nominalLabelID); @Override NominalLabelDTO getNominalLabelByCode(String code); @Override NominalLabelDTO getNominalLabelWithAllFieldsByCode(String code); @Override List<NominalLabelDTO> getAllNominalLabels(); @Override Boolean isNominalLabelExists(Long nominalLabelID); @Override Boolean isNominalLabelExists(String code); @Override List<NominalLabelDTO> getNominalLabelByAttributeID(Long attributeID); @Override List<Long> getNominalLabelIdsByAttributeID(Long attributeID); @Override Long getNominalLabelCountForCollectionID(Long collectionId);  }