org.kuali.rice.kew.util
Class Utilities

java.lang.Object
  extended by org.kuali.rice.kew.util.Utilities

public class Utilities
extends Object

Various static utility methods.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Nested Class Summary
static class Utilities.PrioritySorter
          Consider moving out of this class if this bugs
static class Utilities.RouteLogActionRequestSorter
          Consider moving out of this class if this bugs
 
Field Summary
private static org.apache.commons.lang.text.StrSubstitutor substitutor
          Commons-Lang StrSubstitor which substitutes variables specified like ${name} in strings, using a lookup implementation that pulls variables from the core config
 
Constructor Summary
Utilities()
           
 
Method Summary
static List asList(Object object)
           
static Set asSet(Object object)
           
static Set asSet(Object[] objects)
           
static boolean checkDateRanges(String fromDate, String toDate)
           
static boolean collectionsEquivalent(Collection a, Collection b)
          Performs a "brute force" comparison of collections by testing whether the collections contain each other.
static String collectStackTrace(Throwable t)
           
static Timestamp convertCalendar(Calendar calendar)
           
static Calendar convertTimestamp(Timestamp timestamp)
           
static boolean equals(Object a, Object b)
           
static String getHostName()
           
static String getIpNumber()
           
static
<T,Z extends org.apache.commons.collections.KeyValue>
Map<T,Z>
getKeyValueCollectionAsLookupTable(List<Z> collection)
          Helper method that takes a List of KeyValue and presents it as a Map containing KeyValue values
static
<T,Z> Map<T,Z>
getKeyValueCollectionAsMap(List<? extends org.apache.commons.collections.KeyValue> collection)
          Helper method that takes a List of KeyValue and presents it as a Map
static boolean getKNSParameterBooleanValue(String nameSpace, String detailType, String name)
           
static boolean getKNSParameterBooleanValue(String nameSpace, String detailType, String name, boolean defaultValue)
           
static String getKNSParameterValue(String nameSpace, String detailType, String name)
           
static boolean isEmpty(Collection collection)
           
static boolean isEmpty(Object[] array)
           
static boolean isEmpty(String value)
           
static String parseGroupName(String namespaceAndNameCombo)
           
static String parseGroupNamespaceCode(String namespaceAndNameCombo)
           
static String substituteConfigParameters(String string)
          Performs variable substitution on the specified string, replacing variables specified like ${name} with the value of the corresponding config parameter obtained from the current context Config object
static String substituteConfigParameters(String namespace, String string)
          Performs variable substitution on the specified string, replacing variables specified like ${name} with the value of the corresponding config parameter obtained from the current context Config object.
static boolean validateDate(String date, boolean dateOptional)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

substitutor

private static org.apache.commons.lang.text.StrSubstitutor substitutor
Commons-Lang StrSubstitor which substitutes variables specified like ${name} in strings, using a lookup implementation that pulls variables from the core config

Constructor Detail

Utilities

public Utilities()
Method Detail

substituteConfigParameters

public static String substituteConfigParameters(String namespace,
                                                String string)
Performs variable substitution on the specified string, replacing variables specified like ${name} with the value of the corresponding config parameter obtained from the current context Config object. This version of the method also takes a namespace to qualify the parameter.

Parameters:
namespace - the namespace to use for qualifying the parameter
string - the string on which to perform variable substitution
Returns:
a string with any variables substituted with configuration parameter values

substituteConfigParameters

public static String substituteConfigParameters(String string)
Performs variable substitution on the specified string, replacing variables specified like ${name} with the value of the corresponding config parameter obtained from the current context Config object

Parameters:
string - the string on which to perform variable substitution
Returns:
a string with any variables substituted with configuration parameter values

getKNSParameterValue

public static String getKNSParameterValue(String nameSpace,
                                          String detailType,
                                          String name)

getKNSParameterBooleanValue

public static boolean getKNSParameterBooleanValue(String nameSpace,
                                                  String detailType,
                                                  String name)

getKNSParameterBooleanValue

public static boolean getKNSParameterBooleanValue(String nameSpace,
                                                  String detailType,
                                                  String name,
                                                  boolean defaultValue)

parseGroupNamespaceCode

public static String parseGroupNamespaceCode(String namespaceAndNameCombo)

parseGroupName

public static String parseGroupName(String namespaceAndNameCombo)

isEmpty

public static boolean isEmpty(String value)

isEmpty

public static boolean isEmpty(Collection collection)

isEmpty

public static boolean isEmpty(Object[] array)

equals

public static boolean equals(Object a,
                             Object b)

collectStackTrace

public static String collectStackTrace(Throwable t)

convertTimestamp

public static Calendar convertTimestamp(Timestamp timestamp)

convertCalendar

public static Timestamp convertCalendar(Calendar calendar)

asSet

public static Set asSet(Object[] objects)

asSet

public static Set asSet(Object object)

asList

public static List asList(Object object)

validateDate

public static boolean validateDate(String date,
                                   boolean dateOptional)

checkDateRanges

public static boolean checkDateRanges(String fromDate,
                                      String toDate)

collectionsEquivalent

public static boolean collectionsEquivalent(Collection a,
                                            Collection b)
Performs a "brute force" comparison of collections by testing whether the collections contain each other. This circuments any particular uniqueness or ordering constraints on the collections (for instance, lists that are unordered but contain the same elements, where a hashset would not suffice for comparison purposes because it enforces element uniqueness)


getIpNumber

public static String getIpNumber()

getHostName

public static String getHostName()

getKeyValueCollectionAsMap

public static <T,Z> Map<T,Z> getKeyValueCollectionAsMap(List<? extends org.apache.commons.collections.KeyValue> collection)
Helper method that takes a List of KeyValue and presents it as a Map

Type Parameters:
T - the key type
Z - the value type
Parameters:
collection - collection of KeyValue
Returns:
a Map representing the keys and values in the KeyValue collection

getKeyValueCollectionAsLookupTable

public static <T,Z extends org.apache.commons.collections.KeyValue> Map<T,Z> getKeyValueCollectionAsLookupTable(List<Z> collection)
Helper method that takes a List of KeyValue and presents it as a Map containing KeyValue values

Type Parameters:
T - the key type
Z - the collection/map value type, which must be a KeyValue
Parameters:
collection - collection of KeyValue
Returns:
a Map where keys of the KeyValues in the collection are mapped to their respective KeyValue object


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.