org.opennms.web.map.db
Class DBManager
java.lang.Object
org.opennms.web.map.db.Manager
org.opennms.web.map.db.DBManager
public class DBManager
- extends Manager
- Author:
- maumig
The class manages maps stored on DB. It uses the constructor parameters
for the connection. If default constructor is called, it uses default OpenNMS db connector (Vault)
|
Method Summary |
int |
countMaps(int mapId)
|
void |
deleteElement(Element e)
|
void |
deleteElement(int id,
int mapid,
String type)
|
void |
deleteElements(Element[] elems)
|
void |
deleteElementsOfMap(int id)
|
int |
deleteMap(int id)
delete the map with id in input |
int |
deleteMap(Map m)
|
void |
deleteMapTypeElementsFromAllMaps()
|
void |
deleteNodeTypeElementsFromAllMaps()
|
void |
finalize()
|
VElementInfo[] |
getAllElementInfo()
|
Element[] |
getAllElements()
|
VMapInfo[] |
getAllMapMenus()
|
Map[] |
getAllMaps()
|
Map<Integer,Double> |
getAvails(Element[] mapElements)
|
Map[] |
getContainerMaps(int id,
String type)
|
Vector<Integer> |
getDeletedNodes()
gets a Vector containing the nodeids of all deleted nodes |
Element |
getElement(int id,
int mapId,
String type)
|
VElementInfo[] |
getElementInfoLike(String like)
|
Element[] |
getElementsLike(String elementLabel)
|
Element[] |
getElementsOfMap(int mapid)
|
Set<LinkInfo> |
getLinksOnElements(Set<Integer> allnodes)
|
Map |
getMap(int id)
|
Element[] |
getMapElementsOfMap(int mapid)
|
VMapInfo |
getMapMenu(int mapId)
|
Map[] |
getMaps(String mapname,
String maptype)
|
Map[] |
getMapsByName(String mapLabel)
|
Map[] |
getMapsLike(String mapLabel)
|
VMapInfo[] |
getMapsMenuByName(String mapLabel)
|
VMapInfo[] |
getMapsMenuByOwner(String owner)
|
Map<Integer,Set<Integer>> |
getMapsStructure()
get a java.util.Map (key=parentMapId, value=set of child maps) |
Element[] |
getNodeElementsOfMap(int mapid)
|
Set<Integer> |
getNodeIdsBySource(String query)
|
Set<Integer> |
getNodeidsOnElement(Element elem)
recursively gets all nodes contained by elem and its submaps (if elem is
a map) |
List<VElementInfo> |
getOutagedElements()
|
VMapInfo[] |
getVisibleMapsMenu(String user)
|
boolean |
isElementInMap(int elementId,
int mapId,
String type)
|
Element |
newElement(int id,
int mapId,
String type)
|
void |
saveElement(Element e)
|
void |
saveElements(Element[] e)
|
void |
saveMap(Map m)
|
void |
saveMaps(Map[] m)
|
DBManager
public DBManager()
throws MapsException
- Throws:
MapsException
DBManager
public DBManager(Map params)
throws MapsException
- Throws:
MapsException
finalize
public void finalize()
throws MapsException
- Overrides:
finalize in class Object
- Throws:
MapsException
saveMaps
public void saveMaps(Map[] m)
throws MapsException
- Specified by:
saveMaps in class Manager
- Throws:
MapsException
saveMap
public void saveMap(Map m)
throws MapsException
- Specified by:
saveMap in class Manager
- Throws:
MapsException
saveElements
public void saveElements(Element[] e)
throws MapsException
- Specified by:
saveElements in class Manager
- Throws:
MapsException
saveElement
public void saveElement(Element e)
throws MapsException
- Specified by:
saveElement in class Manager
- Throws:
MapsException
deleteElements
public void deleteElements(Element[] elems)
throws MapsException
- Specified by:
deleteElements in class Manager
- Throws:
MapsException
deleteElement
public void deleteElement(Element e)
throws MapsException
- Specified by:
deleteElement in class Manager
- Throws:
MapsException
deleteElement
public void deleteElement(int id,
int mapid,
String type)
throws MapsException
- Specified by:
deleteElement in class Manager
- Throws:
MapsException
deleteElementsOfMap
public void deleteElementsOfMap(int id)
throws MapsException
- Specified by:
deleteElementsOfMap in class Manager
- Throws:
MapsException
deleteMap
public int deleteMap(Map m)
throws MapsException
- Specified by:
deleteMap in class Manager
- Throws:
MapsException
deleteMap
public int deleteMap(int id)
throws MapsException
- Description copied from class:
Manager
- delete the map with id in input
- Specified by:
deleteMap in class Manager
- Returns:
- number of maps deleted
- Throws:
MapsException
deleteNodeTypeElementsFromAllMaps
public void deleteNodeTypeElementsFromAllMaps()
throws MapsException
- Specified by:
deleteNodeTypeElementsFromAllMaps in class Manager
- Throws:
MapsException
deleteMapTypeElementsFromAllMaps
public void deleteMapTypeElementsFromAllMaps()
throws MapsException
- Specified by:
deleteMapTypeElementsFromAllMaps in class Manager
- Throws:
MapsException
getElement
public Element getElement(int id,
int mapId,
String type)
throws MapsException
- Specified by:
getElement in class Manager
- Throws:
MapsException
newElement
public Element newElement(int id,
int mapId,
String type)
throws MapsException
- Specified by:
newElement in class Manager
- Throws:
MapsException
getAllElements
public Element[] getAllElements()
throws MapsException
- Specified by:
getAllElements in class Manager
- Throws:
MapsException
getElementsOfMap
public Element[] getElementsOfMap(int mapid)
throws MapsException
- Specified by:
getElementsOfMap in class Manager
- Throws:
MapsException
getNodeElementsOfMap
public Element[] getNodeElementsOfMap(int mapid)
throws MapsException
- Specified by:
getNodeElementsOfMap in class Manager
- Throws:
MapsException
getMapElementsOfMap
public Element[] getMapElementsOfMap(int mapid)
throws MapsException
- Specified by:
getMapElementsOfMap in class Manager
- Throws:
MapsException
getElementsLike
public Element[] getElementsLike(String elementLabel)
throws MapsException
- Specified by:
getElementsLike in class Manager
- Throws:
MapsException
getMapsStructure
public Map<Integer,Set<Integer>> getMapsStructure()
throws MapsException
- Description copied from class:
Manager
- get a java.util.Map (key=parentMapId, value=set of child maps)
- Specified by:
getMapsStructure in class Manager
- Returns:
- java.util.Map (key=parentMapId, value=set of child maps)
- Throws:
MapsException
countMaps
public int countMaps(int mapId)
throws MapsException
- Specified by:
countMaps in class Manager
- Throws:
MapsException
getMap
public Map getMap(int id)
throws MapsException
- Specified by:
getMap in class Manager
- Throws:
MapsException
getMaps
public Map[] getMaps(String mapname,
String maptype)
throws MapsException
- Specified by:
getMaps in class Manager
- Throws:
MapsException
getAllMaps
public Map[] getAllMaps()
throws MapsException
- Specified by:
getAllMaps in class Manager
- Throws:
MapsException
getMapsLike
public Map[] getMapsLike(String mapLabel)
throws MapsException
- Specified by:
getMapsLike in class Manager
- Throws:
MapsException
getMapsByName
public Map[] getMapsByName(String mapLabel)
throws MapsException
- Specified by:
getMapsByName in class Manager
- Throws:
MapsException
getContainerMaps
public Map[] getContainerMaps(int id,
String type)
throws MapsException
- Specified by:
getContainerMaps in class Manager
- Throws:
MapsException
getAllMapMenus
public VMapInfo[] getAllMapMenus()
throws MapsException
- Specified by:
getAllMapMenus in class Manager
- Throws:
MapsException
getMapMenu
public VMapInfo getMapMenu(int mapId)
throws MapsException
- Specified by:
getMapMenu in class Manager
- Throws:
MapsException
getMapsMenuByName
public VMapInfo[] getMapsMenuByName(String mapLabel)
throws MapsException
- Specified by:
getMapsMenuByName in class Manager
- Throws:
MapsException
getMapsMenuByOwner
public VMapInfo[] getMapsMenuByOwner(String owner)
throws MapsException
- Specified by:
getMapsMenuByOwner in class Manager
- Throws:
MapsException
isElementInMap
public boolean isElementInMap(int elementId,
int mapId,
String type)
throws MapsException
- Specified by:
isElementInMap in class Manager
- Throws:
MapsException
getAllElementInfo
public VElementInfo[] getAllElementInfo()
throws MapsException
- Specified by:
getAllElementInfo in class Manager
- Throws:
MapsException
getElementInfoLike
public VElementInfo[] getElementInfoLike(String like)
throws MapsException
- Specified by:
getElementInfoLike in class Manager
- Throws:
MapsException
getOutagedElements
public List<VElementInfo> getOutagedElements()
throws MapsException
- Specified by:
getOutagedElements in class Manager
- Throws:
MapsException
getAvails
public Map<Integer,Double> getAvails(Element[] mapElements)
throws MapsException
- Specified by:
getAvails in class Manager
- Throws:
MapsException
getDeletedNodes
public Vector<Integer> getDeletedNodes()
throws MapsException
- gets a Vector containing the nodeids of all deleted nodes
- Specified by:
getDeletedNodes in class Manager
- Returns:
- Vector of Integer containing all deleted nodes' ids
- Throws:
MapsException
getNodeidsOnElement
public Set<Integer> getNodeidsOnElement(Element elem)
throws MapsException
- recursively gets all nodes contained by elem and its submaps (if elem is
a map)
- Specified by:
getNodeidsOnElement in class Manager
- Throws:
MapsException
getLinksOnElements
public Set<LinkInfo> getLinksOnElements(Set<Integer> allnodes)
throws MapsException
- Specified by:
getLinksOnElements in class Manager
- Throws:
MapsException
getVisibleMapsMenu
public VMapInfo[] getVisibleMapsMenu(String user)
throws MapsException
- Specified by:
getVisibleMapsMenu in class Manager
- Throws:
MapsException
getNodeIdsBySource
public Set<Integer> getNodeIdsBySource(String query)
throws MapsException
- Specified by:
getNodeIdsBySource in class Manager
- Throws:
MapsException
Copyright ? 2007. All Rights Reserved.