public class SubscriptionComponentHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static long |
DAY_IN_MILLI_SECONDS
Constant to indicate the value of a day in milli seconds.
|
static long |
HOUR_IN_MILLI_SECONDS
Constant to indicate the value of an hour in milli seconds.
|
Modifier and Type | Method and Description |
---|---|
static java.util.List |
executeSelectStatement(java.lang.String query,
java.util.Map parameters)
Executes a select query
|
static java.lang.String |
findParentCatalogEntryID(java.lang.String catentryId)
This method is used to find the Catentry ID of the parent, given a child catentry ID
|
static CommandContext |
getCommandContext()
This method returns the Command Context instance for this request.
|
static long |
getDateDifferenceInDays(java.util.Date date1,
java.util.Date date2)
Returns the difference between two dates in terms of days.
|
static long |
getDateDifferenceInHours(java.util.Date date1,
java.util.Date date2)
Returns the difference between two dates in terms of hours.
|
static JDBCQueryService |
getJDBCQueryService()
Gets the JDBC query service instance.
|
static OrderType |
getOrder(java.lang.String orderId)
This method retrieves the order using the order ID specified.
|
static ScheduleEvaluateCmd |
getScheduleEvaluateCmd(java.lang.String scheduleType)
This method returns the schedule evaluate command based on the schedule
type specified.
|
static java.lang.Integer |
getStoreId()
This method returns the store ID from the business context.
|
static Subscription |
getSubscriptionById(java.lang.Long subscriptionId)
This method returns the physical Subscription entity based on the
subscriptionId specified. |
static SubscriptionDetailsValidator |
getSubscriptionDetailsValidator()
Gets the instance of the
SubscriptionDetailsValidator which is
used for perform validation of the various fields
passed in the Subscription noun. |
static java.lang.Long |
getTemplateIDForSubscription(java.lang.Long catalogEntryID)
This method returns the template identifier corresponding
to the input catalog entry identifier.
|
static java.lang.Long |
getUserId()
This method returns the user ID from the context.
|
static boolean |
isQtyUnitValid(java.lang.String qtyUnitId)
This method checks whether the given quantity unit is
valid and exists in the database.
|
static boolean |
isSubscriptionTypeCodeValid(java.lang.String subscriptionTypeCode)
This method checks if the given subscription type code is valid and
exists in the data base.
|
static java.lang.Integer |
updateSubscriptionState(java.lang.Long subscriptionId,
java.lang.Integer state,
boolean isTransient)
This method updates the state of the subscription as a separate
transaction.
|
public static final long DAY_IN_MILLI_SECONDS
public static final long HOUR_IN_MILLI_SECONDS
public static java.lang.Integer getStoreId() throws SubscriptionApplicationException
SubscriptionApplicationException
- if an error occurs while retrieving the store ID or the store ID is null.public static java.lang.Long getUserId() throws SubscriptionApplicationException
SubscriptionApplicationException
- When an error occurs while retrieving the user ID or when the
user ID is null.public static CommandContext getCommandContext()
public static OrderType getOrder(java.lang.String orderId) throws SubscriptionApplicationException
orderId
- The order ID of the order.OrderType
instance retrieved using the OrderServices.SubscriptionApplicationException
- When an error occurs while retrieving the order.public static long getDateDifferenceInDays(java.util.Date date1, java.util.Date date2)
date1
- The first date.date2
- The second date.public static long getDateDifferenceInHours(java.util.Date date1, java.util.Date date2)
date1
- The first date.date2
- The second date.public static boolean isSubscriptionTypeCodeValid(java.lang.String subscriptionTypeCode)
subscriptionTypeCode
- The subscription type code to validate.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 JDBCQueryService getJDBCQueryService()
public static Subscription getSubscriptionById(java.lang.Long subscriptionId)
subscriptionId
specified. If the subscription entity could
not be resolved, this method returns null
.subscriptionId
- The subscription ID of the subscription being retrieved.Subscription
physical entity if found.
null
Otherwise.public static ScheduleEvaluateCmd getScheduleEvaluateCmd(java.lang.String scheduleType)
scheduleType
- The type of schedule for which the command is being
instantiated.ScheduleEvaluateCmd
for
the ScheduleInfoType
specified.public static java.lang.Integer updateSubscriptionState(java.lang.Long subscriptionId, java.lang.Integer state, boolean isTransient)
isTransient
flag, the method
either updates the permanent state or the transient state.
If the update fails at any step, the transaction created in the method is
rolled back.subscriptionId
- The subscription ID of the subscription to be updated.state
- The state to which the subscription is to be updated.isTransient
- boolean to indicate if the state being changed is a transient
state or a permanent state.public static java.lang.String findParentCatalogEntryID(java.lang.String catentryId)
catentryId
- The catentry ID whose parent is to be determinedpublic static boolean isQtyUnitValid(java.lang.String qtyUnitId)
qtyUnitId
- The quantity unit ID to validate.public static SubscriptionDetailsValidator getSubscriptionDetailsValidator()
SubscriptionDetailsValidator
which is
used for perform validation of the various fields
passed in the Subscription noun.SubscriptionDetailsValidator
SubscriptionDetailsValidator}
public static java.lang.Long getTemplateIDForSubscription(java.lang.Long catalogEntryID) throws DataMediatorException
catalogEntryID
- The catalog entry identifier.DataMediatorException