public final class EproUtil
extends java.lang.Object
epromotion
component.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.text.SimpleDateFormat |
displayDateFormat
This format is used for output by default
|
static java.text.SimpleDateFormat |
displayTimeFormat
This format is used for output by default
|
static java.text.SimpleDateFormat |
displayTimestampFormat
This format is used for output by default
|
static java.lang.String |
jdbcTimestampFormat
This format is a default JDBC timestamp escape format without nanoseconds.
|
static java.text.SimpleDateFormat[] |
supportedDateFormats
These formats supported for converting strings to dates
|
static java.text.SimpleDateFormat[] |
supportedTimeFormats
These formats supported for converting strings to time
|
static java.text.SimpleDateFormat[] |
supportedTimestampFormats
These formats supported for converting strings to date and time format.
|
Constructor and Description |
---|
EproUtil()
Util constructor comment.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
dateToString(java.sql.Date date)
|
static java.lang.String |
dateToString(java.sql.Date date,
java.lang.String format)
Returns the
date as a String formatted by the
supplied format
A null date is converted to a null String . |
static java.lang.Object |
doCheckParameterFound(java.util.Map h,
java.lang.String parameterName)
Return the value of the key in the Map, if value of the key doesn't exist, throw exception.
|
static java.lang.String |
endTag(java.lang.String tagName)
Return the XML end tag with tag name included.
|
java.lang.String |
getCategoryName(java.lang.String storeId,
java.lang.String langId,
java.lang.String catIdentifier)
Returns category name in string type by passing its store ID, language ID and identifier
|
java.lang.String |
getCatEntryId(java.lang.String partNumber,
java.lang.String dN)
Return CATENTRY ID (Reference Number) in string type by passing its unique index.
|
java.lang.String |
getCatGroupId(java.lang.String identifier,
java.lang.String dN)
Returns category ID in string type by passing its unique index.
|
static java.lang.Long |
getMbrGrpId(java.lang.String mbrGrpName,
java.lang.String ownerDN)
Returns member group ID with the given name & owner
|
static java.lang.Long |
getOwnerId(java.lang.String dn)
Returns owner ID of the store with a given owner
|
static java.lang.Integer[] |
getRelatedStoreIds(StoreKey skey)
This Static method returns the StoreIdss of all the Stores
related to this Store by
com.ibm.commerce.promotions relationship. |
static StoreKey[] |
getRelatedStores(StoreKey sKey)
This Static method returns the
StoreKey s of all the Stores
related to this Store through com.ibm.commerce.promotions relationship. |
java.lang.String |
getShipModeId(java.lang.String code,
java.lang.String carrier,
java.lang.String storeName,
java.lang.String ownerDN)
Return shipping mode id in string type by passing its unique index.
|
java.lang.String |
getSKU(java.lang.String catentry_id)
Return SKU of string type by passing its CATENTRY ID.
|
java.lang.String |
getSKUName(java.lang.String langId,
java.lang.String catentry_id)
Returns SKU name by passing its CATENTRY ID.
|
java.util.Vector |
getSKUs(java.util.Vector catentryIds)
Returns SKU Vector by passing its CATENTRY ID vector.
|
java.lang.String |
getSKUType(java.lang.String catentry_id)
Returns SKU type by passing its CATENTRY ID.
|
static java.lang.Integer |
getStoreId(StoreKey key)
Returns Store Id of the store with a given store key
|
static boolean |
isBlank(java.lang.String s)
Takes a string and returns true if it is
null, an empty string, or string containing only white space.
|
static boolean |
isValidDate(java.lang.String s)
Returns true if the string is a valid date or is an empty string,
false otherwise.
|
static boolean |
isValidDateFormat(java.lang.String format)
Tests if the date format pattern specified is valid.
|
static boolean |
isValidTime(java.lang.String s)
Returns true if the string is a valid date or is an empty string,
false otherwise.
|
static boolean |
isValidTimestamp(java.lang.String s)
Returns true if the string is a valid timestamp or is an empty string
false otherwise.
|
static java.lang.String |
normalizeDatetime(java.lang.String s)
Gets rid of unnecessary punctuation, multiple white space and other anomalies in a Datetime string.
|
static java.lang.String |
replaceSubstring(java.lang.String str,
java.lang.String substr1,
java.lang.String substr2,
int startFromLocation)
Utility function used to replace all occurrences of substring 1 (substr1) with substring 2 (substr2) in string object.
|
static void |
requireParameterNotNull(java.lang.String className,
java.lang.String methodName,
java.lang.String parameterName,
java.lang.Object object)
Clients should call this when they receive a parameter
that may not be null.
|
static java.lang.String |
spacesToUnderscores(java.lang.String s)
Takes a String and converts the blank spaces inside the String to underscores, then returns this
new String
|
static java.lang.String |
startTag(java.lang.String tagName)
Return an XML start tag with given tag name.
|
static java.sql.Date |
stringToDate(java.lang.String s)
Converts a
String to a Date . |
static java.sql.Date |
stringToDate(java.lang.String s,
java.lang.String format)
Converts a
String to a Date using the given format . |
static java.sql.Time |
stringToTime(java.lang.String s)
Converts a
String to a Time . |
static java.sql.Time |
stringToTime(java.lang.String s,
java.lang.String format)
Converts a
String to a Time using the given format . |
static java.sql.Timestamp |
stringToTimestamp(java.lang.String s)
Converts a
String to a Timestamp . |
static java.sql.Timestamp |
stringToTimestamp(java.lang.String s,
java.lang.String format)
Converts a
String to a Timestamp using the given format . |
static java.sql.Timestamp |
stringToTimestamp(java.lang.String s,
java.lang.String format,
java.util.Locale lcl)
Converts a
String to a Timestamp using the given format and lcl . |
static java.lang.String |
timestampToString(java.util.Date date)
|
static java.lang.String |
timestampToString(java.util.Date date,
java.lang.String format)
Returns the
date as a String formatted by the
supplied format
A null date is converted to a null String . |
static java.lang.String |
timestampToString(java.sql.Timestamp date)
|
static java.lang.String |
timestampToString(java.sql.Timestamp date,
java.lang.String format)
Returns the
date as a String formatted by the
supplied format
A null date is converted to a null String . |
static java.lang.String |
timestampToString(java.sql.Timestamp date,
java.lang.String format,
java.util.Locale lcl)
Returns the
date as a String formatted by the
supplied format and locale
A null date is converted to a null String . |
static java.lang.String |
timeToString(java.sql.Time time)
|
static java.lang.String |
timeToString(java.sql.Time time,
java.lang.String format)
Returns the
date as a String formatted by the
supplied format
A null date is converted to a null String . |
static boolean |
toBoolean(java.lang.Object value)
Convert Object into a boolean primitive type
|
static boolean |
toBoolean(java.lang.String value)
Convert String into a boolean primitive type
|
static int |
toInt(java.lang.Object value)
Convert Object into an int primitive type
|
static int |
toInt(java.lang.String value)
Convert String into an int primitive type
|
static java.util.Vector |
toReversedVector(java.util.Vector originalVector)
This method is using to reverse the order of Vector's objects.
|
static java.util.Vector |
toVector(java.lang.Object value)
This method will convert an Object type of vector into a Vector type.
|
public static final java.lang.String COPYRIGHT
public static java.lang.String jdbcTimestampFormat
public static java.text.SimpleDateFormat displayDateFormat
public static java.text.SimpleDateFormat displayTimeFormat
public static java.text.SimpleDateFormat displayTimestampFormat
public static java.text.SimpleDateFormat[] supportedDateFormats
public static java.text.SimpleDateFormat[] supportedTimeFormats
public static java.text.SimpleDateFormat[] supportedTimestampFormats
public static java.lang.String dateToString(java.sql.Date date)
date
as a String
formatted by the
default format displayDateFormat
.
A null date
is converted to a null String
.date
- Datedate
formatted by the default format displayDateFormat
or null
.public static java.lang.String dateToString(java.sql.Date date, java.lang.String format)
date
as a String
formatted by the
supplied format
A null date
is converted to a null String
.date
- Dateformat
- format to useString
, or null if the date parameter
is null.java.lang.IllegalArgumentException
- An exception will be thrown if
the format specified by the format
parameter is invalid.public static java.lang.Object doCheckParameterFound(java.util.Map h, java.lang.String parameterName) throws ParameterNotFoundException
h
- java.util.Map containing key value pairs.parameterName
- java.lang.String the key used for searching in the map.ParameterNotFoundException
public static java.lang.String endTag(java.lang.String tagName)
tagName
- java.lang.String the tag name.public static boolean isBlank(java.lang.String s)
s
- The String to check.public static boolean isValidDate(java.lang.String s)
s
- String to validatepublic static boolean isValidDateFormat(java.lang.String format)
format
- The format string to test.public static boolean isValidTime(java.lang.String s)
s
- String to validatepublic static boolean isValidTimestamp(java.lang.String s)
s
- String to validatepublic static java.lang.String normalizeDatetime(java.lang.String s)
s
- String to normalizepublic static java.lang.String replaceSubstring(java.lang.String str, java.lang.String substr1, java.lang.String substr2, int startFromLocation)
str
- The original stringsubstr1
- The substring 1 to be replaced (all occurrences of it)substr2
- The substring 2 that is inserted in place of substring 1.startFromLocation
- The starting location in string (if the whole string put 0)public static final void requireParameterNotNull(java.lang.String className, java.lang.String methodName, java.lang.String parameterName, java.lang.Object object)
className
- java.lang.String is the name of class.methodName
- java.lang.String is the name of method.parameterName
- java.lang.String is the name of parameter.object
- java.lang.Object the object.public static java.lang.String spacesToUnderscores(java.lang.String s)
s
- String to convertpublic static java.lang.String startTag(java.lang.String tagName)
tagName
- java.lang.String the tag name.public static java.sql.Date stringToDate(java.lang.String s) throws java.text.ParseException
String
to a Date
. Any of the formats
#dateFormat_DASH
, #dateFormat_SLASH
, #dateFormat_DOT
,
#dateFormat_SPACE
, and #dateFormat_NONE
with 2 or 4 digit
years are accepted (2 digit years have the range 1921-2020).
An isBlank(String)
String
is converted to a null Date
.s
- String to parseDate
parsed or null
java.text.ParseException
- thrown if s
is improperly formatted.public static java.sql.Date stringToDate(java.lang.String s, java.lang.String format) throws java.text.ParseException
String
to a Date
using the given format
.
An isBlank(String)
String
is converted to a null Date
.s
- String to parseformat
- Format to useDate
parsed or null
java.text.ParseException
- if s
is improperly formatted.java.lang.IllegalArgumentException
- if the format specified by format
is invalid.public static java.sql.Time stringToTime(java.lang.String s) throws java.text.ParseException
String
to a Time
. Any of the formats
in the supportedTimeFormat array are supported, separated by any punctuation.
An isBlank(String)
String
is converted to a null Time
.s
- String to parseTime
parsed or null
java.text.ParseException
- thrown if s
is improperly formatted.public static java.sql.Time stringToTime(java.lang.String s, java.lang.String format) throws java.text.ParseException
String
to a Time
using the given format
.
An isBlank(String)
String
is converted to a null Time
.s
- String to parseformat
- Format to useTime
parsed or null
java.text.ParseException
- if s
is improperly formatted.java.lang.IllegalArgumentException
- if the format specified by format
is invalid.public static java.sql.Timestamp stringToTimestamp(java.lang.String s) throws java.text.ParseException
String
to a Timestamp
. Any of the formats
#timestampFormat_DASH
, #timestampFormat_SLASH
, #timestampFormat_DOT
,
#timestampFormat_SPACE
, and #timestampFormat_NONE
with 2 or 4 digit
years are accepted (2 digit years have the range 1921-2020).
An isBlank(String)
String
is converted to a null Timestamp
.s
- String to parseTimestamp
parsed or null
java.text.ParseException
- thrown if s
is improperly formatted.public static java.sql.Timestamp stringToTimestamp(java.lang.String s, java.lang.String format) throws java.text.ParseException
String
to a Timestamp
using the given format
.
An isBlank(String)
String
is converted to a null Timestamp
.s
- String to parseformat
- Format to useTimestamp
parsed or null
java.text.ParseException
- if s
is improperly formatted.java.lang.IllegalArgumentException
- if the format specified by format
is invalid.public static java.sql.Timestamp stringToTimestamp(java.lang.String s, java.lang.String format, java.util.Locale lcl) throws java.text.ParseException
String
to a Timestamp
using the given format
and lcl
.
An isBlank(String)
String
is converted to a null Timestamp
.s
- String to parseformat
- java.lang.Stringlcl
- java.lang.LocaleTimestamp
parsed or null
java.text.ParseException
- if s
is improperly formatted.java.lang.IllegalArgumentException
- if the format specified by format
is invalid.public static java.lang.String timestampToString(java.sql.Timestamp date)
date
as a String
formatted by the
default format displayDateFormat
.
A null date
is converted to a null String
.date
- Datedate
formatted by the default format displayDateFormat
or null
.public static java.lang.String timestampToString(java.sql.Timestamp date, java.lang.String format)
date
as a String
formatted by the
supplied format
A null date
is converted to a null String
.date
- Dateformat
- format to useString
, or null if the date parameter
is null.java.lang.IllegalArgumentException
- An exception will be thrown if
the format specified by the format
parameter is invalid.public static java.lang.String timestampToString(java.util.Date date)
date
as a String
formatted by the
default format displayDateFormat
.
A null date
is converted to a null String
.date
- Datedate
formatted by the default format displayDateFormat
or null
.public static java.lang.String timestampToString(java.util.Date date, java.lang.String format)
date
as a String
formatted by the
supplied format
A null date
is converted to a null String
.date
- Dateformat
- format to useString
, or null if the date parameter
is null.java.lang.IllegalArgumentException
- An exception will be thrown if
the format specified by the format
parameter is invalid.public static java.lang.String timestampToString(java.sql.Timestamp date, java.lang.String format, java.util.Locale lcl)
date
as a String
formatted by the
supplied format and locale
A null date
is converted to a null String
.date
- Dateformat
- format to uselcl
- java.util.LocaleString
, or null if the date parameter
is null.java.lang.IllegalArgumentException
- An exception will be thrown if
the format specified by the format
parameter is invalid.public static java.lang.String timeToString(java.sql.Time time)
date
as a String
formatted by the
default format displayDateFormat
.
A null date
is converted to a null String
.date
- Datedate
formatted by the default format displayDateFormat
or null
.public static java.lang.String timeToString(java.sql.Time time, java.lang.String format)
date
as a String
formatted by the
supplied format
A null date
is converted to a null String
.date
- Dateformat
- format to useString
, or null if the date parameter
is null.java.lang.IllegalArgumentException
- An exception will be thrown if
the format specified by the format
parameter is invalid.public static boolean toBoolean(java.lang.Object value)
value
- java.lang.Object the object value to be convertedpublic static boolean toBoolean(java.lang.String value)
value
- java.lang.String the string value to be convertedpublic static int toInt(java.lang.Object value)
value
- java.lang.Object the object value to be convertedpublic static int toInt(java.lang.String value)
value
- java.lang.String the string value to be convertedpublic static java.util.Vector toReversedVector(java.util.Vector originalVector)
originalVector
- java.util.Vector is the original vectorpublic static java.util.Vector toVector(java.lang.Object value)
value
- java.lang.Object is the object of type vector.public java.lang.String getCatEntryId(java.lang.String partNumber, java.lang.String dN) throws ECException
partNumber
- java.lang.String SKU numberdN
- java.lang.String is the DNECException
public java.lang.String getShipModeId(java.lang.String code, java.lang.String carrier, java.lang.String storeName, java.lang.String ownerDN) throws ECException
code
- java.lang.String code for the shipping mode searchcarrier
- java.lang.String carrier for the shipping mode searchstoreName
- java.lang.String store nameownerDN
- java.lang.String user's DNFinderException
RemoteException
NamingException
CreateException
ECException
public java.lang.String getSKU(java.lang.String catentry_id) throws ECException
catentry_id
- catentry id of java.lang.String type.ECException
public java.lang.String getSKUType(java.lang.String catentry_id) throws ECException
catentry_id
- java.lang.String is the category id.ECException
public java.lang.String getSKUName(java.lang.String langId, java.lang.String catentry_id) throws ECException
langId
- java.lang.String lang id.catentry_id
- java.lang.String catentry id.ECException
public java.util.Vector getSKUs(java.util.Vector catentryIds) throws ECException
catentryIds
- catEntryIds is the java.util.Vector of catEntry ids.ECException
public java.lang.String getCatGroupId(java.lang.String identifier, java.lang.String dN) throws ECException
identifier
- java.lang.String the user id for catalog group search.dN
- java.lang.String the DNECException
public java.lang.String getCategoryName(java.lang.String storeId, java.lang.String langId, java.lang.String catIdentifier) throws ECException
storeId
- java.lang.String the store IDlangId
- java.lang.String the language IDcatIdentifier
- java.lang.String the the user id for catalog group searchECException
public static StoreKey[] getRelatedStores(StoreKey sKey)
StoreKey
s of all the Stores
related to this Store through com.ibm.commerce.promotions
relationship.sKey
- StoreKey
StoreKey
related through com.ibm.commerce.promotions
relationship.public static java.lang.Integer[] getRelatedStoreIds(StoreKey skey)
com.ibm.commerce.promotions
relationship.skey
- StoreKey
public static java.lang.Integer getStoreId(StoreKey key) throws ECException
key
- StoreKey
ECException
public static java.lang.Long getMbrGrpId(java.lang.String mbrGrpName, java.lang.String ownerDN)
DN
mbrGrpName
- java.lang.String the member group nameownerDN
- java.lang.String the user DNECException
public static java.lang.Long getOwnerId(java.lang.String dn) throws ECException
DN
dn
- java.lang.String the user DNECException