com.sun.mdm.index.edm.util
Class QwsUtil

java.lang.Object
  extended bycom.sun.mdm.index.edm.util.QwsUtil

public final class QwsUtil
extends java.lang.Object

Utility class contains commonly used functions across QWS.


Constructor Summary
QwsUtil()
           
 
Method Summary
static java.util.List convertMapValueToList(java.util.Map map)
          Convert a Map values to a List.
static java.lang.String escapeSpaceInString(java.lang.String inStr)
          Conver the space within a String to underscore.
static java.util.List formatList(java.util.List orgList, int count)
          Convert a ordinary List to a List of List, each entry in the returned List holds count objects in the original list.
static java.util.Map formatRequestParameterMap(java.util.Map parameterMap)
          Format the paramater map from HttpRequest.
static java.lang.String getFieldNameFromFieldPath(java.lang.String fieldPath)
          Retrieves the field name from a field path.
static java.lang.String getLastObjRefFromFieldPath(java.lang.String fieldPath)
          Retrieves the last object reference from a field path.
static java.lang.Object getObjectValue(java.lang.String valueString, int type)
          Convert a string value to an object: e.g., int -> Integer, date -> Date
static java.lang.String getObjRefFromFieldPath(java.lang.String fieldPath)
           
static SBROverWrite getOverWrite(SBR sbr, ObjectNode node, java.lang.String fname)
          Get the SBROverWrite object
static java.lang.String getResourceForKey(java.lang.String key)
          Get resouce for the indicated key.
static java.lang.Throwable getRootCause(java.lang.Exception e)
          Get the throwable of the root cause
static java.util.Collection getValueForField(ObjectNode majorNode, java.lang.String fieldPath, UserProfile user)
          Get value for the specified field name.
static boolean isObjectNodeSensitive(ObjectNode obj)
           
static void setObjectNodeFieldValue(ObjectNode node, java.lang.String field, java.lang.String valueString)
          Set value for the named field in the specified object.
static void setObjectNodeFieldValue(ObjectNode node, java.lang.String field, java.lang.String valueString, SBR sbr)
          Set value for the named field in the specified object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QwsUtil

public QwsUtil()
Method Detail

convertMapValueToList

public static java.util.List convertMapValueToList(java.util.Map map)
Convert a Map values to a List.

Parameters:
map - the Map to be converted.
Returns:
the List that contains the Map's values.

escapeSpaceInString

public static java.lang.String escapeSpaceInString(java.lang.String inStr)
Conver the space within a String to underscore.

Parameters:
inStr - any String.
Returns:
the String that does not contain any spaces.

formatList

public static java.util.List formatList(java.util.List orgList,
                                        int count)
Convert a ordinary List to a List of List, each entry in the returned List holds count objects in the original list.

Parameters:
orgList - the input List.
count - the number of objects in each element of the returned List.
Returns:
the List where each element contains count objects.

formatRequestParameterMap

public static java.util.Map formatRequestParameterMap(java.util.Map parameterMap)
Format the paramater map from HttpRequest.

Parameters:
parameterMap - the map obtained via request.getParameterMap() where request is of type HttpServletRequest .
Returns:
a map with string key/value.

getFieldNameFromFieldPath

public static java.lang.String getFieldNameFromFieldPath(java.lang.String fieldPath)
Retrieves the field name from a field path. For example, if "Person.Address.City" was passed in as the fieldPath parameter, this would return "City".

Parameters:
fieldPath - String representing the field path.
Returns:
The field name from a field path.

getLastObjRefFromFieldPath

public static java.lang.String getLastObjRefFromFieldPath(java.lang.String fieldPath)
Retrieves the last object reference from a field path. This is the object to which a field belongs. For example, if "Person.Address.City" is passed in as the fieldPath parameter, this would return "Address". However, for the major object (e.g. Person), if "Person.SSN" is passed in as the fieldPath parameter, this would return null. For this, the EPATH_PREFIX is ignored.

Parameters:
fieldPath - String representing the field path.
Returns:
the last object reference from a field path.

getObjectValue

public static java.lang.Object getObjectValue(java.lang.String valueString,
                                              int type)
                                       throws ObjectException
Convert a string value to an object: e.g., int -> Integer, date -> Date

Parameters:
valueString - the value string
type - the type of the field
Returns:
an object
Throws:
ObjectException - when invalid field value is encountered

getObjRefFromFieldPath

public static java.lang.String getObjRefFromFieldPath(java.lang.String fieldPath)

getOverWrite

public static SBROverWrite getOverWrite(SBR sbr,
                                        ObjectNode node,
                                        java.lang.String fname)
                                 throws ObjectException
Get the SBROverWrite object

Parameters:
sbr - the SBR
node - the node
fname - the field name in the sbr
Returns:
SBROverWrite the SBROverWrite object found or null
Throws:
ObjectException - when object operation fails

getResourceForKey

public static java.lang.String getResourceForKey(java.lang.String key)
Get resouce for the indicated key.

Parameters:
key - the key Sting used to identify a resource entry.
Returns:
string resource value of the intended key.

getRootCause

public static java.lang.Throwable getRootCause(java.lang.Exception e)
Get the throwable of the root cause

Returns:
throwable exception

getValueForField

public static java.util.Collection getValueForField(ObjectNode majorNode,
                                                    java.lang.String fieldPath,
                                                    UserProfile user)
                                             throws ObjectException
Get value for the specified field name. Note: 10/15/2002, EPath not working. Add a work-arodun here.

Parameters:
majorNode - an ObjectNode that represents the top-level object. E.g., "Person".
fieldPath - the field of interest. E.g., for major object, it's in the format of "Person.SSN". For minor object, it's in the format of "Person.Address.City".
Returns:
value for the specified field.
Throws:
ObjectException

isObjectNodeSensitive

public static boolean isObjectNodeSensitive(ObjectNode obj)
                                     throws ObjectException
Throws:
ObjectException

setObjectNodeFieldValue

public static void setObjectNodeFieldValue(ObjectNode node,
                                           java.lang.String field,
                                           java.lang.String valueString)
                                    throws ObjectException,
                                           ValidationException
Set value for the named field in the specified object.

Parameters:
node - the object node
field - the field name in the object node.
valueString - the string value to set to
Throws:
ObjectException - when object operation fails
ValidationException - when validation fails

setObjectNodeFieldValue

public static void setObjectNodeFieldValue(ObjectNode node,
                                           java.lang.String field,
                                           java.lang.String valueString,
                                           SBR sbr)
                                    throws ObjectException,
                                           ValidationException
Set value for the named field in the specified object.

Parameters:
node - the object node
field - the field name in the object node.
valueString - the string value to set to
sbr - the sbr
Throws:
ObjectException - when object operation fails
ValidationException - when validation fails


Sun Microsystems, Inc.