Class BasketImpl
java.lang.Object
de.hybris.platform.sap.core.bol.businessobject.BusinessObjectBase
de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.impl.SimpleDocumentImpl<L,I,H>
de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.impl.SalesDocumentBaseImpl<ItemList,Item,Header>
de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.businessobject.impl.SalesDocumentImpl
de.hybris.platform.sap.sapordermgmtbol.transaction.basket.businessobject.impl.BasketImpl
- All Implemented Interfaces:
BackendAware,BusinessObject,MessageListHolder,Basket,SalesDocument,SalesDocumentBase<ItemList,,Item, Header> SimpleDocument<ItemList,,Item, Header> Serializable,Cloneable,Iterable<Item>
Shopping basket BO implementation. The well known methaphor of a shopping basket is implemented using this class. The
basket consist of several items, and header information.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BasketOrderConsistencyEnsures consistency between basket and orderFields inherited from class de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.businessobject.impl.SalesDocumentImpl
alreadyInitialized, backendService, checkCatalogNecessary, determinationRequired, externalToOrder, grossValueAvailable, itemsWithAlternativeProductList, netValueAvailable, pricesTraced, redemptionValue, transactionConfigurationFields inherited from class de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.impl.SalesDocumentBaseImpl
billToList, changeHeaderOnly, persistentInBackend, shipToListFields inherited from class de.hybris.platform.sap.core.bol.businessobject.BusinessObjectBase
backendObject, backendType, bobMessages, bobState, extensionData, genericFactory, handle, moduleConfigurationAccess, techKeyFields inherited from interface de.hybris.platform.sap.core.common.message.MessageListHolder
INVALID, VALIDFields inherited from interface de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.interf.SalesDocumentBase
NO_OF_ITEMS_UNKNOWN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Makes a copy of the object.voiddestroy()Callback method for theBusinessObjectManagerto tell the object that life is over and that it has to release all ressources.booleanCompares this object to the specified object.protected SalesDocumentBackendMethod retrieving the backend object for the object.inthashCode()Returns the hash code for this object.booleanCheck whether its required to Update the objectprotected booleanvoidread(boolean force) Overwrites the super implementation.
Checks if basket and order are consistent.voidreadForUpdate(boolean force) Reads the sales document for update (tried to get a lock).voidrelease()Releases cart object.protected voidRemoves empty items (blank product ID) from item listbooleanSaves the order in the backend.voidsetBackendService(BasketBackend service) This method can be used to set a fixed back end service (e.g.voidsetBasketOrderConsistency(BasketOrderConsistency basketOrderConsistency) Injects the basketOrderConsisteny into the basketvoidsetUpdateMissing(boolean updateMissing) Sets whether update before save is required.voidupdate()Update the sales document in the backend.Methods inherited from class de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.businessobject.impl.SalesDocumentImpl
adaptHeaderDocumentType, addShipTo, afterDeleteItemInBackend, afterDeleteItemInBackend, afterUpdateItemInBackend, clearItemBuffer, clearShipTos, createBillTo, createInBackend, createItem, createItemKey, createShipTo, deleteItemInt, destroyContent, determineConfigurableItemsToRelease, emptyContent, getDocumentType, getDublicatesForItems, getSalesDocumentHooks, getSessionService, getSoldToGuid, getTransactionConfiguration, hasPredecessorOfSpecificType, init, init, init, isBackendDown, isCheckCatalogNecessary, isDeterminationRequired, isExistingInBackend, isExternalToOrder, isGrossValueAvailable, isInitialized, isItemBasedAvailability, isMultipleAddressesSupported, isNetValueAvailable, mergeIdenticalProducts, mergingItem, prepareItemsWithChangedProducts, processItems, read, readForUpdate, removeItem, removeItems, setBillToList, setCheckCatalogNecessary, setConverter, setDeterminationRequired, setExternalToOrder, setGrossValueAvailable, setInitialized, setNetValueAvailable, setSalesDocumentHooks, setSessionService, setShipToList, setSoldToGuid, setSoldToGuid, setTransactionConfiguration, toString, updateInBackend, validateMethods inherited from class de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.impl.SalesDocumentBaseImpl
clear, getAlternativeBillTos, getAlternativeShipTos, isChangeHeaderOnly, isPersistentInBackend, setPersistentInBackendMethods inherited from class de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.impl.SimpleDocumentImpl
addItem, clearHeader, clearItems, clearMessages, getApplicationId, getChangeDate, getHeader, getItem, getItemList, getTypedExtensionMap, getVersion, isDirty, iterator, setApplicationId, setChangeDate, setDirty, setHeader, setItemList, setTechKey, setVersionMethods inherited from class de.hybris.platform.sap.core.bol.businessobject.BusinessObjectBase
addExtensionData, addMessage, clearMessages, clearOwnMessages, copyMessages, copyMessages, createUniqueHandle, determineBackendObject, getBackendBusinessObject, getBackendBusinessObject, getBackendType, getExtensionData, getExtensionDataValues, getExtensionMap, getHandle, getMessageList, getModuleConfigurationAccess, getOwnMessageList, getSubObjectIterator, getTechKey, hasHandle, hasMessages, hasOwnMessages, init, isValid, logMessage, removeExtensionData, removeExtensionDataValues, setBackendObject, setBackendType, setExtensionMap, setGenericFactory, setHandle, setInvalid, setModuleConfigurationAccess, setValidMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface de.hybris.platform.sap.core.bol.businessobject.BusinessObject
addExtensionData, clearMessages, clearOwnMessages, copyMessages, copyMessages, createUniqueHandle, getExtensionData, getExtensionDataValues, getExtensionMap, getHandle, getOwnMessageList, getSubObjectIterator, getTechKey, hasHandle, hasMessages, hasOwnMessages, init, isValid, logMessage, removeExtensionData, removeExtensionDataValues, setExtensionMap, setHandle, setInvalid, setTechKey, setValidMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface de.hybris.platform.sap.core.common.message.MessageListHolder
addMessage, clearMessages, getMessageListMethods inherited from interface de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.interf.SalesDocument
afterDeleteItemInBackend, clearItemBuffer, clearShipTos, createBillTo, createItem, createShipTo, destroyContent, getDocumentType, getTransactionConfiguration, hasPredecessorOfSpecificType, init, init, isBackendDown, isCheckCatalogNecessary, isExistingInBackend, isExternalToOrder, isGrossValueAvailable, isInitialized, isItemBasedAvailability, isMultipleAddressesSupported, isNetValueAvailable, read, readForUpdate, removeItem, removeItems, setBillToList, setCheckCatalogNecessary, setConverter, setExternalToOrder, setGrossValueAvailable, setInitialized, setNetValueAvailable, setShipToList, setSoldToGuid, setTransactionConfiguration, validateMethods inherited from interface de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.interf.SalesDocumentBase
getAlternativeBillTos, getAlternativeShipTos, isChangeHeaderOnly, isDeterminationRequired, isPersistentInBackend, setDeterminationRequired, setPersistentInBackendMethods inherited from interface de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.interf.SimpleDocument
addItem, clear, clearHeader, clearItems, getApplicationId, getChangeDate, getHeader, getItem, getItemList, getSoldToGuid, getTypedExtensionMap, getVersion, isDirty, setApplicationId, setChangeDate, setDirty, setHeader, setItemList, setSoldToGuid, setVersion
-
Field Details
-
basketOrderConsistency
Ensures consistency between basket and order
-
-
Constructor Details
-
BasketImpl
public BasketImpl()
-
-
Method Details
-
isUpdateMissing
public boolean isUpdateMissing()Description copied from interface:SalesDocumentCheck whether its required to Update the object- Specified by:
isUpdateMissingin interfaceSalesDocument- Overrides:
isUpdateMissingin classSalesDocumentImpl- Returns:
true, only if the object has to be updated
-
setUpdateMissing
public void setUpdateMissing(boolean updateMissing) Description copied from interface:SalesDocumentSets whether update before save is required. Has to be set to true for initial objects to ensure that update is called at least once before save.- Specified by:
setUpdateMissingin interfaceSalesDocument- Overrides:
setUpdateMissingin classSalesDocumentImpl- Parameters:
updateMissing- set totrueto force an update before next save
-
destroy
public void destroy()Callback method for theBusinessObjectManagerto tell the object that life is over and that it has to release all ressources.- Specified by:
destroyin interfaceBusinessObject- Overrides:
destroyin classSalesDocumentImpl
-
getBackendService
Method retrieving the backend object for the object.- Specified by:
getBackendServicein classSalesDocumentImpl- Returns:
- Backend object to be used
- Throws:
BackendException
-
saveAndCommit
Saves the order in the backend.- Specified by:
saveAndCommitin interfaceSalesDocument- Specified by:
saveAndCommitin classSalesDocumentImpl- Returns:
- true if the save and commit was successful
- Throws:
CommunicationException
-
setBackendService
This method can be used to set a fixed back end service (e.g. mock it)- Parameters:
service- back end service to be used by this basket
-
setBasketOrderConsistency
Description copied from interface:BasketInjects the basketOrderConsisteny into the basket- Specified by:
setBasketOrderConsistencyin interfaceBasket- Parameters:
basketOrderConsistency- consistency manager
-
read
Overwrites the super implementation.
Checks if basket and order are consistent. If the data was not consistent a update is triggered before the read- Specified by:
readin interfaceBasket- Specified by:
readin interfaceSalesDocument- Overrides:
readin classSalesDocumentImpl- Parameters:
force- If true, then read even if not considered as necessary- Throws:
CommunicationException- in case back-end error- See Also:
-
readForUpdate
Description copied from interface:SalesDocumentReads the sales document for update (tried to get a lock). The backend call happens if considered as necessary or if forced.- Specified by:
readForUpdatein interfaceSalesDocument- Overrides:
readForUpdatein classSalesDocumentImpl- Parameters:
force- If true, then read even if not considered as necessary- Throws:
CommunicationException- in case back-end error
-
update
Description copied from interface:SalesDocumentUpdate the sales document in the backend. The method also checks for changes in the businesspartner list- Specified by:
updatein interfaceSalesDocument- Overrides:
updatein classSalesDocumentImpl- Throws:
CommunicationException- in case back-end error
-
removeEmptyItemsFromItemList
protected void removeEmptyItemsFromItemList()Removes empty items (blank product ID) from item list -
clone
Description copied from class:BusinessObjectBaseMakes a copy of the object. The MessageList is copied.- Overrides:
clonein classBusinessObjectBase- Returns:
- a copy of object
- Throws:
CloneNotSupportedException-CloneNotSupportedException
-
calculateTotalQuantity
- Specified by:
calculateTotalQuantityin interfaceBasket- Returns:
- the total quantity of the products in basket
-
mergeIdenticalProductsIfRequired
- Overrides:
mergeIdenticalProductsIfRequiredin classSalesDocumentImpl- Throws:
CommunicationException
-
release
Description copied from interface:BasketReleases cart object. Afterwards, cart is fully initialized- Specified by:
releasein interfaceBasket- Throws:
CommunicationException
-
hashCode
public int hashCode()Description copied from class:BusinessObjectBaseReturns the hash code for this object.- Overrides:
hashCodein classBusinessObjectBase- Returns:
- Hash code
-
equals
Description copied from class:BusinessObjectBaseCompares this object to the specified object. The result istrueif and only if the argument is notnulland is of the same class that has the same technical key (TechKey) as this object.- Overrides:
equalsin classBusinessObjectBase- Parameters:
obj- Object to compare with- Returns:
trueif the objects are identical; otherwiesefalse.
-