Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
opennms-dao-api/src/main/java/org/opennms/netmgt/dao/api/IpNetToMediaDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
66 changes: 66 additions & 0 deletions
66
opennms-dao/src/main/java/org/opennms/netmgt/dao/hibernate/IpNetToMediaDaoHibernate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters