"WEBNMS_5 API Docs"

com.adventnet.nms.util
Class GenericUtility

java.lang.Object
  extended by com.adventnet.nms.util.GenericUtility

public class GenericUtility
extends java.lang.Object

Used by many files to access comman methods and static variables .


Field Summary
static long dateDiff
           
static java.util.Random generator
          Used as generator of random numbers for use in HTML UI.
static java.util.Hashtable KeyForCvcVSloginTime
          Used to store login time.
static java.text.SimpleDateFormat NmsFormatter
          returns the dataFormat of Web NMS
static int offset
          Stores the Offset of the time zone.
static java.lang.String seperator
          Used as line seperator.
static java.lang.String unAuthorizedString
          Contains the error message.
 
Constructor Summary
GenericUtility()
           
 
Method Summary
static java.util.Vector cleanUp(java.util.Hashtable ht)
          This is used for cleanup of Custom Views Vector during regular period of time ("1800000" in long).
static java.lang.String dateString(long date)
          Used to get the user readable String format of the given date in long.
static java.lang.String encode(java.lang.String name)
          To replace all spaces in a string with %20 - used for encoding the URL names with space in between
static java.lang.String formatDate(java.util.Date date, java.text.SimpleDateFormat dateFormat)
          formats the date which is read from ClientParameters.conf.
static java.lang.String formatDate(long time, java.text.SimpleDateFormat dateFormat)
          formats the date which is read from ClientParameters.conf.
static AlertAPI getAlertAPI()
          This gets the AlertAPI for use by jspdata and servlets.
static java.awt.Color getColor(java.lang.String col)
          Used for setting colors based on severity.
static java.text.DateFormat getDateFormat(java.lang.String userName)
          To get the date format with timezone set.The timezone to be used is read from the clientparameters.conf file
static EventAPI getEventAPI()
          This gets the EventAPI for use by jspdata and servlets.
static java.lang.String getFilePath(java.lang.String menuName, java.lang.String userName)
          Used to get the absolute URL
static java.lang.String getHelpURL(java.lang.String key)
          Returns the help URL when the key is given.
static java.lang.String getHtmlColor(java.awt.Color col)
          Used to get the HTML string equivalent of the given Color object.
static MapAPI getMapAPI()
          This gets the MapAPI for use by jspdata and servlets.
static java.util.Vector getOperationsForUser(java.lang.String userName)
          This method is used to get a List of operations authorized for this specified user name.
static long getParsedTime(java.util.Date dt)
          getParsedTime:To parse a date string and returns the number of milliseconds
static PollAPI getPollAPI()
          This gets the PollAPI for use by jspdata and servlets.
static java.lang.String getStatusColor(int sev)
          need to deprecate this method.
static TopoAPI getTopoAPI()
          This gets the TopoAPI for use by jspdata and servlets .
static boolean isAuthorized_userName(java.lang.String userName, java.lang.String dn)
          To check if the given userName is an authorized userName.
static boolean isAuthorized(java.lang.String userName, java.lang.String operation)
          Used to check whether the given user is authorized to perform the specified operation
static boolean isAuthorized(java.lang.String userName, java.lang.String operation, boolean log)
           
static boolean isAuthorized(java.lang.String userName, java.lang.String operation, java.util.Properties auditProp)
           
static boolean isAuthorized(java.lang.String userName, java.lang.String operation, java.util.Properties auditProp, boolean log)
           
static java.util.Date parseDate(java.lang.String str)
          Deprecated. use formatDate(long time,SimpleDateFormat dateFormat) instead.
static java.util.Hashtable populateIncrementsVector(java.lang.String userName)
          Used to provide the Hashtable containing the incrementation values from conf file for a given user.
static java.lang.String replace(java.lang.String s, java.lang.String tok, java.lang.String c)
          To replace a particular string with a character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NmsFormatter

public static java.text.SimpleDateFormat NmsFormatter
returns the dataFormat of Web NMS


offset

public static int offset
Stores the Offset of the time zone.


dateDiff

public static long dateDiff

unAuthorizedString

public static final java.lang.String unAuthorizedString
Contains the error message.

See Also:
Constant Field Values

seperator

public static final java.lang.String seperator
Used as line seperator.

See Also:
Constant Field Values

KeyForCvcVSloginTime

public static java.util.Hashtable KeyForCvcVSloginTime
Used to store login time.


generator

public static java.util.Random generator
Used as generator of random numbers for use in HTML UI.

Constructor Detail

GenericUtility

public GenericUtility()
Method Detail

getTopoAPI

public static TopoAPI getTopoAPI()
This gets the TopoAPI for use by jspdata and servlets .

Returns:
TopoAPI object

getEventAPI

public static EventAPI getEventAPI()
This gets the EventAPI for use by jspdata and servlets.

Returns:
EventAPI object.

getAlertAPI

public static AlertAPI getAlertAPI()
This gets the AlertAPI for use by jspdata and servlets.

Returns:
AlertAPI object.

getMapAPI

public static MapAPI getMapAPI()
This gets the MapAPI for use by jspdata and servlets.

Returns:
MapAPI object.

getPollAPI

public static PollAPI getPollAPI()
This gets the PollAPI for use by jspdata and servlets.

Returns:
PollAPI object.

getColor

public static java.awt.Color getColor(java.lang.String col)
Used for setting colors based on severity.

Parameters:
col - The string representing the color.
Returns:
Color object.

getHtmlColor

public static java.lang.String getHtmlColor(java.awt.Color col)
Used to get the HTML string equivalent of the given Color object.

Parameters:
col - Color Object.
Returns:
String giving the RGB numbers.

formatDate

public static java.lang.String formatDate(long time,
                                          java.text.SimpleDateFormat dateFormat)
formats the date which is read from ClientParameters.conf.

Parameters:
time - time in long
dateFormat - SimpleDateFormat object
Returns:
String in date/time format.

formatDate

public static java.lang.String formatDate(java.util.Date date,
                                          java.text.SimpleDateFormat dateFormat)
formats the date which is read from ClientParameters.conf.

Parameters:
date - Date Object
dateFormat - SimpleDateFormat
Returns:
String in date/time format.

parseDate

public static java.util.Date parseDate(java.lang.String str)
                                throws java.text.ParseException
Deprecated. use formatDate(long time,SimpleDateFormat dateFormat) instead.

parses the given string and returns the equivalent date

Parameters:
str - a string
Returns:
Date
Throws:
java.text.ParseException - :Signals that an error has been reached unexpectedly while parsing

getParsedTime

public static long getParsedTime(java.util.Date dt)
getParsedTime:To parse a date string and returns the number of milliseconds

Parameters:
dt - a Date value
Returns:
a long value - number of milliseconds

getStatusColor

public static java.lang.String getStatusColor(int sev)
need to deprecate this method. Use SeverityInfo.getInstance().getColor(sev) instead

Parameters:
sev - The number representing the severity.
Returns:
String The name equvalent of the severity number.

dateString

public static java.lang.String dateString(long date)
Used to get the user readable String format of the given date in long.

Parameters:
date - The date in long.
Returns:
String The user readable date format.

cleanUp

public static java.util.Vector cleanUp(java.util.Hashtable ht)
This is used for cleanup of Custom Views Vector during regular period of time ("1800000" in long).

Parameters:
ht - The Hashtable which contains the login time.
Returns:
Cleaned Vector object.

replace

public static java.lang.String replace(java.lang.String s,
                                       java.lang.String tok,
                                       java.lang.String c)
To replace a particular string with a character.

Parameters:
s - The String to be replaced.
tok - The tokenizer.
c - The character to be replaced instead of the string.
Returns:
String The String which has the required changes.

populateIncrementsVector

public static java.util.Hashtable populateIncrementsVector(java.lang.String userName)
Used to provide the Hashtable containing the incrementation values from conf file for a given user.

Parameters:
userName - The name of the user for whom the incrementation values have to be known
Returns:
Hashtable containing the incrementation values.

isAuthorized_userName

public static boolean isAuthorized_userName(java.lang.String userName,
                                            java.lang.String dn)
To check if the given userName is an authorized userName.

Parameters:
userName - name to be checked.
dn - Distinguished name.
Returns:
boolean whether autherized or not.

getOperationsForUser

public static java.util.Vector getOperationsForUser(java.lang.String userName)
This method is used to get a List of operations authorized for this specified user name.

Parameters:
userName - the name of the user for which the operations list is to be retrived.
Returns:
A Vector which contains a list of operations authorized for the specified user name.

getFilePath

public static java.lang.String getFilePath(java.lang.String menuName,
                                           java.lang.String userName)
                                    throws java.io.IOException
Used to get the absolute URL

Parameters:
menuName - the name of the menu
userName - the name of the user
Returns:
a String containing the file path
Throws:
java.io.IOException

encode

public static java.lang.String encode(java.lang.String name)
To replace all spaces in a string with %20 - used for encoding the URL names with space in between

Parameters:
name - The string to be to be changed
Returns:
String The encoded string with all spaces replaced by %20

getDateFormat

public static java.text.DateFormat getDateFormat(java.lang.String userName)
To get the date format with timezone set.The timezone to be used is read from the clientparameters.conf file

Parameters:
userName - The string gives the user
Returns:
DateFormat The date format with timezone set.

isAuthorized

public static boolean isAuthorized(java.lang.String userName,
                                   java.lang.String operation)
Used to check whether the given user is authorized to perform the specified operation

Parameters:
userName - the user name which you want to know the whether the operation is permitted
operation - the operation for which you need to know the whether the user is allowed to do.
Returns:
boolean Returns true if the given user is authorized to do the specified operation, else returns false

isAuthorized

public static boolean isAuthorized(java.lang.String userName,
                                   java.lang.String operation,
                                   boolean log)

isAuthorized

public static boolean isAuthorized(java.lang.String userName,
                                   java.lang.String operation,
                                   java.util.Properties auditProp)

isAuthorized

public static boolean isAuthorized(java.lang.String userName,
                                   java.lang.String operation,
                                   java.util.Properties auditProp,
                                   boolean log)

getHelpURL

public static java.lang.String getHelpURL(java.lang.String key)
Returns the help URL when the key is given. The helpURL is read from conf/help.conf

Parameters:
key - the key for which you want the help URL
Returns:
Returns help URL whose key is given

"WEBNMS_5 API Docs"

Copyright © 2011 ZOHO Corp., All Rights Reserved.