@Test @Transactional public void dwoTestUpdateLinkStatus(){ Collection<DataLinkInterface> dataLinks = m_dataLinkDao.findByNodeId(END_POINT2_ID); assertEquals("A", dataLinks.iterator().next().getStatus()); int parentNodeId = END_POINT1_ID; int nodeId = END_POINT2_ID; m_nodeLinkService.updateLinkStatus(parentNodeId, nodeId, "G"); dataLinks = m_dataLinkDao.findByNodeId(END_POINT2_ID); assertEquals("G", dataLinks.iterator().next().getStatus()); }
@Transactional public void updateLinkStatus(int nodeParentId, int nodeId, String status) { OnmsCriteria criteria = new OnmsCriteria(DataLinkInterface.class); criteria.createAlias("node", "node", OnmsCriteria.LEFT_JOIN); criteria.add(Restrictions.eq("node.id", nodeId)); criteria.add(Restrictions.eq("nodeParentId", nodeParentId)); Collection<DataLinkInterface> dataLinkInterface = m_dataLinkDao.findMatching(criteria); if(dataLinkInterface.size() > 0){ DataLinkInterface dataLink = dataLinkInterface.iterator().next(); dataLink.setStatus(status); m_dataLinkDao.update(dataLink); m_dataLinkDao.flush(); } }
DefaultNodeLinkService implements NodeLinkService, InitializingBean { @Transactional public void updateLinkStatus(int nodeParentId, int nodeId, String status) { OnmsCriteria criteria = new OnmsCriteria(DataLinkInterface.class); criteria.createAlias("node", "node", OnmsCriteria.LEFT_JOIN); criteria.add(Restrictions.eq("node.id", nodeId)); criteria.add(Restrictions.eq("nodeParentId", nodeParentId)); Collection<DataLinkInterface> dataLinkInterface = m_dataLinkDao.findMatching(criteria); if(dataLinkInterface.size() > 0){ DataLinkInterface dataLink = dataLinkInterface.iterator().next(); dataLink.setStatus(status); m_dataLinkDao.update(dataLink); m_dataLinkDao.flush(); } } }
DefaultNodeLinkService implements NodeLinkService, InitializingBean { @Transactional public void updateLinkStatus(int nodeParentId, int nodeId, String status) { OnmsCriteria criteria = new OnmsCriteria(DataLinkInterface.class); criteria.createAlias("node", "node", OnmsCriteria.LEFT_JOIN); criteria.add(Restrictions.eq("node.id", nodeId)); criteria.add(Restrictions.eq("nodeParentId", nodeParentId)); Collection<DataLinkInterface> dataLinkInterface = m_dataLinkDao.findMatching(criteria); if(dataLinkInterface.size() > 0){ DataLinkInterface dataLink = dataLinkInterface.iterator().next(); dataLink.setStatus(status); m_dataLinkDao.update(dataLink); m_dataLinkDao.flush(); } }  }
DefaultNodeLinkService implements NodeLinkService, InitializingBean { @Transactional public void updateLinkStatus(int nodeParentId, int nodeId, String status) { OnmsCriteria criteria = new OnmsCriteria(DataLinkInterface.class); criteria.createAlias("node", "node", OnmsCriteria.LEFT_JOIN); criteria.add(Restrictions.eq("node.id", nodeId)); criteria.add(Restrictions.eq("nodeParentId", nodeParentId)); Collection<DataLinkInterface> dataLinkInterface = m_dataLinkDao.findMatching(criteria); if(dataLinkInterface.size() > 0){ DataLinkInterface dataLink = dataLinkInterface.iterator().next(); dataLink.setStatus(status); m_dataLinkDao.update(dataLink); m_dataLinkDao.flush(); } }  @Override void afterPropertiesSet(); @Transactional void saveLinkState(OnmsLinkState state); @Transactional void createLink(final int nodeParentId, final int nodeId); @Transactional(readOnly=true) Integer getNodeId(String endPoint); @Transactional(readOnly=true) String getNodeLabel(int nodeId); @Transactional(readOnly=true) Collection<DataLinkInterface> getLinkContainingNodeId(int nodeId); @Transactional(readOnly=true) OnmsLinkState getLinkStateForInterface(DataLinkInterface dataLinkInterface); @Transactional void updateLinkStatus(int nodeParentId, int nodeId, String status); @Transactional(readOnly=true) String getPrimaryAddress(int nodeId); @Transactional(readOnly=true) boolean nodeHasEndPointService(int nodeId); @Transactional(readOnly=true) Boolean getEndPointStatus(int nodeId); }
DefaultNodeLinkService implements NodeLinkService, InitializingBean { @Transactional public void updateLinkStatus(int nodeParentId, int nodeId, String status) { OnmsCriteria criteria = new OnmsCriteria(DataLinkInterface.class); criteria.createAlias("node", "node", OnmsCriteria.LEFT_JOIN); criteria.add(Restrictions.eq("node.id", nodeId)); criteria.add(Restrictions.eq("nodeParentId", nodeParentId)); Collection<DataLinkInterface> dataLinkInterface = m_dataLinkDao.findMatching(criteria); if(dataLinkInterface.size() > 0){ DataLinkInterface dataLink = dataLinkInterface.iterator().next(); dataLink.setStatus(status); m_dataLinkDao.update(dataLink); m_dataLinkDao.flush(); } }  @Override void afterPropertiesSet(); @Transactional void saveLinkState(OnmsLinkState state); @Transactional void createLink(final int nodeParentId, final int nodeId); @Transactional(readOnly=true) Integer getNodeId(String endPoint); @Transactional(readOnly=true) String getNodeLabel(int nodeId); @Transactional(readOnly=true) Collection<DataLinkInterface> getLinkContainingNodeId(int nodeId); @Transactional(readOnly=true) OnmsLinkState getLinkStateForInterface(DataLinkInterface dataLinkInterface); @Transactional void updateLinkStatus(int nodeParentId, int nodeId, String status); @Transactional(readOnly=true) String getPrimaryAddress(int nodeId); @Transactional(readOnly=true) boolean nodeHasEndPointService(int nodeId); @Transactional(readOnly=true) Boolean getEndPointStatus(int nodeId);  }