Skip to content

Commit

Permalink
Added IpNetToMediaDao
Browse files Browse the repository at this point in the history
  • Loading branch information
rssntn67 committed May 21, 2014
1 parent f782cf5 commit f15498d
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 0 deletions.
@@ -0,0 +1,51 @@
/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2006-2012 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2012 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* OpenNMS(R) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <license@opennms.org>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/

package org.opennms.netmgt.dao.api;

import java.net.InetAddress;
import java.util.Date;
import java.util.List;

import org.opennms.netmgt.model.IpNetToMedia;





/**
* <p>IpNetToMediaDao interface.</p>
*/
public interface IpNetToMediaDao extends OnmsDao<IpNetToMedia, Integer> {

public List<IpNetToMedia> findBySourceNodeId(Integer id);

public IpNetToMedia getByNetAndPhysAddress(InetAddress netAddress, String physAddress);

void deleteBySourceNodeIdOlderThen(Integer nodeiId, Date now);
}
@@ -0,0 +1,66 @@
/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2006-2012 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2012 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* OpenNMS(R) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <license@opennms.org>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/

package org.opennms.netmgt.dao.hibernate;

import java.net.InetAddress;
import java.util.Date;
import java.util.List;

import org.opennms.netmgt.dao.api.IpNetToMediaDao;
import org.opennms.netmgt.model.IpNetToMedia;


public class IpNetToMediaDaoHibernate extends AbstractDaoHibernate<IpNetToMedia, Integer> implements IpNetToMediaDao {


public IpNetToMediaDaoHibernate() {
super(IpNetToMedia.class);
}

@Override
public List<IpNetToMedia> findBySourceNodeId(Integer id) {
return find("from IpNetToMedia rec where rec.sourceNode.id = ?",id);
}

@Override
public IpNetToMedia getByNetAndPhysAddress(InetAddress netAddress,
String physAddress) {
return findUnique("from IpNetToMedia rec.netAddress = ? and rec.physAddress = ?", netAddress, physAddress);
}

@Override
public void deleteBySourceNodeIdOlderThen(Integer nodeId, Date now) {
for (IpNetToMedia elem: find("from IpNetToMedia rec where rec.sourceNode.id = ? and reclastPollTime < ?",nodeId,now)) {
delete(elem);
}
}



}
Expand Up @@ -135,6 +135,12 @@

<onmsgi:service interface="org.opennms.netmgt.dao.api.IsIsElementDao" ref="isisElementDao" />

<bean id="ipNetToMediaDao" class="org.opennms.netmgt.dao.hibernate.IpNetToMediaDaoHibernate">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<onmsgi:service interface="org.opennms.netmgt.dao.api.IpNetToMediaDao" ref="ipNetToMediaDao" />

<bean id="bridgeMacLinkDao" class="org.opennms.netmgt.dao.hibernate.BridgeMacLinkDaoHibernate">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
Expand Down

0 comments on commit f15498d

Please sign in to comment.