public class UniquePromotionCodeUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
createNewProcessFile(java.lang.String fileUploadId)
Create new process file record with file upload id.
|
static void |
deleteCodesByPromotionIdAndUsagetype(java.lang.String promotionId,
java.lang.String usageType)
Remove entries from px_cdpool table based on code's px_promotion_id and usagetype (i.e.
|
static void |
deletePromotionCodesFromOracleDMLErrorLogByStoreIDInternalIDAndReferenceID(java.lang.String storeID,
java.lang.String internalID,
java.lang.String referenceID)
Removes all codes from the PX_CDPOOL_ERROR Table based on the STORE_ID, INTERNAL_ID and REFERENCE_ID
columns.
|
static PhysicalDataContainer |
getActivePxCdPromoByPoolID(java.lang.String aPx_poolID)
Get active
Px_cdpromo physical data objects by
PX_CDPOOL_ID. |
static PhysicalDataContainer |
getCDUsageByOrderId(java.lang.Long orderId)
Get physical data objects of
Px_cdusage by order id. |
static PhysicalDataContainer |
getCDUsageByOrderIdAndPoolId(java.lang.Long orderId,
java.lang.Long cdPoolId)
Get physical data object of
Px_cdusage by order id and
promotion code id. |
static java.lang.String |
getConfigProperties(java.lang.String configKey)
Get the configuration property value from the configuration properties file
The configuration group is "UniquePromotionCode" which stores in the
wc-admin-component.xml file
|
static PhysicalDataContainer |
getEmptyPhysicalDataContainer()
Get an empty Physical Data Container
|
static java.util.List |
getExistingCodesByCodeAndStoreID(java.util.List allPromotionCodes,
java.lang.String storeID,
java.lang.String codeMin,
java.lang.String codeMax)
This method is used to determine the promotion codes that already exist
in the PX_CDPOOL table from a list of passed
promotionCodes
belonging to store with ID storeID. |
static java.util.List |
getExistingCodesByCodeStoreIDAndInternalID(java.util.List allPromotionCodes,
java.lang.String storeID,
java.lang.String codeMin,
java.lang.String codeMax,
java.lang.String internalID)
This method is used to determine the promotion codes that already exist
in the PX_CDPOOL table from a list of passed
promotionCodes
belonging to store with ID storeID. |
static java.util.List |
getExistingCodesByCodeStoreIDInternalIDAndReferenceIDUsingOracleDMLErrorLog(java.lang.String storeID,
java.lang.String internalID,
java.lang.String referenceID)
This method is used to determine the promotion codes that already exist
in the PX_CDPOOL by using the PX_CDPOOL_ERROR table that is populated
with the duplicates by Oracle's DML Error Logging feature and the codes
belong to store with ID
storeID. |
static KeyManager |
getKeyManager()
Get the key manager for the promotion component
|
static PhysicalDataContainer |
getPromotionById(java.lang.String promoId)
Get physical data object of promotion
|
static PhysicalDataContainer |
getPromotionByOrderId(java.lang.String orderId)
Get physical data object of
Px_promotion by order id. |
static PhysicalDataContainer |
getPromotionByUniqueCodeAndStatus(java.lang.String uniqueCode,
java.util.List listPromotionStatus,
java.util.List listPxCdPromoStatus,
java.util.List listPxCdPoolStatus)
Get physical data object of
Px_promotion by unique promotion
code, the status of promotion, the status of Px_cdpromo and
the status of Px_cdusage. |
static PhysicalDataContainer |
getPromotionCodePool(java.lang.String code)
This method is used to return a
PhysicalDataContainer which contains the Px_cdpool
physical objects. |
static PhysicalDataContainer |
getPromotionCodes(java.lang.String promoId)
Get the promotion related promotion code.
|
static PhysicalDataContainer |
getPromotionCodesByOrderId(java.lang.Long orderId)
Get physical data object of unique promotion by unique code
|
static PhysicalDataContainer |
getPromotionCodesByReferenceID(java.util.List referenceIDs)
Get the promotion codes with the passed list of
referenceIDs. |
static PhysicalDataContainer |
getPromotionCodeSpec(java.lang.String promoId)
Get Physical Data Container of code specification
|
static com.ibm.commerce.promotion.facade.server.entity.datatypes.Px_cdspec |
getPromotionCodeSpecPhysicalObject(int promoId)
Get the promotion code specification physical object by promotion Id
|
static com.ibm.commerce.promotion.facade.server.entity.datatypes.Px_cdspec |
getPromotionCodeSpecPhysicalObject(PhysicalDataContainer promoPDC)
Get the promotion physical object by the Physical data container
|
static Px_promotion |
getPromotionPhysicalObject(PhysicalDataContainer promoPDC)
The promotion physical data object of the promotion
|
static PhysicalDataContainer |
getPxCdPromoByPoolIDAndPromotionID(java.lang.String aPx_promotionID,
java.lang.String aPx_poolID)
Get all
Px_cdpromo physical data objects by
PX_PROMOTION_ID and PX_CDPOOL_ID. |
static PhysicalDataContainer |
getPxCdPromoByPromotionID(java.lang.String aPx_promotionID)
Get all
Px_cdpromo physical data objects by
PX_PROMOTION_ID. |
static org.w3c.dom.Document |
getXMLDocument(java.lang.String xmlString)
Generator the XML Document object based on the XML String input.
|
static boolean |
isAppliedToOrderCodeUsageStatus(int status)
This method validates if a unique promotion code status is applied
to an order status.
|
static boolean |
isCodeAvailableToUse(java.lang.Long cdPoolId)
Validates the code to see if the code is still available to use.
|
static boolean |
isPromoCodePerformanceEnhancementEnabled()
This method checks if the schema change from APAR#JR45153 has been applied to the database.
|
static boolean |
isRedeemedToOrderCodeUsageStatus(int status)
This method validates if a unique promotion code status is redeemed
to an order status.
|
static int |
updateProcessFileEndTime(java.lang.String processFileId)
This method is used to update process file end time
|
static int |
updateProcessFileProcessInfo(java.lang.String processFileId,
java.lang.String processInfo)
This method is used to update process file process info.
|
static int |
updateProcessFileStatus(java.lang.String processFileId,
int newStatus)
This method is used to update process file status.
|
static boolean |
validateUniqueCodeUsageStatus(int status)
This method validates if a unique promotion code can adds to an order by
its usage status.
|
public static PhysicalDataContainer getPromotionCodeSpec(java.lang.String promoId) throws DataMediatorException
promoId - the target promotion IdDataMediatorException - the database query exceptionpublic static PhysicalDataContainer getPromotionCodePool(java.lang.String code) throws DataMediatorException
PhysicalDataContainer which contains the Px_cdpool
physical objects. The objects are obtained using an expression that
searches by the promotion code.code - The promotion code to use to search for Px_cdpool
objects.DataMediatorException - if an exception is encountered on database query.public static com.ibm.commerce.promotion.facade.server.entity.datatypes.Px_cdspec getPromotionCodeSpecPhysicalObject(int promoId)
promoId - the target promotion Idpublic static com.ibm.commerce.promotion.facade.server.entity.datatypes.Px_cdspec getPromotionCodeSpecPhysicalObject(PhysicalDataContainer promoPDC)
promoPDC - the promotion physical data containerpublic static Px_promotion getPromotionPhysicalObject(PhysicalDataContainer promoPDC)
promoPDC - the promotion physical data containerpublic static PhysicalDataContainer getPromotionById(java.lang.String promoId) throws DataMediatorException
promoId - the target promotion IdDataMediatorExceptionpublic static PhysicalDataContainer getPromotionCodes(java.lang.String promoId) throws DataMediatorException
promoId - the target promotion IdDataMediatorExceptionpublic static PhysicalDataContainer getPromotionCodesByReferenceID(java.util.List referenceIDs) throws DataMediatorException
referenceIDs.referenceIDs - This refers to the values in the PX_CDPOOL.REFERENCE_ID column.Px_cdpool physical objects.DataMediatorException - if an error occurs during the execution of the query.public static PhysicalDataContainer getPromotionCodesByOrderId(java.lang.Long orderId) throws DataMediatorException
orderId - A Long representing the order id to be used in the method.DataMediatorException - This exception is raised when any DataMediatorException
happen.public static PhysicalDataContainer getEmptyPhysicalDataContainer()
public static KeyManager getKeyManager()
public static java.lang.String getConfigProperties(java.lang.String configKey)
configKey - the configuration property namepublic static boolean isAppliedToOrderCodeUsageStatus(int status)
status - The unique promotion usage status which need to validatepublic static boolean isRedeemedToOrderCodeUsageStatus(int status)
status - The unique promotion usage status which need to validatepublic static java.lang.String createNewProcessFile(java.lang.String fileUploadId)
throws QueryServiceApplicationException,
java.sql.SQLException
fileUploadId - A String representing the file upload record idQueryServiceApplicationExceptionjava.sql.SQLExceptionpublic static int updateProcessFileStatus(java.lang.String processFileId,
int newStatus)
throws QueryServiceApplicationException,
java.sql.SQLException
processFileId - A String representing the process file record idnewStatus - An Integer value representing the new statusQueryServiceApplicationExceptionjava.sql.SQLExceptionpublic static int updateProcessFileProcessInfo(java.lang.String processFileId,
java.lang.String processInfo)
throws QueryServiceApplicationException,
java.sql.SQLException
processFileId - A String representing the process file record idprocessInfo - A String representing the process info messageQueryServiceApplicationExceptionjava.sql.SQLExceptionpublic static int updateProcessFileEndTime(java.lang.String processFileId)
throws QueryServiceApplicationException,
java.sql.SQLException
processFileId - A String representing the process file record idQueryServiceApplicationExceptionjava.sql.SQLExceptionpublic static PhysicalDataContainer getCDUsageByOrderId(java.lang.Long orderId) throws DataMediatorException
Px_cdusage by order id.orderId - A Long representing the order id to be used in the method.DataMediatorException - This exception is raised when any DataMediatorException
happens.public static PhysicalDataContainer getCDUsageByOrderIdAndPoolId(java.lang.Long orderId, java.lang.Long cdPoolId) throws DataMediatorException
Px_cdusage by order id and
promotion code id.orderId - A Long representing the order id to be used in the method.cdPoolId - A Long representing the promotion code id to be used in the
method.DataMediatorException - This exception is raised when any DataMediatorException
happen.public static PhysicalDataContainer getPromotionByUniqueCodeAndStatus(java.lang.String uniqueCode, java.util.List listPromotionStatus, java.util.List listPxCdPromoStatus, java.util.List listPxCdPoolStatus) throws DataMediatorException
Px_promotion by unique promotion
code, the status of promotion, the status of Px_cdpromo and
the status of Px_cdusage.uniqueCode - A String representing the unique promotion code of promotionlistPromotionStatus - A List representing the allowed status of promotion. If
current parameter not set, it will default as 'Activate'
status.listPxCdPromoStatus - A List representing the allowed status of
Px_cdpromo. If current parameter not set, it will
default as 'Active' status.listPxCdPoolStatus - A List representing the allowed status of
Px_cdusage. If current parameter not set, it will
default as 'Active' status.DataMediatorException - This exception is raised when any DataMediatorException
happen.public static PhysicalDataContainer getPromotionByOrderId(java.lang.String orderId) throws DataMediatorException
Px_promotion by order id.orderId - A String representing the order idDataMediatorException - This exception is raised when any DataMediatorException
happen.public static PhysicalDataContainer getPxCdPromoByPoolIDAndPromotionID(java.lang.String aPx_promotionID, java.lang.String aPx_poolID) throws DataMediatorException
Px_cdpromo physical data objects by
PX_PROMOTION_ID and PX_CDPOOL_ID.aPx_promotionID - A String representing the PX_PROMOTION_ID.aPx_poolID - A String representing the PX_CDPOOL_ID.PhysicalDataContainer
containing the Px_cdpromo physical objects.DataMediatorException - when an error is encountered on executing the query.public static PhysicalDataContainer getPxCdPromoByPromotionID(java.lang.String aPx_promotionID) throws DataMediatorException
Px_cdpromo physical data objects by
PX_PROMOTION_ID.aPx_promotionID - A String representing the PX_PROMOTION_ID.PhysicalDataContainer
containing the Px_cdpromo physical objects.DataMediatorException - when an error is encountered on executing the query.public static PhysicalDataContainer getActivePxCdPromoByPoolID(java.lang.String aPx_poolID) throws DataMediatorException
Px_cdpromo physical data objects by
PX_CDPOOL_ID.aPx_poolID - A String representing the PX_CDPOOL_ID.PhysicalDataContainer
containing the Px_cdpromo physical objects.DataMediatorException - when an error is encountered on executing the query.public static org.w3c.dom.Document getXMLDocument(java.lang.String xmlString)
xmlString - xml string to be built to document.public static boolean isCodeAvailableToUse(java.lang.Long cdPoolId)
cdPoolId - a unique ID for the code.public static boolean validateUniqueCodeUsageStatus(int status)
status - The unique promotion usage status which need to validatepublic static java.util.List getExistingCodesByCodeStoreIDAndInternalID(java.util.List allPromotionCodes,
java.lang.String storeID,
java.lang.String codeMin,
java.lang.String codeMax,
java.lang.String internalID)
promotionCodes
belonging to store with ID storeID. The codeMin
and codeMax parameters are used to control the search
expression using a between predicate. The internalID
parameter is used in the query for the INTERNAL_ID column in the
PX_CDPOOL table.allPromotionCodes - The promotion codes to check for in the PX_CDPOOL table.storeID - The store ID for the codes in the PX_CDPOOL table.codeMin - The minimum code to compare with in the search expression.codeMax - The maximum code to compare with in the search expression.internalID - The value for the INTERNAL_ID column in PX_CDPOOL table. This
has a value of 0 for unique promotion codes and the associated
promotion ID for public promotion codes.public static java.util.List getExistingCodesByCodeAndStoreID(java.util.List allPromotionCodes,
java.lang.String storeID,
java.lang.String codeMin,
java.lang.String codeMax)
promotionCodes
belonging to store with ID storeID. The codeMin
and codeMax parameters are used to control the search
expression using a between predicate.allPromotionCodes - The promotion codes to check for in the PX_CDPOOL table.storeID - The store ID for the codes in the PX_CDPOOL table.codeMin - The minimum code to compare with in the search expression.codeMax - The maximum code to compare with in the search expression.public static void deleteCodesByPromotionIdAndUsagetype(java.lang.String promotionId,
java.lang.String usageType)
promotionId - the promotion id of the codeusageType - a string value (i.e. "0" or "1") indicating whether the code(s) is private or public respectivelypublic static java.util.List getExistingCodesByCodeStoreIDInternalIDAndReferenceIDUsingOracleDMLErrorLog(java.lang.String storeID,
java.lang.String internalID,
java.lang.String referenceID)
storeID. The internalID
parameter is used in the query for the INTERNAL_ID column in the
PX_CDPOOL_ERROR table. The referenceID parameter is used in
the query for the REFERENCE_ID column in the PX_CDPOOL_ERROR table.storeID - The store ID for the codes in the PX_CDPOOL_ERROR table.internalID - The value for the INTERNAL_ID column in PX_CDPOOL_ERROR table. This
has a value of 0 for unique promotion codes and the associated
promotion ID for public promotion codes.referenceID - The value for the REFERENCE_ID COLUMN in the PX_CDPOOL_ERROR table.
This is the promotion id that the code is associated with.public static void deletePromotionCodesFromOracleDMLErrorLogByStoreIDInternalIDAndReferenceID(java.lang.String storeID,
java.lang.String internalID,
java.lang.String referenceID)
storeID - The store id for the codes in the PX_CDPOOL_ERROR table.internalID - The internal id (0 for unique promotion codes) for the codes in the PX_CDPOOL_ERROR table.referenceID - The reference id (the promotion id that the code is associated with) for the codes in
the PX_CDPOOL_ERROR table.public static boolean isPromoCodePerformanceEnhancementEnabled()