Class SalesDocumentImpl
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
- All Implemented Interfaces:
BackendAware,BusinessObject,MessageListHolder,SalesDocument,SalesDocumentBase<ItemList,,Item, Header> SimpleDocument<ItemList,,Item, Header> Serializable,Cloneable,Iterable<Item>
- Direct Known Subclasses:
BasketImpl,OrderImpl
public abstract class SalesDocumentImpl
extends SalesDocumentBaseImpl<ItemList,Item,Header>
implements SalesDocument
Common superclass for all sales documents.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected SalesDocumentBackendprotected booleanprotected booleanprotected booleanprotected booleanThis list stores items with alternative products.protected booleanprotected booleanprotected Stringredemption valueprotected 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 TypeMethodDescriptionprotected voidSets the document type on the document header depending on the Java class instance of the Sales Document (evaluated withinstanceof).voidAdds a shipTo to the shipTo listvoidReleases all configuration sessions attached to this sales documentprotected voidafterDeleteItemInBackend(List<TechKey> itemsToDelete) Releases configuration sessions for all items providedprotected voidafterUpdateItemInBackend(List<TechKey> itemsToDelete) Releases configuration sessions for all items providedvoidRemoves all buffered item informationvoidClears the list of the shipTo.Creates a new billTo objectprotected voidGets a new Item objectprotected StringcreateItemKey(Item toCheck) Creates a new ship objectprotected voiddeleteItemInt(TechKey techKey) Deletes the item with the given Techkeyvoiddestroy()Method will be called by theBusinessObjectManagerwhen the end of the life cycle is reached, so that all used resources can be released.voidDestroy the data of the document (items and header) in the backend representation.voidResets the entire document to empty state.protected abstract SalesDocumentBackendMethod retrieving the backend object for the object.Returns the type of the sales document (e.g.de.hybris.platform.servicelayer.session.SessionServiceReturns the transaction configuration.booleanhasPredecessorOfSpecificType(DocumentType docType) Scans list of predecessors for given document type.voidinit(PartnerList partnerList) Initializes the sales document with the given arguments and creates and instance in back-end application memory.voidinit(PartnerList partnerList, String processType) Initializes a sales documentvoidinit(SalesDocument source, String processType) Initializes an empty instance of this object with the data coming from the provided document.booleanbooleanDoes the document require that the items are checked against the catalog?booleanDetermines if manual Product-, Campaign-, ...booleanChecks if the document exists in the backend storagebooleanIndicates whether or not the order has to be maintained as an external document to this one.booleanIndicates whether or not the sales document can provide the Gross value.booleanDoes the document carry an initialization error?booleanChecks if availability is compiled only based on item information.booleanReturns if multiple addresses are supportedbooleanIndicates whether or not the sales document can provide a net value.booleanCheck whether its required to Update the objectprotected booleanMerges identical products (this is told from the product ID) and states whether changes have been doneprotected booleanprotected voidmergingItem(List<Item> mergeItems, Item merged, double sumQty, int discarded) protected voidprotected StringBuilderprocessItems(SalesDocument source) voidread()Reads the sales document.voidread(boolean force) Reads the sales document.voidReads the sales document for update (tried to get a lock).voidreadForUpdate(boolean force) Reads the sales document for update (tried to get a lock).voidremoveItem(Item item) Removes the item.voidremoveItems(TechKey[] techKeys) Deletes items from the sales document.abstract booleanAbstract Dummy implementation of interface methodvoidsetBillToList(List<BillTo> billToList) Sets BillTo listvoidsetCheckCatalogNecessary(boolean checkCatalogNecessary) Indicates whether a check of the items against the catalog is requiredvoidsetConverter(Converter converter) voidsetDeterminationRequired(boolean isDeterminationRequired) Sets the isDeterminationRequired flagvoidsetExternalToOrder(boolean isExternalToOrder) Sets whether or not the order has to be maintained as an external document to this one.voidsetGrossValueAvailable(boolean isGrossValueAvailable) Sets the property grossValueAvailablevoidsetInitialized(boolean b) Indicates whether a sales document could be initializedvoidsetNetValueAvailable(boolean isNetValueAvailable) Sets the property netValueAvailablevoidsetSalesDocumentHooks(List<SalesDocumentHook> salesDocumentHooks) voidsetSessionService(de.hybris.platform.servicelayer.session.SessionService sessionService) voidsetShipToList(List<ShipTo> shipToList) Sets shipTo listvoidsetSoldToGuid(TechKey techKeySoldTo) voidsetSoldToGuid(TechKey techKeySoldTo, String soldToId) voidThe transaction configuration provides access to sales-specific settings (e.g.voidsetUpdateMissing(boolean updateMissing) Sets whether update before save is required.toString()Returns a string representation of the objectvoidupdate()Update the sales document in the backend.protected voidupdateInBackend(List<TechKey> itemsToDelete, List<TechKey> configurableItemsToRelease) voidvalidate()Validates as sales document.Methods 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, clone, copyMessages, copyMessages, createUniqueHandle, determineBackendObject, equals, getBackendBusinessObject, getBackendBusinessObject, getBackendType, getExtensionData, getExtensionDataValues, getExtensionMap, getHandle, getMessageList, getModuleConfigurationAccess, getOwnMessageList, getSubObjectIterator, getTechKey, hasHandle, hashCode, 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.SalesDocumentBase
getAlternativeBillTos, getAlternativeShipTos, isChangeHeaderOnly, isPersistentInBackend, setPersistentInBackendMethods inherited from interface de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.interf.SimpleDocument
addItem, clear, clearHeader, clearItems, getApplicationId, getChangeDate, getHeader, getItem, getItemList, getTypedExtensionMap, getVersion, isDirty, setApplicationId, setChangeDate, setDirty, setHeader, setItemList, setVersion
-
Field Details
-
transactionConfiguration
-
backendService
-
alreadyInitialized
protected boolean alreadyInitialized -
externalToOrder
protected boolean externalToOrder -
checkCatalogNecessary
protected boolean checkCatalogNecessary -
redemptionValue
redemption value -
determinationRequired
protected boolean determinationRequired -
grossValueAvailable
protected boolean grossValueAvailable -
netValueAvailable
protected boolean netValueAvailable -
pricesTraced
protected boolean pricesTraced -
itemsWithAlternativeProductList
This list stores items with alternative products. For these items events should only be fired when a product is selected (see int msg 385863 2010).
-
-
Constructor Details
-
SalesDocumentImpl
public SalesDocumentImpl()
-
-
Method Details
-
isCheckCatalogNecessary
public boolean isCheckCatalogNecessary()Description copied from interface:SalesDocumentDoes the document require that the items are checked against the catalog?- Specified by:
isCheckCatalogNecessaryin interfaceSalesDocument- Returns:
- true if check is required
-
setCheckCatalogNecessary
public void setCheckCatalogNecessary(boolean checkCatalogNecessary) Description copied from interface:SalesDocumentIndicates whether a check of the items against the catalog is required- Specified by:
setCheckCatalogNecessaryin interfaceSalesDocument- Parameters:
checkCatalogNecessary- if check is required
-
adaptHeaderDocumentType
Sets the document type on the document header depending on the Java class instance of the Sales Document (evaluated withinstanceof).- Throws:
CommunicationException
-
addShipTo
Adds a shipTo to the shipTo list- Parameters:
shipTo- shipTo to add
-
clearShipTos
public void clearShipTos()Description copied from interface:SalesDocumentClears the list of the shipTo.- Specified by:
clearShipTosin interfaceSalesDocument
-
createBillTo
Description copied from interface:SalesDocumentCreates a new billTo object- Specified by:
createBillToin interfaceSalesDocument- Returns:
- Newly created billTo
-
createItem
Description copied from interface:SalesDocumentGets a new Item object- Specified by:
createItemin interfaceSalesDocument- Specified by:
createItemin interfaceSimpleDocument<ItemList,Item, Header> - Returns:
- new item instance
- See Also:
-
createShipTo
Description copied from interface:SalesDocumentCreates a new ship object- Specified by:
createShipToin interfaceSalesDocument- Returns:
- Newly created shipTo
-
deleteItemInt
Deletes the item with the given Techkey- Parameters:
techKey-- Throws:
CommunicationException
-
removeItems
Description copied from interface:SalesDocumentDeletes items from the sales document.- Specified by:
removeItemsin interfaceSalesDocument- Parameters:
techKeys- Technical keys of the items to be canceld- Throws:
CommunicationException- in case back-end error
-
destroy
public void destroy()Description copied from class:SalesDocumentBaseImplMethod will be called by theBusinessObjectManagerwhen the end of the life cycle is reached, so that all used resources can be released.- Specified by:
destroyin interfaceBusinessObject- Overrides:
destroyin classSalesDocumentBaseImpl<ItemList,Item, Header>
-
destroyContent
Description copied from interface:SalesDocumentDestroy the data of the document (items and header) in the backend representation. After a call to this method, the object is in an undefined state. You have to call init() before you can use it again.
This method is normally called before removing the BO-representation of the object using the BOM.- Specified by:
destroyContentin interfaceSalesDocument- Throws:
CommunicationException- in case back-end error
-
emptyContent
Resets the entire document to empty state.- Throws:
CommunicationException- in case of aback-end error
-
getBackendService
Method retrieving the backend object for the object. This method is abstract because every concrete subclass ofSalesDocumentmay use its own implementation of a backend object.- Returns:
- Backend object to be used
- Throws:
BackendException
-
getDocumentType
Description copied from interface:SalesDocumentReturns the type of the sales document (e.g. Order, Basket)- Specified by:
getDocumentTypein interfaceSalesDocument- Returns:
- type of sales document
- Throws:
CommunicationException- in case back-end error
-
getTransactionConfiguration
Description copied from interface:SalesDocumentReturns the transaction configuration. The transaction configuration provides access to sales-specific settings (e.g. sales organisation)- Specified by:
getTransactionConfigurationin interfaceSalesDocument- Returns:
- TransactionConfiguration to access the sales-related configuration
-
init
Initializes a sales document- Parameters:
partnerList- Partner listprocessType- Sales document type- Throws:
CommunicationException
-
init
Description copied from interface:SalesDocumentInitializes the sales document with the given arguments and creates and instance in back-end application memory.- Specified by:
initin interfaceSalesDocument- Parameters:
partnerList- any partners maintained will be added to the sales document in the same partner function- Throws:
CommunicationException- in case back-end error
-
init
Description copied from interface:SalesDocumentInitializes an empty instance of this object with the data coming from the provided document. The former state of this document is dropped and lost, the fields of the other document are copied into the fields of this document. To do this the clone() method of the fields is used to get an shallow copy and minimise interference between the new and the old object. The creation date of the old document is not copied to the new one but the original date is left as it is. A back-end representation of the new object is created and filled with the data retrieved by the copy operation.- Specified by:
initin interfaceSalesDocument- Parameters:
source- The SalesDocument to retrieve data fromprocessType- process type for the new SalesDocument (optional)- Throws:
BusinessObjectException- in case back-end error
-
processItems
- Parameters:
source-- Returns:
-
createInBackend
- Throws:
BusinessObjectException
-
isExistingInBackend
public boolean isExistingInBackend()Description copied from interface:SalesDocumentChecks if the document exists in the backend storage- Specified by:
isExistingInBackendin interfaceSalesDocument- Returns:
- does the document exist in backend?
-
isDeterminationRequired
public boolean isDeterminationRequired()Description copied from interface:SalesDocumentBaseDetermines if manual Product-, Campaign-, ... Determination is necessary for at least one top level item.- Specified by:
isDeterminationRequiredin interfaceSalesDocumentBase<ItemList,Item, Header> - Returns:
- boolean true if there is at least on item that needs manual determination for products, camapigns, etc.
-
isExternalToOrder
public boolean isExternalToOrder()Description copied from interface:SalesDocumentIndicates whether or not the order has to be maintained as an external document to this one. (e.g. java basket is external to crm backend order)- Specified by:
isExternalToOrderin interfaceSalesDocument- Returns:
- true indicates that the order is maintained external to this document, false indicates that the order lies on the same system.
-
isGrossValueAvailable
public boolean isGrossValueAvailable()Description copied from interface:SalesDocumentIndicates whether or not the sales document can provide the Gross value.- Specified by:
isGrossValueAvailablein interfaceSalesDocument- Returns:
- true indicates that the sales document can provide the gross value. false indicates that the sales document can not deliver the gross value.
-
isMultipleAddressesSupported
Description copied from interface:SalesDocumentReturns if multiple addresses are supported- Specified by:
isMultipleAddressesSupportedin interfaceSalesDocument- Returns:
- multiple addresses supported
- Throws:
BusinessObjectException- in case back-end error
-
isNetValueAvailable
public boolean isNetValueAvailable()Description copied from interface:SalesDocumentIndicates whether or not the sales document can provide a net value.- Specified by:
isNetValueAvailablein interfaceSalesDocument- Returns:
- true indicates that the sales document can provide the net value false indicates that the sales document can not deliver the net value.
-
isUpdateMissing
public boolean isUpdateMissing()Description copied from interface:SalesDocumentCheck whether its required to Update the object- Specified by:
isUpdateMissingin interfaceSalesDocument- Returns:
true, only if the object has to be updated
-
mergeIdenticalProducts
Merges identical products (this is told from the product ID) and states whether changes have been done- Returns:
- did we do changes?
- Throws:
CommunicationException
-
mergingItem
- Parameters:
mergeItems-merged-sumQty-discarded-
-
getDublicatesForItems
-
createItemKey
-
read
Description copied from interface:SalesDocumentReads the sales document. The backend call happens only if necessary.- Specified by:
readin interfaceSalesDocument- Throws:
CommunicationException- in case back-end error
-
read
Description copied from interface:SalesDocumentReads the sales document. The backend call happens if considered as necessary or if forced.- Specified by:
readin interfaceSalesDocument- Parameters:
force- If true, then read even if not considered as necessary- Throws:
CommunicationException- in case back-end error
-
readForUpdate
Description copied from interface:SalesDocumentReads the sales document for update (tried to get a lock). The backend call happens only if necessary.- Specified by:
readForUpdatein interfaceSalesDocument- Throws:
CommunicationException- in case back-end error
-
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- Parameters:
force- If true, then read even if not considered as necessary- Throws:
CommunicationException- in case back-end error
-
removeItem
Description copied from interface:SalesDocumentRemoves the item.- Specified by:
removeItemin interfaceSalesDocument- Parameters:
item- to remove- Throws:
CommunicationException- in case back-end error
-
saveAndCommit
Abstract Dummy implementation of interface method- Specified by:
saveAndCommitin interfaceSalesDocument- Returns:
- true if the save and commit was successful
- Throws:
CommunicationException
-
setDeterminationRequired
public void setDeterminationRequired(boolean isDeterminationRequired) Description copied from interface:SalesDocumentBaseSets the isDeterminationRequired flag- Specified by:
setDeterminationRequiredin interfaceSalesDocumentBase<ItemList,Item, Header> - Parameters:
isDeterminationRequired- true if there are items that need manual determination either for camapigns, substitution products or something similar
-
setExternalToOrder
public void setExternalToOrder(boolean isExternalToOrder) Description copied from interface:SalesDocumentSets whether or not the order has to be maintained as an external document to this one. (e.g. a java basket is an external document to crm backend order)- Specified by:
setExternalToOrderin interfaceSalesDocument- Parameters:
isExternalToOrder- true indicates that the order is maintained external to this document, false indicates that the order lies on the same system.
-
setGrossValueAvailable
public void setGrossValueAvailable(boolean isGrossValueAvailable) Description copied from interface:SalesDocumentSets the property grossValueAvailable- Specified by:
setGrossValueAvailablein interfaceSalesDocument- Parameters:
isGrossValueAvailable- true indicates that the sales document can provide the gross valuefalseindicates that the sales document can not provide the gross value.
-
setNetValueAvailable
public void setNetValueAvailable(boolean isNetValueAvailable) Description copied from interface:SalesDocumentSets the property netValueAvailable- Specified by:
setNetValueAvailablein interfaceSalesDocument- Parameters:
isNetValueAvailable- true indicates that the sales document can deliver the net value false indicates that the sales document can not deliver the net value.
-
setShipToList
Description copied from interface:SalesDocumentSets shipTo list- Specified by:
setShipToListin interfaceSalesDocument- Parameters:
shipToList- list of ShipTo's
-
setBillToList
Description copied from interface:SalesDocumentSets BillTo list- Specified by:
setBillToListin interfaceSalesDocument- Parameters:
billToList- list of BillTo's
-
setTransactionConfiguration
Description copied from interface:SalesDocumentThe transaction configuration provides access to sales-specific settings (e.g. sales organisation)- Specified by:
setTransactionConfigurationin interfaceSalesDocument- Parameters:
transConf- API to access the configuration and documents
-
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- Parameters:
updateMissing- set totrueto force an update before next save
-
toString
Returns a string representation of the object- Overrides:
toStringin classSimpleDocumentImpl<ItemList,Item, Header> - Returns:
- String representation
-
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- Throws:
CommunicationException- in case back-end error
-
updateInBackend
protected void updateInBackend(List<TechKey> itemsToDelete, List<TechKey> configurableItemsToRelease) throws BackendException, CommunicationException, BusinessObjectException - Parameters:
itemsToDelete-configurableItemsToRelease-- Throws:
BackendExceptionCommunicationExceptionBusinessObjectException
-
determineConfigurableItemsToRelease
-
mergeIdenticalProductsIfRequired
- Throws:
CommunicationException
-
prepareItemsWithChangedProducts
protected void prepareItemsWithChangedProducts() -
getSoldToGuid
- Specified by:
getSoldToGuidin interfaceSimpleDocument<ItemList,Item, Header> - Overrides:
getSoldToGuidin classSimpleDocumentImpl<ItemList,Item, Header> - Returns:
- techKey GUID of the soldTo
-
setSoldToGuid
- Specified by:
setSoldToGuidin interfaceSimpleDocument<ItemList,Item, Header> - Overrides:
setSoldToGuidin classSimpleDocumentImpl<ItemList,Item, Header> - Parameters:
techKeySoldTo- GUID of the soldTo
-
setSoldToGuid
- Specified by:
setSoldToGuidin interfaceSalesDocument- Parameters:
techKeySoldTo- the guid of the soldtosoldToId- the partner id of the soldto
-
clearItemBuffer
public void clearItemBuffer()Description copied from interface:SalesDocumentRemoves all buffered item information- Specified by:
clearItemBufferin interfaceSalesDocument
-
hasPredecessorOfSpecificType
Description copied from interface:SalesDocumentScans list of predecessors for given document type.- Specified by:
hasPredecessorOfSpecificTypein interfaceSalesDocument- Parameters:
docType- to be searched for in predecessors- Returns:
- true if predecessor list contains given doc type
-
setInitialized
public void setInitialized(boolean b) Description copied from interface:SalesDocumentIndicates whether a sales document could be initialized- Specified by:
setInitializedin interfaceSalesDocument- Parameters:
b- true if initialization was not possible
-
isInitialized
public boolean isInitialized()Description copied from interface:SalesDocumentDoes the document carry an initialization error?- Specified by:
isInitializedin interfaceSalesDocument- Returns:
- true if initialization was not possible
-
isItemBasedAvailability
public boolean isItemBasedAvailability()Description copied from interface:SalesDocumentChecks if availability is compiled only based on item information.- Specified by:
isItemBasedAvailabilityin interfaceSalesDocument- Returns:
- Availability is compiled only based item on information?
-
setConverter
- Specified by:
setConverterin interfaceSalesDocument- Parameters:
converter- access object for unit related conversions
-
validate
Description copied from interface:SalesDocumentValidates as sales document. Afterwards, all messages are available as part of the message list- Specified by:
validatein interfaceSalesDocument- Throws:
CommunicationException
-
afterDeleteItemInBackend
Releases configuration sessions for all items provided- Parameters:
itemsToDelete- List of item TechKeys
-
afterUpdateItemInBackend
Releases configuration sessions for all items provided- Parameters:
itemsToDelete- List of item TechKeys
-
afterDeleteItemInBackend
public void afterDeleteItemInBackend()Description copied from interface:SalesDocumentReleases all configuration sessions attached to this sales document- Specified by:
afterDeleteItemInBackendin interfaceSalesDocument
-
isBackendDown
public boolean isBackendDown()- Specified by:
isBackendDownin interfaceSalesDocument- Returns:
- Is back end down for a planned downtime?
-
getSessionService
public de.hybris.platform.servicelayer.session.SessionService getSessionService()- Returns:
- the sessionService
-
setSessionService
public void setSessionService(de.hybris.platform.servicelayer.session.SessionService sessionService) - Parameters:
sessionService- the sessionService to set
-
getSalesDocumentHooks
- Returns:
- the salesDocumentHooks
-
setSalesDocumentHooks
- Parameters:
salesDocumentHooks- the salesDocumentHooks to set
-