org.opennms.web.map.db
Class ManagerDefaultImpl

java.lang.Object
  extended by org.opennms.web.map.db.ManagerDefaultImpl
All Implemented Interfaces:
Manager

public class ManagerDefaultImpl
extends Object
implements Manager

ManagerDefaultImpl class.

Since:
1.8.1
Version:
$Id: $
Author:
maurizio, Antonio Russo

Constructor Summary
ManagerDefaultImpl()
          Manage Maps using default implementation of Factory and Manager
 
Method Summary
 VMap addElements(VMap map, List<VElement> velems)
          addElements
 boolean checkCommandExecution()
           
 void clearMap()
          clearMap
 void closeMap()
          closeMap
 void deleteAllMapElements()
          delete all defined sub maps in existent maps
 void deleteAllNodeElements()
          delete all defined node elements in existent maps
 void deleteMap()
          deleteMap
 void deleteMap(int mapId)
          delete the map with identifier id
 void deleteMap(VMap map)
          delete the map in input
 void deleteMaps(int[] maps)
          delete the maps with the identifiers in input
 void deleteMaps(VMap[] maps)
          delete the maps in input
 String execCommand(Command command)
           ExecCommand
 boolean foundLoopOnMaps(VMap parentMap, int mapId)
          foundLoopOnMaps
 VMapInfo[] getAllMapMenus()
          Get all defined maps.
 VMap[] getAllMaps(boolean refreshElems)
          Get all defined maps.
 Command getCommand(String id)
           
 Manager getDataAccessManager()
          getDataAccessManager
 DataSourceInterface getDataSource()
          Getter for the field dataSource.
 Manager getDbManager()
          Getter for the field dbManager.
 VMapInfo getDefaultMapsMenu(String user)
          get the default map for specified user in input if exists null otherwise
 List<VElementInfo> getElementInfo()
          getElementInfo
 String getFilter()
          Getter for the field filter.
 GroupDao getGroupDao()
          getGroupDao
 VMapInfo getMapMenu(int mapId)
          getMapMenu
 VMap[] getMapsByName(String mapName, boolean refreshElems)
          Take the maps with name in input and return them in VMap[] form.
 VMap[] getMapsLike(String likeLabel, boolean refreshElems)
          Take the maps with label like the pattern in input and return them in VMap[] form.
 VMapInfo[] getMapsMenuByName(String mapName)
          Take the maps with name in input and return them in MapMenu[] form.
 List<VMapInfo> getMapsMenuTreeByName(String mapName)
          Take all the maps in the tree of maps considering the with name in input as the root of the tree.
 MapPropertiesFactory getMapsPropertiesFactory()
          Getter for the field mapsPropertiesFactory.
 Set<Integer> getNodeidsOnElement(VElement velem)
          recursively gets all nodes contained by elem and its submaps (if elem is a map)
 Map<String,Set<Integer>> getNodeLabelToMaps(String user)
          Get a Map of nodelabel to the container mapids.
 VProperties getProperties(boolean isUserAdmin)
          getProperties
 List<VMapInfo> getVisibleMapsMenu(String user)
          gets all visible maps for user in input
 VElement newElement(int mapId, int elementId, String type)
          Create a new (not child) empty Submap with the identifier setted to id.
 VElement newElement(int mapId, int elementId, String type, int x, int y)
          Create a new VElement with the identifier setted to id.
 VElement newElement(int mapId, int elementId, String type, String iconname)
          Create a new (not child) empty Submap with the identifier setted to id.
 VElement newElement(int mapId, int elementId, String type, String iconname, int x, int y)
          Create a new (not child) empty Submap with the identifier setted to id.
 VElement newElement(int elementId, String type, int x, int y)
          newElement
 VMap newMap(String owner, String userModifies, int width, int height)
          Create a new VMap and return it
 VMap openMap()
          openMap
 VMap openMap(int id, boolean refreshElems)
          Take the map with id in input and return it in VMap form.
 VMap openMap(int id, String user, boolean refreshElems)
          Take the map with id in input and return it in VMap form.
 VMap refreshMap(VMap map)
          refreshMap
 void reloadConfig()
          reloadConfig
 VMap reloadMap(VMap map)
          Refreshs avail,severity and status of the map in input and its elements
 void removeCommand(String id)
           
 int save(VMap map)
          save the map in input
 VMap searchMap(String owner, String userModifies, int width, int height, List<VElement> elems)
          searchMap
 void setDataSource(DataSourceInterface dataSource)
          Setter for the field dataSource.
 void setDbManager(Manager dbManager)
          Setter for the field dbManager.
 void setFilter(String filter)
          Setter for the field filter.
 void setGroupDao(GroupDao groupDao)
          setGroupDao
 void setMapsPropertiesFactory(MapPropertiesFactory mapsPropertiesFactory)
          Setter for the field mapsPropertiesFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagerDefaultImpl

public ManagerDefaultImpl()
                   throws MapsException
Manage Maps using default implementation of Factory and Manager

Throws:
MapsException - if any.
Method Detail

getFilter

public String getFilter()

Getter for the field filter.

Returns:
a String object.

setFilter

public void setFilter(String filter)

Setter for the field filter.

Parameters:
filter - a String object.

getDataSource

public DataSourceInterface getDataSource()

Getter for the field dataSource.

Returns:
a DataSourceInterface object.

setDataSource

public void setDataSource(DataSourceInterface dataSource)

Setter for the field dataSource.

Parameters:
dataSource - a DataSourceInterface object.

getDbManager

public Manager getDbManager()

Getter for the field dbManager.

Returns:
a Manager object.

setDbManager

public void setDbManager(Manager dbManager)

Setter for the field dbManager.

Parameters:
dbManager - a Manager object.

getMapsPropertiesFactory

public MapPropertiesFactory getMapsPropertiesFactory()

Getter for the field mapsPropertiesFactory.

Returns:
a org$opennms$web$map$config$MapPropertiesFactory object.

setMapsPropertiesFactory

public void setMapsPropertiesFactory(MapPropertiesFactory mapsPropertiesFactory)

Setter for the field mapsPropertiesFactory.

Parameters:
mapsPropertiesFactory - a org$opennms$web$map$config$MapPropertiesFactory object.

openMap

public VMap openMap()
             throws MapNotFoundException

openMap

Specified by:
openMap in interface Manager
Returns:
a VMap object.
Throws:
MapNotFoundException - if any.

clearMap

public void clearMap()
              throws MapNotFoundException,
                     MapsException

clearMap

Specified by:
clearMap in interface Manager
Throws:
MapNotFoundException - if any.
MapsException - if any.

deleteMap

public void deleteMap()
               throws MapNotFoundException,
                      MapsException

deleteMap

Specified by:
deleteMap in interface Manager
Throws:
MapNotFoundException - if any.
MapsException - if any.

closeMap

public void closeMap()

closeMap

Specified by:
closeMap in interface Manager

openMap

public VMap openMap(int id,
                    String user,
                    boolean refreshElems)
             throws MapsManagementException,
                    MapNotFoundException,
                    MapsException
Take the map with id in input and return it in VMap form.

Specified by:
openMap in interface Manager
Parameters:
id - a int.
user - a String object.
refreshElems - says if refresh the map's elements
Returns:
the VMap with identifier id
Throws:
MapNotFoundException - if any.
MapsException - if any.
MapsManagementException

newMap

public VMap newMap(String owner,
                   String userModifies,
                   int width,
                   int height)
Create a new VMap and return it Create a new VMap and return it

Specified by:
newMap in interface Manager
Parameters:
owner - a String object.
userModifies - a String object.
width - a int.
height - a int.
Returns:
the new VMap

openMap

public VMap openMap(int id,
                    boolean refreshElems)
             throws MapsManagementException,
                    MapNotFoundException,
                    MapsException
Take the map with id in input and return it in VMap form.

Parameters:
id - a int.
refreshElems - says if refresh the map's elements
Returns:
the VMap with identifier id
Throws:
MapsException - if any.
MapsManagementException - if any.
MapNotFoundException - if any.

getMapMenu

public VMapInfo getMapMenu(int mapId)
                    throws MapNotFoundException,
                           MapsException

getMapMenu

Parameters:
mapId - a int.
Returns:
a VMapInfo object.
Throws:
MapNotFoundException - if any.
MapsException - if any.

getMapsLike

public VMap[] getMapsLike(String likeLabel,
                          boolean refreshElems)
                   throws MapsException
Take the maps with label like the pattern in input and return them in VMap[] form.

Parameters:
refreshElems - says if refresh map's elements
likeLabel - a String object.
Returns:
the VMaps array if any label matches the pattern in input, null otherwise
Throws:
MapsException - if any.

getMapsByName

public VMap[] getMapsByName(String mapName,
                            boolean refreshElems)
                     throws MapNotFoundException,
                            MapsException
Take the maps with name in input and return them in VMap[] form.

Parameters:
mapName - a String object.
refreshElems - a boolean.
Returns:
the VMaps array if any map has name in input, null otherwise
Throws:
MapsException - if any.
MapNotFoundException - if any.

getAllMaps

public VMap[] getAllMaps(boolean refreshElems)
                  throws MapNotFoundException,
                         MapsException
Get all defined maps.

Parameters:
refreshElems - says if refresh maps' elements
Returns:
the VMaps array containing all maps defined
Throws:
MapsException - if any.
MapNotFoundException - if any.

getAllMapMenus

public VMapInfo[] getAllMapMenus()
                          throws MapsException
Get all defined maps.

Returns:
the MapMenu array containing all maps defined
Throws:
MapsException - if any.

getMapsMenuByName

public VMapInfo[] getMapsMenuByName(String mapName)
                             throws MapNotFoundException,
                                    MapsException
Take the maps with name in input and return them in MapMenu[] form.

Parameters:
mapName - a String object.
Returns:
the MapMenu array if any map has name in input, null otherwise
Throws:
MapsException - if any.
MapNotFoundException - if any.

getDefaultMapsMenu

public VMapInfo getDefaultMapsMenu(String user)
                            throws MapsException
get the default map for specified user in input if exists null otherwise

Specified by:
getDefaultMapsMenu in interface Manager
Parameters:
user - a String object.
Returns:
a MapMenu object.
Throws:
MapsException - if any.

getVisibleMapsMenu

public List<VMapInfo> getVisibleMapsMenu(String user)
                                  throws MapsException
gets all visible maps for user in input gets all visible maps for user and userRole in input

Specified by:
getVisibleMapsMenu in interface Manager
Parameters:
user - a String object.
Returns:
a List of MapMenu objects.
Throws:
MapsException - if any.

getMapsMenuTreeByName

public List<VMapInfo> getMapsMenuTreeByName(String mapName)
                                     throws MapNotFoundException,
                                            MapsException
Take all the maps in the tree of maps considering the with name in input as the root of the tree. If there are more maps with mapName (case insensitive) all trees with these maps as root are considered and returned.

Parameters:
mapName - a String object.
Returns:
a List with the MapMenu objects.
Throws:
MapsException - if any.
MapNotFoundException - if any.

newElement

public VElement newElement(int mapId,
                           int elementId,
                           String type,
                           int x,
                           int y)
                    throws MapsException
Create a new VElement with the identifier setted to id.

Parameters:
mapId - a int.
elementId - a int.
type - the node type
x - a int.
y - a int.
Returns:
the new VElement
Throws:
MapsException - if any.

newElement

public VElement newElement(int elementId,
                           String type,
                           int x,
                           int y)
                    throws MapsException

newElement

Parameters:
elementId - a int.
type - a String object.
x - a int.
y - a int.
Returns:
a VElement object.
Throws:
MapsException - if any.

newElement

public VElement newElement(int mapId,
                           int elementId,
                           String type)
                    throws MapsException
Create a new (not child) empty Submap with the identifier setted to id. Create a new element child of the map with mapId (this map must be the sessionMap)

Specified by:
newElement in interface Manager
Parameters:
mapId - a int.
elementId - a int.
type - the node type
Returns:
a VElement object.
Throws:
MapsException - if any.

newElement

public VElement newElement(int mapId,
                           int elementId,
                           String type,
                           String iconname,
                           int x,
                           int y)
                    throws MapsException
Create a new (not child) empty Submap with the identifier setted to id. Create a new element child of the map with mapId (this map must be the sessionMap).

Specified by:
newElement in interface Manager
Parameters:
mapId - a int.
elementId - a int.
type - the node type
iconname - a String object.
x - position on the x axis
y - position on the y axis
Returns:
the new VElement
Throws:
MapsException - if any.

newElement

public VElement newElement(int mapId,
                           int elementId,
                           String type,
                           String iconname)
                    throws MapsException
Create a new (not child) empty Submap with the identifier setted to id.

Parameters:
mapId - a int.
elementId - a int.
type - the node type
iconname - a String object.
Returns:
the new VElement
Throws:
MapsException - if any.

deleteMap

public void deleteMap(VMap map)
               throws MapsException,
                      MapNotFoundException
delete the map in input

Parameters:
map - to delete
Throws:
MapsException - if an error occour deleting map, MapNotFoundException if the map to delete doesn't exist.
MapNotFoundException - if any.

deleteMap

public void deleteMap(int mapId)
               throws MapsException
delete the map with identifier id

Parameters:
mapId - a int.
Throws:
MapsException - if any.

deleteMaps

public void deleteMaps(VMap[] maps)
                throws MapsException
delete the maps in input

Parameters:
maps - to delete
Throws:
MapsException - if any.

deleteMaps

public void deleteMaps(int[] maps)
                throws MapsException
delete the maps with the identifiers in input

Parameters:
maps - an array of int.
Throws:
MapsException - if any.

save

public int save(VMap map)
         throws MapsException
save the map in input save the map in input

Specified by:
save in interface Manager
Parameters:
map - to save
Returns:
a int.
Throws:
MapsException - if any.

deleteAllNodeElements

public void deleteAllNodeElements()
                           throws MapsException
delete all defined node elements in existent maps

Throws:
MapsException - if any.

deleteAllMapElements

public void deleteAllMapElements()
                          throws MapsException
delete all defined sub maps in existent maps

Throws:
MapsException - if any.

reloadMap

public VMap reloadMap(VMap map)
               throws MapsException
Refreshs avail,severity and status of the map in input and its elements Reloads elements of map and theirs avail,severity and status

Specified by:
reloadMap in interface Manager
Parameters:
map - a VMap object.
Returns:
the map refreshed
Throws:
MapsException - if any.

refreshMap

public VMap refreshMap(VMap map)
                throws MapsException

refreshMap

Specified by:
refreshMap in interface Manager
Parameters:
map - a VMap object.
Returns:
a VMap object.
Throws:
MapsException - if any.

foundLoopOnMaps

public boolean foundLoopOnMaps(VMap parentMap,
                               int mapId)
                        throws MapsException

foundLoopOnMaps

Specified by:
foundLoopOnMaps in interface Manager
Parameters:
parentMap - a VMap object.
mapId - a int.
Returns:
a boolean.
Throws:
MapsException - if any.

getNodeidsOnElement

public Set<Integer> getNodeidsOnElement(VElement velem)
                                 throws MapsException
recursively gets all nodes contained by elem and its submaps (if elem is a map)

Parameters:
velem - a VElement object.
Returns:
a Set object.
Throws:
MapsException - if any.

getElementInfo

public List<VElementInfo> getElementInfo()
                                  throws MapsException

getElementInfo

Specified by:
getElementInfo in interface Manager
Returns:
a List object.
Throws:
MapsException - if any.

getDataAccessManager

public Manager getDataAccessManager()

getDataAccessManager

Returns:
a Manager object.

getGroupDao

public GroupDao getGroupDao()

getGroupDao

Returns:
a GroupDao object.

setGroupDao

public void setGroupDao(GroupDao groupDao)

setGroupDao

Parameters:
groupDao - a GroupDao object.

searchMap

public VMap searchMap(String owner,
                      String userModifies,
                      int width,
                      int height,
                      List<VElement> elems)
               throws MapsException

searchMap

Specified by:
searchMap in interface Manager
Parameters:
owner - a String object.
userModifies - a String object.
width - a int.
height - a int.
elems - a List object.
Returns:
a VMap object.
Throws:
MapsException - if any.

getNodeLabelToMaps

public Map<String,Set<Integer>> getNodeLabelToMaps(String user)
                                            throws MapsException
Get a Map of nodelabel to the container mapids.

Specified by:
getNodeLabelToMaps in interface Manager
Parameters:
user - a String object.
Returns:
a java$util$Map object.
Throws:
MapsException - if any.

getProperties

public VProperties getProperties(boolean isUserAdmin)
                          throws MapsException

getProperties

Specified by:
getProperties in interface Manager
Parameters:
isUserAdmin - a boolean.
Returns:
a VProperties object.
Throws:
MapsException - if any.

addElements

public VMap addElements(VMap map,
                        List<VElement> velems)
                 throws MapsException

addElements

Specified by:
addElements in interface Manager
Parameters:
map - a VMap object.
velems - a List object.
Returns:
a VMap object.
Throws:
MapsException - if any.

reloadConfig

public void reloadConfig()
                  throws MapsException

reloadConfig

Specified by:
reloadConfig in interface Manager
Throws:
MapsException - if any.

execCommand

public String execCommand(Command command)
Description copied from interface: Manager

ExecCommand

Specified by:
execCommand in interface Manager

getCommand

public Command getCommand(String id)
Specified by:
getCommand in interface Manager

removeCommand

public void removeCommand(String id)
Specified by:
removeCommand in interface Manager

checkCommandExecution

public boolean checkCommandExecution()
Specified by:
checkCommandExecution in interface Manager


Copyright © 2011. All Rights Reserved.