public class GiftCenterComponentHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.Long |
addAddressUsingSQL(ContactInfoType contactInfoType)
Inserts a record into the GRADDR table using the values from
logical
ContactInfoType type. |
static java.lang.String |
buildErrorKeyForRuleValidationError(java.lang.String primaryErrorKey,
GiftListType giftList,
java.lang.Integer ruleName)
This method constructs the error key to be returned to the client when
the rule validation check fails for a gift list.
|
static void |
clearUsersDefaultWishList(java.lang.String userId)
Sets a user"s default wish list to active.
|
static CommandContext |
createCommandContext()
Creates a clone of the command context associated with the current activity token.
|
static java.util.List |
executeSelectStatement(java.lang.String query,
java.util.Map parameters)
Executes a select query
|
static java.lang.String |
generateSearchKeyFirstName(java.lang.String firstName,
java.lang.Object... parameters)
Generates the SOUNDEX value for an ASCII input as the search key value in
case of DB2 and Oracle databases.
|
static java.lang.String |
generateSearchKeyLastName(java.lang.String lastName,
java.lang.Object... parameters)
Generates the SOUNDEX value for an ASCII input as the search
key value in case of DB2 and Oracle databases.
|
static CatalogEntryType |
getCatalogEntry(CatalogEntryIdentifierType catalogEntryIdentifier)
Fetches the catalog entry details based on the catalog entry identifier
passed.
|
static CatalogEntryAccessBean |
getCatalogEntryFromCache(CatalogEntryIdentifierType catalogEntryIdentifier)
Fetches the catalog entry details based on the catalog entry identifier
passed.
|
static java.lang.Object[] |
getControlParamValues(ActionExpression actionExpression,
java.lang.String paramName)
Returns the control parameter values for parameter name present in the
action expression
|
static java.sql.Date |
getDate(java.lang.Object inputDate)
This method formats the date present in logic gift list noun part into java.sql.Date.
|
static int |
getEventIdforAnEventName(java.lang.String eventName,
java.lang.String storeId)
Returns the
event_id corresponding to a event name and store identifiers
from the gift list event table. |
static java.lang.String |
getEventTypeName(java.lang.Integer eventId)
Returns the gift list event type name for a particular event id
|
static java.lang.String |
getExternalIdentifer(com.ibm.commerce.foundation.common.datatypes.GiftListIdentifierType giftListIdentifier)
Retrieves the external identifier for the gift list.
|
static PhysicalDataContainer |
getGiftList(java.lang.Long giftListID)
Fetches the
PhysicalDataContainer based on
UniqueID. |
static com.ibm.commerce.giftcenter.facade.server.helpers.GiftListAddressValidator |
getGiftListAddressValidator()
Gets the instance of the
GiftListAddressValidator which is
used for perform address field validation of the various address noun
parts in the gift list noun. |
static com.ibm.commerce.giftcenter.facade.server.entity.datatypes.Grgftreg |
getGiftListByExternalId(java.lang.String externalId)
Retrieves the physical gift list object based on the external
identifier.
|
static GiftListContextUpdateCmd |
getGiftListContextUpdateCmd()
Gets the instance of
GiftListContextUpdateCmd which is used
for performing context updates. |
static GiftListEncryptionHelper |
getGiftListEncryptionHelper()
Gets the instance of the
GiftListEncryptionHelper which is
used for performing encryption in GRUSERAUTH tables. |
static java.lang.String |
getGiftListOwner(java.lang.String uniqueID)
Returns the owner of the gift list.
|
static PhysicalDataContainer |
getGiftListRegistrants(java.lang.Long giftListID)
Fetches the
PhysicalDataContainer based on
UniqueID. |
static java.lang.String |
getGuestAccessPassword(java.lang.String giftListUniqueId)
Returns the guest access password for a registry which requires password
for a gift giver.
|
static JDBCQueryService |
getJDBCQueryService()
Gets the JDBC query service instance.
|
static java.lang.Integer |
getLanguageId()
Returns the
languageId from the service context |
static java.util.Map<java.lang.String,java.lang.Long> |
getRegistrantsAddresses(java.lang.Long giftListUniqueID)
Returns the registrant"s addressId and co-registrant"s addressId for a given gift list.
|
static java.lang.Long |
getRunAsId()
Gets the
runAsId from the service context |
static java.lang.Integer |
getStoreId()
Gets the
storeId from the service context |
static GiftListType |
populateAccessKeys(GiftListType giftListType)
Generates and set access keys to the input
GiftListType object. |
static GiftListType |
populateExternalId(GiftListType giftListType)
Generates the external identifier for an input
GiftListType object. |
static void |
resolveGiftListRegistrant(GiftListType giftList,
GiftListRegistrantType giftListRegistrant)
Resolves the gift list registrant noun part based on the registrantID or
GiftList uniqueID or GifList ExternalId
|
static void |
resolveNoun(GiftListType giftList)
Resolves the gift list noun based on the unique ID or the external ID.
|
static void |
setNewDefaultWishList(java.lang.String userId)
Sets a user"s active wish list to be the default wish list.
|
static void |
updateGiftList(java.lang.Long giftListID)
Updates the lastUpdate property of a gift list.
|
static boolean |
useOneWayHashEncryptionForGuestAccessPassword()
Returns a boolean flag to indicate whether one way hash encryption should
be used for manage access passwords.
|
static boolean |
useOneWayHashEncryptionForManageAccessPassword()
Returns a boolean flag to indicate whether one way hash encryption should
be used for manage access passwords.
|
static void |
validateCatalogEntry(CatalogEntryIdentifierType catalogEntryIdentifier)
Validates the catalog entry identifier by resolving it.
|
public static java.lang.Integer getStoreId() throws AbstractApplicationException
storeId
from the service contextstoreId
AbstractApplicationException
public static java.lang.Long getRunAsId() throws AbstractApplicationException
runAsId
from the service contextrunAsId
AbstractApplicationException
public static java.lang.Integer getLanguageId() throws AbstractApplicationException
languageId
from the service contextlanguageId
AbstractApplicationException
public static GiftListType populateAccessKeys(GiftListType giftListType) throws AbstractApplicationException
GiftListType
object.giftListType
- the GiftListType
object.GiftListType
object.AbstractApplicationException
GenerateGiftRegistryAccessKeyCmd
public static GiftListType populateExternalId(GiftListType giftListType) throws AbstractApplicationException
GiftListType
object.giftListType
- the GiftListType
object.GiftListType
object.AbstractApplicationException
GenerateGiftListExternalIdCmd
public static int getEventIdforAnEventName(java.lang.String eventName, java.lang.String storeId) throws AbstractApplicationException
event_id
corresponding to a event name and store identifiers
from the gift list event table. For an invalid event name the method returns 0.eventName
- The event name (e.g. Wedding)storeId
- The store identifierAbstractApplicationException
public static java.util.List executeSelectStatement(java.lang.String query, java.util.Map parameters) throws java.lang.Exception
query
- The SQL queryparameters
- The substitution parametersjava.lang.Exception
- An exception thrown by the data service during the execution of the update statementpublic static java.lang.String generateSearchKeyFirstName(java.lang.String firstName, java.lang.Object... parameters) throws AbstractApplicationException
null
otherwise.firstName
- The input for which the SOUNDEX value needs to
be generated.parameters
- Optional parameters which can assist in generation.AbstractApplicationException
public static java.lang.String generateSearchKeyLastName(java.lang.String lastName, java.lang.Object... parameters) throws AbstractApplicationException
null
lastName
- - The input for which the SOUNDEX value needs to
be generated.parameters
- - Optional parameters which can assist in generation.null
.-
- ECExceptionAbstractApplicationException
GenerateGiftRegistrySearchKeyValuesCmd#generateSearchKeyLastName(String, Object...)
public static JDBCQueryService getJDBCQueryService()
public static void validateCatalogEntry(CatalogEntryIdentifierType catalogEntryIdentifier) throws AbstractApplicationException
catalogEntryIdentifier
- The catalog entry identifier to be validated.AbstractApplicationException
- - When the catalog entry is invalid. The following error keys
are returned to signify the various errors encountered during
validation. _APP_GIFTLIST_ITEM_CATENTRYDETAIL_MISSING - When
the catalog entry identifier is null.
_APP_GIFTLIST_ITEM_CATALOGENTRY_INVALID - When the catalog
entry belong to WebSphere Commerce catalog system and
resolves to a product.
_APP_GIFTLIST_ITEM_CATALOGENTRY_NOT_FOUND - When the catalog
entry cannot be found. This means that the catalog entry does
not belong to WebSphere Commerce catalog system.public static CatalogEntryType getCatalogEntry(CatalogEntryIdentifierType catalogEntryIdentifier) throws AbstractApplicationException
catalogEntryIdentifier
- containing either the unique ID of the catalog entry or the
part number. The unique ID is given preference over the part
number if both are passed.null
is returned
when,
AbstractApplicationException
- - When an error occurs while fetching the catalog entry.public static CatalogEntryAccessBean getCatalogEntryFromCache(CatalogEntryIdentifierType catalogEntryIdentifier) throws AbstractApplicationException
catalogEntryIdentifier
- containing either the unique ID of the catalog entry or the
part number. The unique ID is given preference over the part
number if both are passed.null
is returned
when,
AbstractApplicationException
- - When an error occurs while fetching the catalog entry.public static void resolveNoun(GiftListType giftList) throws AbstractApplicationException
giftList
- - The noun to be resolved.AbstractApplicationException
- - When the noun cannot be resolved.public static void resolveGiftListRegistrant(GiftListType giftList, GiftListRegistrantType giftListRegistrant) throws AbstractApplicationException
giftList
- - Logical GiftListType.giftListRegistrant
- - GiftListRegistrantType noun part to be resolved.AbstractApplicationException
- - When the noun cannot be resolved.public static void updateGiftList(java.lang.Long giftListID) throws AbstractApplicationException
giftListID
- - The unique ID of the gift list.AbstractApplicationException
public static PhysicalDataContainer getGiftList(java.lang.Long giftListID) throws AbstractApplicationException
PhysicalDataContainer
based on
UniqueID. The physical data container is initialized using the
/GiftList[GiftListIdentifier[(UniqueID=)]]
with the
IBM_IdResolve
access profile.giftListID
- UniqueID of the gift list.AbstractApplicationException
GiftCenterMetadata#getDataServiceFacade()}
public static java.lang.String getExternalIdentifer(com.ibm.commerce.foundation.common.datatypes.GiftListIdentifierType giftListIdentifier) throws AbstractApplicationException
giftListIdentifier
- The GiftListIdentifierType
object of the gift
list noun.null
when the external identifier was not found.AbstractApplicationException
- When the external identifier could not be resolved. Possible
reasons are: The unique ID of the gift list is not valid.public static PhysicalDataContainer getGiftListRegistrants(java.lang.Long giftListID) throws AbstractApplicationException
PhysicalDataContainer
based on
UniqueID. The physical data container is initialized using the
/GiftList[GiftListIdentifier[(UniqueID=)]]
with the
IBM_GiftRegistrant_IdResolve
access profile.giftListID
- - UniqueID of the gift list.AbstractApplicationException
GiftCenterMetadata#getDataServiceFacade()}
public static java.util.Map<java.lang.String,java.lang.Long> getRegistrantsAddresses(java.lang.Long giftListUniqueID) throws AbstractApplicationException
giftListUniqueID
- - UniqueId of the gift listAbstractApplicationException
public static void setNewDefaultWishList(java.lang.String userId) throws DataMediatorException
userId
- The ID of the user who owns the wish list.DataMediatorException
public static void clearUsersDefaultWishList(java.lang.String userId) throws DataMediatorException
userId
- The ID of the user who owns the wish list.DataMediatorException
public static GiftListEncryptionHelper getGiftListEncryptionHelper()
GiftListEncryptionHelper
which is
used for performing encryption in GRUSERAUTH
tables.GiftListEncryptionHelper
GiftListEncryptionHelper}
public static GiftListContextUpdateCmd getGiftListContextUpdateCmd()
GiftListContextUpdateCmd
which is used
for performing context updates.GiftListContextUpdateCmd
GiftListContextUpdateCmd}
public static boolean useOneWayHashEncryptionForManageAccessPassword()
true
if one way encryption is enabled. Otherwise, returns false
.public static boolean useOneWayHashEncryptionForGuestAccessPassword()
public static java.lang.String getGiftListOwner(java.lang.String uniqueID) throws AbstractApplicationException
uniqueID
- The gift list uniqueIDAbstractApplicationException
- When the owner cannot be retrieved.public static CommandContext createCommandContext()
public static java.lang.Long addAddressUsingSQL(ContactInfoType contactInfoType) throws AbstractApplicationException
ContactInfoType
type.
The method can also pass the user data parameter to the table by
following the example below:
ContactInfoType contactInfo = CommerceFoundationFactory.eINSTANCE.createContactInfoType();
UserDataType userDataType = CommerceFoundationFactory.eINSTANCE.createUserDataType();
userDataType.getUserDataField().put("field1", "1001"); // Maps to GRADDR.FIELD1 INTEGER
userDataType.getUserDataField().put("field2", "1002"); // Maps to GRADDR.FIELD2 INTEGER
userDataType.getUserDataField().put("field3", "user data field 1"); // Maps to GRADDR.FIELD3 VARCHAR(64)
userDataType.getUserDataField().put("field4", "user data field 2"); // Maps to GRADDR.FIELD4 VARCHAR(64)
userDataType.getUserDataField().put("field5", "user data field 3"); // Maps to GRADDR.FIELD5 VARCHAR(64)
contactInfo.setUserData(userDataType);
contactInfoType
- the ContactInfoType
that contains the address.AbstractApplicationException
public static java.lang.Object[] getControlParamValues(ActionExpression actionExpression, java.lang.String paramName)
actionExpression
- The action expression which contains the control parametersparamName
- The control parameter namepublic static java.lang.String getEventTypeName(java.lang.Integer eventId) throws AbstractApplicationException
eventId
- The gift list event id for which the event name need to be
knownAbstractApplicationException
public static java.sql.Date getDate(java.lang.Object inputDate)
SDODataTypeHelper
inputDate
- the date in java.util.Date
formatpublic static java.lang.String getGuestAccessPassword(java.lang.String giftListUniqueId) throws AbstractApplicationException
giftListUniqueId
- The gift list unique identifierAbstractApplicationException
public static com.ibm.commerce.giftcenter.facade.server.entity.datatypes.Grgftreg getGiftListByExternalId(java.lang.String externalId) throws AbstractApplicationException
externalId
- The external identifier of the gift list.AbstractApplicationException
- When an error occurs while fetching the gift list or when the
gift list is not found.public static java.lang.String buildErrorKeyForRuleValidationError(java.lang.String primaryErrorKey, GiftListType giftList, java.lang.Integer ruleName)
<primaryErrorKey>.<Event>.<ruleName>
primaryErrorKey
- The primary error key string to which additional reason
information is appended to.giftList
- The gift list noun for which the rule validation check failed.ruleName
- The rule for which the validation failed.public static com.ibm.commerce.giftcenter.facade.server.helpers.GiftListAddressValidator getGiftListAddressValidator()
GiftListAddressValidator
which is
used for perform address field validation of the various address noun
parts in the gift list noun.GiftListAddressValidator
GiftListAddressValidator}