public class BookableProductMgr extends BaseMgr implements BookableProductMgrIf
Modifier and Type | Class and Description |
---|---|
protected class |
BookableProductMgr.TimeSlot
protected class used to store a start and end time
|
Modifier and Type | Field and Description |
---|---|
protected static int |
BOOKING_COUNT_RETRIES_DEFAULT
Default for number of retries when updating booking count
|
protected static int |
bookingCountMaxRetries
Number of times to retry the booking count update SQL
|
protected static java.lang.String |
bookingCountMutex
Mutex for updating booking count
|
protected static java.lang.String |
bookProdMgrMutex
Mutex for the bookable product manager
|
protected static int |
LIMIT
number of bookings to fetch at a time in a loop
|
protected static org.apache.commons.logging.Log |
log
the log
|
templateBaseDir
Constructor and Description |
---|
BookableProductMgr(KKEngIf eng)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
doTimeSlotsOverlap(BookableProductMgr.TimeSlot ts1,
BookableProductMgr.TimeSlot ts2)
Returns true if the two time slots overlap
|
BookableProductIf |
getBookableProduct(int productId,
BookableProductOptionsIf options)
Gets a Bookable Product object for a product id
|
Product[] |
getBookableProductConflict(java.lang.String sessionId,
ProductIf bookableProd,
BookableProductOptionsIf options)
This method checks to see whether the bookable product passed in as a parameter conflicts
with any bookable products that the customer identified by the sessionId has already signed
up for.
If no conflicts are found, null is returned. |
static int |
getBookingCountMaxRetries() |
protected Bookings |
getBookingsPerCustomer(int customerId,
DataDescriptorIf dataDescriptor)
Get an array of bookings for a logged in customer.
|
Bookings |
getBookingsPerCustomer(java.lang.String sessionId,
DataDescriptorIf dataDesc,
BookableProductOptionsIf options)
Get an array of bookings for a logged in customer.
|
Bookings |
getBookingsPerProduct(DataDescriptorIf dataDescriptor,
int productId,
BookableProductOptionsIf options)
Get an array of bookings for a product.
|
protected int |
getCount(KKCriteria c)
This method is mainly used for paging.
|
protected int |
getTimeInMins(java.lang.String timeStr)
Calculates a time in minutes from a time representation in the format 00:13 or 12:45 etc.
|
protected java.util.ArrayList<BookableProductMgr.TimeSlot> |
getTimeSlots(java.lang.String times)
Returns an array of times slots from times encoded in a string in the format 10:45;11:30
15:00;16:00 where the delimiter between start and end is ";" and between times is a space
|
protected java.util.ArrayList<BookableProductMgr.TimeSlot>[] |
getWeeklySchedule(ProductIf bookableProd)
Returns an array 7 elements long where each element is for a day of the week.
|
int |
insertBooking(BookingIf booking,
BookableProductOptionsIf options)
Inserts a Booking object into the database.
|
int |
insertBooking(java.lang.String sessionId,
BookingIf booking,
BookableProductOptionsIf options)
Inserts a Booking object into the database.
|
protected void |
manageDataDescriptor(DataDescriptorIf dataDesc,
KKCriteria c)
Add constraints and order by criteria
|
void |
refreshConfigs()
Refresh the configuration of the bookable product manager
|
protected void |
setBookableProductCriteriaWithStandardAttributes(KKCriteria c)
Set the standard attributes
|
static void |
setBookingCountMaxRetries(int bookingCountMaxRetries) |
protected void |
setBookingCriteriaWithStandardAttributes(KKCriteria c)
Set the standard attributes
|
protected void |
validateBooking(BookingIf booking,
BookableProductOptionsIf options)
Validate the booking
|
acquireLock, addInsertAttr, addInsertAttr, addStringRuleConstraint, addStringRuleConstraint, checkRequired, escapeHTML, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, getAdminEngMgr, getBasketMgr, getBillingMgr, getBookableProductMgr, getCacheMgr, getCatMgr, getConfigMgr, getCookieMgr, getCurrMgr, getCustMgr, getCustomerIdFromSession, getCustomerStatsMgr, getCustomerTagMgr, getEmailMgr, getEng, getEventMgr, getExportMgr, getHTMLEscaper, getKonaKartConfig, getKonaKartConfig, getKonaKartConfig, getLangMgr, getManuMgr, getMiscItemMgr, getMiscPriceMgr, getMode, getModeString, getMqMgr, getMultiStoreMgr, getNewCriteria, getNewCriteria, getOrderIntegrationMgr, getOrderMgr, getOrderTotalMgr, getPaymentMgr, getProdMgr, getProductsToCategoresCriteria, getPromMgr, getPunchOutMgr, getRewardPointMgr, getSecMgr, getShippingMgr, getSolrMgr, getStoreId, getStoreMgr, getStoreTime, getSuggestionMgr, getTaxMgr, getTemplate, getTemplateRoot, getVelocityContextMgr, getWishListMgr, init, insertKKEvent, insertKKEvent, isBusiness, isBusinessOrEnterprise, isClassPresent, isCommunity, isDeadlockException, isEnterprise, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareCustomersOrProducts, isMultiStoreSharedDb, isMultiStoreShareProducts, isMultiVendor, isUnix, manageThrowable, releaseLock, updateStaticVariablesNow
protected static org.apache.commons.logging.Log log
protected static final int LIMIT
protected static java.lang.String bookingCountMutex
protected static final int BOOKING_COUNT_RETRIES_DEFAULT
protected static int bookingCountMaxRetries
protected static java.lang.String bookProdMgrMutex
public BookableProductMgr(KKEngIf eng) throws java.lang.Exception
eng
- the engjava.lang.Exception
- an unexpected exceptionpublic Bookings getBookingsPerProduct(DataDescriptorIf dataDescriptor, int productId, BookableProductOptionsIf options) throws com.workingdogs.village.DataSetException, org.apache.torque.TorqueException, com.konakart.app.KKException
getBookingsPerProduct
in interface BookableProductMgrIf
dataDescriptor
- the dataDescriptorproductId
- the productIdoptions
- Not used at the moment. May be left null.com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)org.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.konakart.app.KKException
- an unexpected KKException exceptionpublic Bookings getBookingsPerCustomer(java.lang.String sessionId, DataDescriptorIf dataDesc, BookableProductOptionsIf options) throws java.lang.Exception
getBookingsPerCustomer
in interface BookableProductMgrIf
dataDesc
- the dataDescsessionId
- the sessionIdoptions
- Not used at the moment. May be left null.java.lang.Exception
- an unexpected exceptionprotected Bookings getBookingsPerCustomer(int customerId, DataDescriptorIf dataDescriptor) throws java.lang.Exception
dataDescriptor
- the dataDescriptorcustomerId
- the customerIdjava.lang.Exception
- an unexpected exceptionprotected void setBookingCriteriaWithStandardAttributes(KKCriteria c)
c
- the cprotected void manageDataDescriptor(DataDescriptorIf dataDesc, KKCriteria c)
dataDesc
- the dataDescc
- the cprotected int getCount(KKCriteria c) throws org.apache.torque.TorqueException, com.workingdogs.village.DataSetException
c
- the corg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)public int insertBooking(BookingIf booking, BookableProductOptionsIf options) throws java.lang.Exception
insertBooking
in interface BookableProductMgrIf
booking
- A booking objectoptions
- Options allowing an exception to be thrown for exceeding the maximum number of
bookingsjava.lang.Exception
- an unexpected exceptionpublic int insertBooking(java.lang.String sessionId, BookingIf booking, BookableProductOptionsIf options) throws java.lang.Exception
insertBooking
in interface BookableProductMgrIf
sessionId
- the sessionIdbooking
- A booking objectoptions
- Options allowing an exception to be thrown for exceeding the maximum number of
bookingsjava.lang.Exception
- an unexpected exceptionprotected void validateBooking(BookingIf booking, BookableProductOptionsIf options) throws java.lang.Exception
booking
- the bookingoptions
- the optionsjava.lang.Exception
- an unexpected exceptionpublic BookableProductIf getBookableProduct(int productId, BookableProductOptionsIf options) throws com.workingdogs.village.DataSetException, org.apache.torque.TorqueException, com.konakart.app.KKException
getBookableProduct
in interface BookableProductMgrIf
productId
- the productIdoptions
- Not used at the moment. May be left null.com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)org.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.konakart.app.KKException
- an unexpected KKException exceptionprotected void setBookableProductCriteriaWithStandardAttributes(KKCriteria c)
c
- the cpublic Product[] getBookableProductConflict(java.lang.String sessionId, ProductIf bookableProd, BookableProductOptionsIf options) throws java.lang.Exception
getBookableProductConflict
in interface BookableProductMgrIf
sessionId
- the sessionIdbookableProd
- the bookableProdoptions
- Not used at the moment. May be left null.java.lang.Exception
- an unexpected exceptionprotected boolean doTimeSlotsOverlap(BookableProductMgr.TimeSlot ts1, BookableProductMgr.TimeSlot ts2)
ts1
- the ts1ts2
- the ts2protected java.util.ArrayList<BookableProductMgr.TimeSlot>[] getWeeklySchedule(ProductIf bookableProd) throws com.konakart.app.KKException
bookableProd
- the bookableProdcom.konakart.app.KKException
- an unexpected KKException exceptionprotected java.util.ArrayList<BookableProductMgr.TimeSlot> getTimeSlots(java.lang.String times) throws com.konakart.app.KKException
times
- the timescom.konakart.app.KKException
- an unexpected KKException exceptionprotected int getTimeInMins(java.lang.String timeStr) throws com.konakart.app.KKException
timeStr
- the timeStrcom.konakart.app.KKException
- an unexpected KKException exceptionpublic void refreshConfigs() throws java.lang.Exception
refreshConfigs
in interface BookableProductMgrIf
java.lang.Exception
- an unexpected exceptionpublic static int getBookingCountMaxRetries()
public static void setBookingCountMaxRetries(int bookingCountMaxRetries)
bookingCountMaxRetries
- the bookingCountMaxRetries to setCopyright © 2018 DS Data Systems UK Ltd.