@Test public void testFindComponentsByNodeId() { assertNotNull(m_repository); assertFalse(0 == m_pe1NodeId); assertFalse(0 == m_pe2NodeId); List<NCSComponent> pe1Components = m_repository.findComponentsByNodeId(m_pe1NodeId); assertFalse(pe1Components.isEmpty()); NCSComponent pe1SvcElem = m_repository.findByTypeAndForeignIdentity("ServiceElement", "NA-ServiceElement", "8765"); assertNotNull(pe1SvcElem); assertTrue(pe1Components.contains(pe1SvcElem)); assertEquals(6, pe1Components.size()); List<NCSComponent> pe2Components = m_repository.findComponentsByNodeId(m_pe2NodeId); assertFalse(pe2Components.isEmpty()); assertEquals(6, pe2Components.size()); }
@Override public List<NCSComponent> findComponentsByNodeId(int nodeid) { return find("select distinct ncs from NCSComponent as ncs, OnmsNode as n left join fetch ncs.attributes where ncs.nodeIdentification.foreignSource = n.foreignSource and ncs.nodeIdentification.foreignId = n.foreignId and n.id = ?", nodeid); }
NCSComponentDao extends AbstractDaoHibernate<NCSComponent, Long> implements NCSComponentRepository { @Override public List<NCSComponent> findComponentsByNodeId(int nodeid) { return find("select distinct ncs from NCSComponent as ncs, OnmsNode as n left join fetch ncs.attributes where ncs.nodeIdentification.foreignSource = n.foreignSource and ncs.nodeIdentification.foreignId = n.foreignId and n.id = ?", nodeid); } }
NCSComponentDao extends AbstractDaoHibernate<NCSComponent, Long> implements NCSComponentRepository { @Override public List<NCSComponent> findComponentsByNodeId(int nodeid) { return find("select distinct ncs from NCSComponent as ncs, OnmsNode as n left join fetch ncs.attributes where ncs.nodeIdentification.foreignSource = n.foreignSource and ncs.nodeIdentification.foreignId = n.foreignId and n.id = ?", nodeid); } NCSComponentDao(); }
NCSComponentDao extends AbstractDaoHibernate<NCSComponent, Long> implements NCSComponentRepository { @Override public List<NCSComponent> findComponentsByNodeId(int nodeid) { return find("select distinct ncs from NCSComponent as ncs, OnmsNode as n left join fetch ncs.attributes where ncs.nodeIdentification.foreignSource = n.foreignSource and ncs.nodeIdentification.foreignId = n.foreignId and n.id = ?", nodeid); } NCSComponentDao(); @Override List<NCSComponent> findByType(String type); @Override NCSComponent findByTypeAndForeignIdentity(String type, String foreignSource, String foreignId); @Override List<NCSComponent> findComponentsThatDependOn(NCSComponent component); List<NCSComponent> findComponentsWithChild(final NCSComponent component); @Override List<NCSComponent> findComponentsWithAttribute(String attrKey, String attrValue); @Override List<NCSComponent> findComponentsByNodeId(int nodeid); @Override void save(final NCSComponent entity); @Override void saveOrUpdate(final NCSComponent entity); }
NCSComponentDao extends AbstractDaoHibernate<NCSComponent, Long> implements NCSComponentRepository { @Override public List<NCSComponent> findComponentsByNodeId(int nodeid) { return find("select distinct ncs from NCSComponent as ncs, OnmsNode as n left join fetch ncs.attributes where ncs.nodeIdentification.foreignSource = n.foreignSource and ncs.nodeIdentification.foreignId = n.foreignId and n.id = ?", nodeid); } NCSComponentDao(); @Override List<NCSComponent> findByType(String type); @Override NCSComponent findByTypeAndForeignIdentity(String type, String foreignSource, String foreignId); @Override List<NCSComponent> findComponentsThatDependOn(NCSComponent component); List<NCSComponent> findComponentsWithChild(final NCSComponent component); @Override List<NCSComponent> findComponentsWithAttribute(String attrKey, String attrValue); @Override List<NCSComponent> findComponentsByNodeId(int nodeid); @Override void save(final NCSComponent entity); @Override void saveOrUpdate(final NCSComponent entity);  }