@Test @Transactional public void testSaveLinkState() { Collection<DataLinkInterface> dlis = m_dataLinkInterfaceDao.findAll(); assertNotNull(dlis); assertFalse(dlis.isEmpty()); DataLinkInterface dli = dlis.iterator().next(); assertNotNull(dli); OnmsLinkState linkState1 = new OnmsLinkState(); linkState1.setDataLinkInterface(dli); m_linkStateDao.save(linkState1); m_linkStateDao.flush(); Integer id = linkState1.getId(); assertNotNull(id); OnmsLinkState linkState2 = m_linkStateDao.get(id); assertNotNull(linkState2); assertEquals(LinkState.LINK_UP, linkState2.getLinkState()); linkState2.setLinkState(LinkState.LINK_NODE_DOWN); m_linkStateDao.save(linkState2); m_linkStateDao.flush(); OnmsLinkState linkState3 = m_linkStateDao.get(id); assertNotNull(linkState3); assertEquals(LinkState.LINK_NODE_DOWN, linkState3.getLinkState()); }
@SuppressWarnings("unchecked") public Collection<OnmsLinkState> findAll(final Integer offset, final Integer limit) { return getHibernateTemplate().execute(new HibernateCallback<Collection<OnmsLinkState>>() { public Collection<OnmsLinkState> doInHibernate(Session session) throws HibernateException, SQLException { return session.createCriteria(OnmsLinkState.class) .setFirstResult(offset) .setMaxResults(limit) .list(); } }); }
LinkStateDaoHibernate extends AbstractDaoHibernate<OnmsLinkState, Integer> implements LinkStateDao { @SuppressWarnings("unchecked") public Collection<OnmsLinkState> findAll(final Integer offset, final Integer limit) { return getHibernateTemplate().execute(new HibernateCallback<Collection<OnmsLinkState>>() { public Collection<OnmsLinkState> doInHibernate(Session session) throws HibernateException, SQLException { return session.createCriteria(OnmsLinkState.class) .setFirstResult(offset) .setMaxResults(limit) .list(); } }); } }
LinkStateDaoHibernate extends AbstractDaoHibernate<OnmsLinkState, Integer> implements LinkStateDao { @SuppressWarnings("unchecked") public Collection<OnmsLinkState> findAll(final Integer offset, final Integer limit) { return getHibernateTemplate().execute(new HibernateCallback<Collection<OnmsLinkState>>() { public Collection<OnmsLinkState> doInHibernate(Session session) throws HibernateException, SQLException { return session.createCriteria(OnmsLinkState.class) .setFirstResult(offset) .setMaxResults(limit) .list(); } }); } LinkStateDaoHibernate(); }
LinkStateDaoHibernate extends AbstractDaoHibernate<OnmsLinkState, Integer> implements LinkStateDao { @SuppressWarnings("unchecked") public Collection<OnmsLinkState> findAll(final Integer offset, final Integer limit) { return getHibernateTemplate().execute(new HibernateCallback<Collection<OnmsLinkState>>() { public Collection<OnmsLinkState> doInHibernate(Session session) throws HibernateException, SQLException { return session.createCriteria(OnmsLinkState.class) .setFirstResult(offset) .setMaxResults(limit) .list(); } }); } LinkStateDaoHibernate(); @SuppressWarnings("unchecked") Collection<OnmsLinkState> findAll(final Integer offset, final Integer limit); OnmsLinkState findById(Integer id); OnmsLinkState findByDataLinkInterfaceId(final Integer interfaceId); Collection<OnmsLinkState> findByNodeId(Integer nodeId); Collection<OnmsLinkState> findByNodeParentId(Integer nodeParentId); }
LinkStateDaoHibernate extends AbstractDaoHibernate<OnmsLinkState, Integer> implements LinkStateDao { @SuppressWarnings("unchecked") public Collection<OnmsLinkState> findAll(final Integer offset, final Integer limit) { return getHibernateTemplate().execute(new HibernateCallback<Collection<OnmsLinkState>>() { public Collection<OnmsLinkState> doInHibernate(Session session) throws HibernateException, SQLException { return session.createCriteria(OnmsLinkState.class) .setFirstResult(offset) .setMaxResults(limit) .list(); } }); } LinkStateDaoHibernate(); @SuppressWarnings("unchecked") Collection<OnmsLinkState> findAll(final Integer offset, final Integer limit); OnmsLinkState findById(Integer id); OnmsLinkState findByDataLinkInterfaceId(final Integer interfaceId); Collection<OnmsLinkState> findByNodeId(Integer nodeId); Collection<OnmsLinkState> findByNodeParentId(Integer nodeParentId);  }