public class GiftRegistryUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_NAME
The name of this class
|
static java.lang.String |
COPYRIGHT
The IBM Copyright notice field.
|
Constructor and Description |
---|
GiftRegistryUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
addToCollection(java.lang.Object collection,
java.lang.Object element)
Adds an element into a collection object.
|
static void |
checkConfirmBODAndThrowExceptionOnError(ConfirmBOD confirmBOD,
java.lang.String className,
java.lang.String methodName)
Inspects a ConfirmBOD and throws an ECApplicationException that the StoreErrorDataBean
know how to handle, if the ConfirmBOD fails
|
static java.lang.Object |
convertStringToAtomicType(java.lang.String value,
java.lang.Class type)
Converts a string to a given atomic type.
|
static BusinessObjectDocument |
createBOD(java.lang.Class klass,
CommandContext context,
Verb verb,
BaseVO noun)
Creates a concrete instance of the BusinessObjectDocument.
|
static BusinessObjectDocument |
createBOD(java.lang.Class klass,
CommandContext context,
Verb verb,
BaseVO[] nouns)
Creates a concrete instance of the BusinessObjectDocument.
|
static ActivityToken |
getActivityToken()
Gets the
ActivityToken to be used in a request |
static java.lang.Class[] |
getAtomicTypes() |
static com.ibm.commerce.giftregistry.util.ECEncryptionCmd |
getECEncryptionCmd(CommandContext context)
Gets an instance of
ECEncryptionCmd 's implementation, and assign the given
command context to the command. |
static TypedProperty |
getRequestProperties(javax.servlet.http.HttpServletRequest request)
Retrieves the request properties from the given
HttpServletRequest object. |
static java.lang.String |
getStackTrace(java.lang.Throwable e)
Converts the stack trace of a throwable instance to a string
|
static VerbPath |
getVerbPath(BaseVO aNode,
java.lang.String attribute)
Constructs a verb path starting from the leaf
|
static boolean |
isAtomicType(java.lang.Class klass)
Determines if a class is one of the types returned by
getAtomicTypes() . |
static boolean |
isCollection(java.lang.Object value)
Determines if a given object is a collection.
|
static boolean |
isEmpty(java.util.Collection c)
Determines if a given collection is empty.
|
static java.lang.String |
join(java.lang.String[] strings)
Joins a list of strings into one string.
|
static java.lang.String |
makeParameterName(java.lang.String name,
java.lang.Integer index)
Constructs an HTTP request parameter name based on given name and index.
|
static java.util.Map |
resolveValues(java.lang.String name,
TypedProperty aRequestProperty,
boolean isArray)
A wrapper for ResolveParameter.resolveValues.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASS_NAME
public static java.util.Map resolveValues(java.lang.String name, TypedProperty aRequestProperty, boolean isArray)
name
- aRequestProperty
- isArray
- public static VerbPath getVerbPath(BaseVO aNode, java.lang.String attribute)
node
- the node that contains the given attributeattribute
- the leaf of the nodeVerbPath
that leads to the given attribute. The
first step of the path will be DataArea#getRootNode
and
the predicate of root can be used to identify the root of a value object
graph.public static BusinessObjectDocument createBOD(java.lang.Class klass, CommandContext context, Verb verb, BaseVO[] nouns) throws ECException
klass
- The class of the instance to be createdcontext
- The context in which the BOD is to be created.verb
- The verb of the BODnouns
- a list of nouns that is to be stored in the BODThe
- exception gets thrown when creation of the BOD fails. Normally, the creation fails due to
a programming error or a system error. Possible programming error that will cause the failure will be
the passed parameters being null, the klass
being not a BusinessObjectDocument
type, and
there is no public constructor that takes a ActivityToken
and a DataArea
as parameters in the given klass
.ECException
public static BusinessObjectDocument createBOD(java.lang.Class klass, CommandContext context, Verb verb, BaseVO noun) throws ECException
klass
- The class of the instance to be createdcontext
- The context in which the BOD is to be created.verb
- The verb of the BODnouns
- a list of nouns that is to be stored in the BODECException
- The exception gets thrown when creation of the BOD fails. Normally, the creation fails due to
a programming error or a system error. Possible programming error that will cause the failure will be
the passed parameters being null, the klass
being not a BusinessObjectDocument
type, and
there is no public constructor that takes a ActivityToken
and a DataArea
as parameters in the given klass
.public static ActivityToken getActivityToken()
ActivityToken
to be used in a requestpublic static boolean isEmpty(java.util.Collection c)
c
- A collection instancepublic static boolean isCollection(java.lang.Object value)
value
- the given object to be determinedCollection
or an array. False otherwise.public static java.lang.String join(java.lang.String[] strings)
strings
- a list of stringspublic static boolean addToCollection(java.lang.Object collection, java.lang.Object element)
collection
- a collection object. It can be a java.util.Collection
, or an array.element
- An element to be added to the given collection object. If the collection object is an
array, the element has to an acceptable type of the array.public static boolean isAtomicType(java.lang.Class klass)
getAtomicTypes()
.klass
- the class to be analyzedgetAtomicTypes()
. Otherwise,
false. If the given class is null, null will be returned.public static java.lang.Class[] getAtomicTypes()
public static java.lang.Object convertStringToAtomicType(java.lang.String value, java.lang.Class type)
value
- the String to the convertedThe
- type to which the given string is convertedpublic static void checkConfirmBODAndThrowExceptionOnError(ConfirmBOD confirmBOD, java.lang.String className, java.lang.String methodName) throws ECApplicationException
confirmBOD
- className
- methodName
- ECApplicationException
public static com.ibm.commerce.giftregistry.util.ECEncryptionCmd getECEncryptionCmd(CommandContext context) throws ECException
ECEncryptionCmd
's implementation, and assign the given
command context to the command. The returned command has not been executed or been changed
other than being instantiated. It is update the user of the returned command to set required
parameters, and then execute the command.context
- the context the returned command will be usingECException
- thrown if the command instance can not be instantiated properlypublic static java.lang.String makeParameterName(java.lang.String name, java.lang.Integer index)
name
- the name of a parameter without any indexindex
- the potential index of a parameterpublic static java.lang.String getStackTrace(java.lang.Throwable e)
e
- a Throwable
that contains stack tracepublic static TypedProperty getRequestProperties(javax.servlet.http.HttpServletRequest request)
HttpServletRequest
object.request
- the request that contains the desired request properties