|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.util.KRADUtils
public final class KRADUtils
Miscellaneous Utility Methods
Method Summary | |
---|---|
static String |
buildMapParameterString(Map<String,String> map)
Builds a string from the given map by joining each entry with a comma and each key/value pair with a colon |
static boolean |
containsSensitiveDataPatternMatch(String fieldValue)
|
static String |
convertDecimalIntoInteger(KualiDecimal decimalNumber)
Convert the given monney amount into an interger string. |
static Properties |
convertMapToProperties(Map<String,String> parameters)
Utility method to convert a Map to a Properties object |
static Properties |
convertRequestMapToProperties(Map<String,String[]> requestParameters)
Utility method to convert a Request Parameters Map to a Properties object |
static List<String> |
convertStringParameterToList(String parameter)
Parses a string that is in list format (commas separating list entries) to a new List instance |
static Map<String,String> |
convertStringParameterToMap(String parameter)
Parses a string that is in map format (commas separating map entries, colon separates map key/value) to a new map instance |
static Object |
createObject(Class<?> clazz,
Class<?>[] argumentClasses,
Object[] argumentValues)
|
static String |
getBusinessTitleForClass(Class<? extends Object> clazz)
|
static List<String> |
getFileNameFromPath(List<String> fullFileNames)
Picks off the filename from the full path. |
static Integer |
getIntegerValue(String numberStr)
|
static Map<String,String> |
getMapFromParameterString(String parameterString)
Parses the given string into a Map by splitting on the comma to get the map entries and within each entry splitting by colon to get the key/value pairs |
static Map<String,String> |
getNamespaceAndActionClass(Class<? extends Object> clazz)
|
static Map<String,String> |
getNamespaceAndComponentFullName(Class<? extends Object> clazz)
|
static Map<String,String> |
getNamespaceAndComponentSimpleName(Class<? extends Object> clazz)
|
static String |
getNamespaceCode(Class<? extends Object> clazz)
TODO this method will probably need to be exposed in a public KRADUtils class as it is used by several different modules. |
static Map<String,String> |
getParametersFromRequest(List<String> parameterNames,
Class<?> parentObjectClass,
Map<String,String> requestParameters)
Retrieves parameter values from the request that match the requested names. |
static Map<String,String> |
getPropertyKeyValuesFromDataObject(List<String> propertyNames,
Object dataObject)
Builds a Map containing a key/value pair for each property given in the property names list, general security is checked to determine if the value needs to be encrypted along with applying formatting to the value |
static Boolean |
getRequestParameterAsBoolean(javax.servlet.ServletRequest request,
String parameterName)
Retrieves value for the given parameter name in the request and attempts to convert to a Boolean using the BooleanFormatter |
static UserSession |
getUserSessionFromRequest(javax.servlet.http.HttpServletRequest request)
Gets the UserSession object from the HttpServletRequest object's associated session. |
static Object |
hydrateAttributeValue(Class<?> propertyType,
String attributeValue)
Attempt to coerce a String attribute value to the given propertyType. |
static boolean |
isProductionEnvironment()
|
static String |
joinWithQuotes(List<String> list)
|
static Map<String,String> |
translateRequestParameterMap(Map<String,String[]> requestParameters)
Translates the given Map of String keys and String array values to a Map of String key and values. |
static String |
translateToMapSafeKey(String key)
Translates characters in the given string like brackets that will cause problems with binding to characters that do not affect the binding |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final String getBusinessTitleForClass(Class<? extends Object> clazz)
public static final List<String> getFileNameFromPath(List<String> fullFileNames)
public static final String convertDecimalIntoInteger(KualiDecimal decimalNumber)
public static Integer getIntegerValue(String numberStr)
public static Object hydrateAttributeValue(Class<?> propertyType, String attributeValue)
propertyType
- the Class to coerce the attributeValue toattributeValue
- the String value to coerce
public static Object createObject(Class<?> clazz, Class<?>[] argumentClasses, Object[] argumentValues)
public static String joinWithQuotes(List<String> list)
public static String getNamespaceCode(Class<? extends Object> clazz)
public static Map<String,String> getNamespaceAndComponentSimpleName(Class<? extends Object> clazz)
public static Map<String,String> getNamespaceAndComponentFullName(Class<? extends Object> clazz)
public static Map<String,String> getNamespaceAndActionClass(Class<? extends Object> clazz)
public static Map<String,String> convertStringParameterToMap(String parameter)
parameter
- - string parameter to parse
public static List<String> convertStringParameterToList(String parameter)
parameter
- - string parameter to parse
public static String translateToMapSafeKey(String key)
key
- - string to translate
public static String buildMapParameterString(Map<String,String> map)
map
- - map instance to build string for
public static Map<String,String> getMapFromParameterString(String parameterString)
parameterString
- - string to parse into map
public static Boolean getRequestParameterAsBoolean(javax.servlet.ServletRequest request, String parameterName)
BooleanFormatter
request
- - servlet request containing parametersparameterName
- - name of parameter to retrieve value for
public static Map<String,String> translateRequestParameterMap(Map<String,String[]> requestParameters)
requestParameters
- - Map of request parameters to translate
public static Map<String,String> getParametersFromRequest(List<String> parameterNames, Class<?> parentObjectClass, Map<String,String> requestParameters)
parameterNames
- - names of the parameters whose values should be retrieved
from the requestparentObjectClass
- - object class that contains the parameter names as properties
and should be consulted for security checksrequestParameters
- - all request parameters to pull from
public static Map<String,String> getPropertyKeyValuesFromDataObject(List<String> propertyNames, Object dataObject)
propertyNames
- - list of property names to get key/value pairs fordataObject
- - object instance containing the properties for which the values will be pulled
public static Properties convertMapToProperties(Map<String,String> parameters)
parameters
- - map to convert
public static Properties convertRequestMapToProperties(Map<String,String[]> requestParameters)
Multiple values for a parameter are joined together with comma delimiter
requestParameters
- - map to convert
public static boolean containsSensitiveDataPatternMatch(String fieldValue)
public static final UserSession getUserSessionFromRequest(javax.servlet.http.HttpServletRequest request)
In some cases (different threads) the UserSession cannot be retrieved from GlobalVariables but can still be accessed via the session object
public static boolean isProductionEnvironment()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |