org.opennms.web.map.view
Class Manager

java.lang.Object
  extended by org.opennms.web.map.view.Manager

public class Manager
extends java.lang.Object

Author:
maurizio

Constructor Summary
Manager()
          Manage Maps using default implementation of Factory and Manager
Manager(MapsFactory mFactory)
          Create a new Manager using the Maps Factory in input.
Manager(java.lang.String mapsFactoryLabel)
          Create a new Manager using the Maps Factory with label in input.
 
Method Summary
 void deleteAllMapElements()
          delete all defined sub maps in existent maps
 void deleteAllNodeElements()
          delete all defined node elements in existent maps
 void deleteElementsOfMap(int mapId)
           
 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
 void endSession()
          Close the block open by startSession() method.
 boolean foundLoopOnMaps(VMap parentMap, int mapId)
           
 ElementInfo[] getAllElementInfo()
           
 MapMenu[] getAllMapMenus()
          Get all defined maps.
 VMap[] getAllMaps(boolean refreshElems)
          Get all defined maps.
 Manager getDataAccessManager()
           
 java.util.List getLinks(VElement[] elems)
           
 java.util.List getLinksOnElem(VElement[] elems, VElement elem)
           
 VMap getMap(int id, boolean refreshElems)
          Take the map with id in input and return it in VMap form.
 VMap[] getMap(java.lang.String mapname, java.lang.String maptype, boolean refreshElems)
          Take the map label and type in input and return it in VMap form.
 MapMenu getMapMenu(int mapId)
           
 VMap[] getMapsByName(java.lang.String mapName, boolean refreshElems)
          Take the maps with name in input and return them in VMap[] form.
 MapsFactory getMapsFactory()
          gets the using Maps Factory
 VMap[] getMapsLike(java.lang.String likeLabel, boolean refreshElems)
          Take the maps with label like the pattern in input and return them in VMap[] form.
 MapMenu[] getMapsMenuByName(java.lang.String mapName)
          Take the maps with name in input and return them in MapMenu[] form.
 java.util.List getMapsMenuTreeByName(java.lang.String mapName)
          Take all the maps in the tree of maps considering the with name in input as the root of the tree.
 java.util.List<MapMenu> getVisibleMapsMenu(java.lang.String user, java.lang.String userRole)
          gets all visible maps for user and userRole in input
 VElement newElement(int mapId, int elementId, java.lang.String type)
          Create a new (not child) empty Submap with the identifier setted to id.
 VElement newElement(int mapId, int elementId, java.lang.String type, int x, int y)
          Create a new (not child) empty Submap with the identifier setted to id.
 VElement newElement(int mapId, int elementId, java.lang.String type, java.lang.String iconname)
          Create a new (not child) empty Submap with the identifier setted to id.
 VElement newElement(int mapId, int elementId, java.lang.String type, java.lang.String iconname, int x, int y)
          Create a new (not child) empty Submap with the identifier setted to id.
 VMap newMap()
          Create a new empty VMap and return it.
 VMap newMap(java.lang.String name, java.lang.String accessMode, java.lang.String owner, java.lang.String userModifies, int width, int height)
          Create a new VMap and return it
 java.util.List refreshElements(VElement[] mapElements)
          Refreshes of avail,severity and status of the elements in input.
 java.util.List refreshLinks(VLink[] mapLinks)
          TODO write this method simil way to refreshElement Not Yet Implemented
 VMap reloadMap(VMap map)
          Refreshs avail,severity and status of the map in input and its elements
 void save(VMap map)
          save the map in input
 void save(VMap[] maps)
          save the maps in input
 void startSession()
          Start the session: only operations made in the block between start and end session will be saved correctly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Manager

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

Throws:
MapsException

Manager

public Manager(java.lang.String mapsFactoryLabel)
        throws MapsException
Create a new Manager using the Maps Factory with label in input. If mapsFactoryLabel is null, default factory is used

Parameters:
mapsFactoryLabel -
Throws:
MapsException

Manager

public Manager(MapsFactory mFactory)
        throws MapsException
Create a new Manager using the Maps Factory in input. If mFactory is null, default factory is used

Parameters:
mFactory -
Throws:
MapsException
Method Detail

getMapsFactory

public MapsFactory getMapsFactory()
gets the using Maps Factory

Returns:

startSession

public void startSession()
                  throws MapsException
Start the session: only operations made in the block between start and end session will be saved correctly.

Throws:
MapsException
See Also:
endSession

endSession

public void endSession()
                throws MapsException
Close the block open by startSession() method.

Throws:
MapsException
See Also:
startSession()

newMap

public VMap newMap()
Create a new empty VMap and return it.

Returns:
the new VMap created.

newMap

public VMap newMap(java.lang.String name,
                   java.lang.String accessMode,
                   java.lang.String owner,
                   java.lang.String userModifies,
                   int width,
                   int height)
Create a new VMap and return it

Parameters:
name -
accessMode -
owner -
userModifies -
width -
height -
Returns:
the new VMap

getMap

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

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

deleteElementsOfMap

public void deleteElementsOfMap(int mapId)
                         throws MapsException
Throws:
MapsException

getMap

public VMap[] getMap(java.lang.String mapname,
                     java.lang.String maptype,
                     boolean refreshElems)
              throws MapsManagementException,
                     MapNotFoundException,
                     MapsException
Take the map label and type in input and return it in VMap form.

Parameters:
mapname -
maptype -
refreshElems - says if refresh map's elements
Returns:
the VMap[] with corresponding mapname and maptype
Throws:
MapsException
MapsManagementException
MapNotFoundException

getMapMenu

public MapMenu getMapMenu(int mapId)
                   throws MapNotFoundException,
                          MapsException
Throws:
MapNotFoundException
MapsException

getLinks

public java.util.List getLinks(VElement[] elems)
                        throws MapsException
Throws:
MapsException

getLinksOnElem

public java.util.List getLinksOnElem(VElement[] elems,
                                     VElement elem)
                              throws MapsException
Throws:
MapsException

getMapsLike

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

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

getMapsByName

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

Parameters:
mapName -
refhresElems - says if refresh maps' elements
Returns:
the VMaps array if any map has name in input, null otherwise
Throws:
MapsException
MapNotFoundException

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
MapNotFoundException

getAllMapMenus

public MapMenu[] getAllMapMenus()
                         throws MapNotFoundException,
                                MapsException
Get all defined maps.

Returns:
the MapMenu array containing all maps defined
Throws:
MapsException
MapNotFoundException

getMapsMenuByName

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

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

getVisibleMapsMenu

public java.util.List<MapMenu> getVisibleMapsMenu(java.lang.String user,
                                                  java.lang.String userRole)
                                           throws MapsException
gets all visible maps for user and userRole in input

Parameters:
user -
userRole -
Returns:
a List of MapMenu objects.
Throws:
MapsException

getMapsMenuTreeByName

public java.util.List getMapsMenuTreeByName(java.lang.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 -
Returns:
a List with the MapMenu objects.
Throws:
MapsException
MapNotFoundException

newElement

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

Parameters:
mapId -
elementId -
type - the node type
Returns:
the new VElement
Throws:
MapsException

newElement

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

Parameters:
mapId -
elementId -
type - the node type
Returns:
the new VElement
Throws:
MapsException

newElement

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

Parameters:
mapId -
elementId -
type - the node type
Returns:
the new VElement
Throws:
MapsException

newElement

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

Parameters:
mapId -
elementId -
type - the node type
Returns:
the new VElement
Throws:
MapsException

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

deleteMap

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

Parameters:
id - of the map to delete
Throws:
MapsException

deleteMaps

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

Parameters:
maps - to delete
Throws:
MapsException

deleteMaps

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

Parameters:
identifiers - of the maps to delete
Throws:
MapsException

save

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

Parameters:
map - to save
Throws:
MapsException

save

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

Parameters:
maps - to save
Throws:
MapsException

deleteAllNodeElements

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

Throws:
MapsException

deleteAllMapElements

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

Throws:
MapsException

refreshElements

public java.util.List refreshElements(VElement[] mapElements)
                               throws MapsException
Refreshes of avail,severity and status of the elements in input. The refresh is performed as follows: - default factory is used if no others defined; - if in the using factory is defined a source, the system will use this one else, the system will use default source (OpenNMS)

Parameters:
mapElements - the elements to refresh
incremental - return only changed elements, if the refresh implementation is capable of this operation
Returns:
List of VElement
Throws:
MapsException

reloadMap

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

Parameters:
map -
Returns:
the map refreshed
Throws:
MapsException

refreshLinks

public java.util.List refreshLinks(VLink[] mapLinks)
TODO write this method simil way to refreshElement Not Yet Implemented


foundLoopOnMaps

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

getAllElementInfo

public ElementInfo[] getAllElementInfo()
                                throws MapsException
Throws:
MapsException

getDataAccessManager

public Manager getDataAccessManager()


Copyright © 2007. All Rights Reserved.