Class SalesDocumentERP
java.lang.Object
de.hybris.platform.sap.core.bol.backend.BackendBusinessObjectBase
de.hybris.platform.sap.core.bol.backend.jco.BackendBusinessObjectBaseJCo
de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.IsaBackendBusinessObjectBaseSalesERP
de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.SalesDocumentERP
- All Implemented Interfaces:
BackendBusinessObject,BackendBusinessObjectJCo,BackendState,SalesDocumentBackend
- Direct Known Subclasses:
BasketERP,OrderBaseERP
public abstract class SalesDocumentERP
extends IsaBackendBusinessObjectBaseSalesERP
implements SalesDocumentBackend
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AdditionalPricingprotected booleanprotected Stringprotected booleanprotected GetAllStrategyStrategy pattern to support various LO-API versionsprotected Stringprotected booleanprotected booleanWarning message in case UME is disabled.protected LrdActionsStrategystatic final StringUI controller relevant constant for 'OrderHeaderStructure'static final StringUI controller relevant constant for 'OrderItemStructure'static final Stringprotected SetStrategyprotected booleanstatic final Stringconstant naming the key referenced in factory-config.xml where the strategy class is specifiedprotected TransactionConfigurationFields inherited from class de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.IsaBackendBusinessObjectBaseSalesERP
docflowRead, headerDocFlow, headerPriceAttribs, headerPropMap, itemConfigChangeableMap, itemDocFlow, itemsPriceAttribMap, itemsPropMap, loadState, messageBufferMap, predecessorShipTo, savedItemsMap, setIpcPriceAttributes, shipToMapFields inherited from class de.hybris.platform.sap.core.bol.backend.BackendBusinessObjectBase
genericFactory, moduleConfigurationAccess -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddErroneousItem(Item item) Stores an erroneous item to be later able to restore its attrtibutesprotected voidafterReadFromBackend(SalesDocument salesDocument, JCoConnection aJCoCon) protected voidafterWriteDocument(SalesDocument salesDocument, JCoConnection aJCoCon) protected booleancheckForInitializationError(SalesDocument salesDocument) protected voidcheckShippingConditions(SalesDocument salesDocument) Check whether shipping conditions have been changed, and trigger a new pricing if necessary.voidClear list of erroneous itemsvoidRemoves all buffered item informationvoidCloses sales document in backendvoidcreateInBackend(SalesDocument salesDocument) Create back end representation of the objectvoidcreateInBackend(TransactionConfiguration transactionConfiguration, SalesDocument salesDocument) Create back end representation of the object without providing information about the user.voiddeleteItemInBackend(SalesDocument salesDocument, TechKey itemToDelete) Deletes a single item in the backend.voiddeleteItemsInBackend(SalesDocument salesDocument, TechKey[] itemsToDelete, TransactionConfiguration transConf) Deletes multiple items in the backend.voidemptyInBackend(SalesDocument salesDocument) Empties the representation of the provided object in the underlying storage.protected voidexecuteAdditionalPricing(SalesDocument salesDocument, TransactionConfiguration shop) Execute additional pricing call if document is error freeprotected voidfixErroneousHeader(SalesDocument document) Fixing a header which cannot be digested from ERP.protected voidfixErroneousItem(Item item) protected LrdCloseStrategyReturns the previously stored information about the erroneous header.Returns the previously stored information about erroneous items.Returns the map, to store item variant informationReturns the module configuration access.Returns stored shipping condition.protected voidhandleInvalidHeaderAfterRead(SalesDocument salesDocument) Actions which are needed for the header after a read step.protected voidhandleInvalidHeaderAfterUpdate(SalesDocument salesDocument) Document couldn't be created.protected voidhandleInvalidHeaderBeforeUpdate(SalesDocument salesDocument) Actions which are needed before an update call if error situations occur.protected booleanhandleInvalidItems(SalesDocument salesDocument) Checks for invalid items and initialises them, so that they can be deleted afterwards.protected voidhandleInvalidItemsAfterRead(SalesDocument salesDocument) Restores the sales document items after read and adds the information which needed to be removed before.protected voidhandleInvalidItemsAfterUpdate(SalesDocument salesDocument) Clear session storage of erroneous items for those items which are fine after the set call to SDvoidInitializes this Business Object.booleanbooleanIn case an order has just been created, or just been saved, we do not expect certain data to be present already.booleanbooleanprotected booleanisInBackend(SalesDocument salesDocument) booleanChecks if availability is compiled only based on item information.booleanChecks in the back end whether the multiple addresses are supported.protected ItemListprepareForValidation(SalesDocument salesDocument) Prepares the sales document for the validation call.voidreadForUpdateFromBackend(SalesDocument salesDocument) Read the complete document from backend and reset the dirty flags.voidreadFromBackend(SalesDocument salesDocument, TransactionConfiguration transConf, boolean directRead) Reads Data from the back end.booleanrecoverFromBackend(SalesDocument salesDoc, TechKey basketGuid) Recovers the whole document for the given TechKey from the back end.voidremoveErroneousItems(TechKey[] itemsToDelete) Remove entries from list of error restore information .protected voidrestoreErroneousHeaderAfterRead(SalesDocument salesDocument) Restore invalid header after read step.protected voidrestoreErroneousHeaderAfterSet(Header header) Restoring header: Initializing delivery date.protected voidrestoreErroneousItem(Item savedState, Item errItm) If an item has been fixed so that LO-API can consume it, we later on need to restore the user inputs, so that the user sees the data he/she has entered which need to be corrected.voidsetAdditionalPricing(AdditionalPricing additionalPricing) voidsetCloseStrategy(LrdCloseStrategy closeStrategy) voidsetDocumentInitial(boolean isInitial) Sales document is initial.voidsetErroneous(boolean bool) Set the error state read from the backendvoidsetErroneousHeader(Header header) Sets erroneous header.voidsetGData(SalesDocument salesDocument, TransactionConfiguration shop) Call the ERP_LORD_LOAD for edit.voidsetGetAllStrategy(GetAllStrategy getAllStrategy) voidsetItemBuffer(ItemBuffer itemBuffer) voidCopies back end data from basket to the order.voidsetLrdActionsStrategy(LrdActionsStrategy lrdActionsStrategy) voidsetPayerHandle(String payer) Sets handle of payervoidsetSalesDocumentERPHooks(List<SalesDocumentERPHook> salesDocumentERPHooks) voidsetSetStrategy(SetStrategy setStrategy) voidsetShippingCondition(String currentShippingCondition) Sets stored shipping condition.voidsetSoldToHandle(String soldTo) Sets handle of soldTo partnervoidupdateInBackend(SalesDocument salesDocument) Updates object in the back end without supplying extra information about the transactionConfiguration.voidupdateInBackend(SalesDocument salesDocument, TransactionConfiguration shop) Update object in the backend by putting the data into the underlying storage.voidupdateInBackend(SalesDocument salesDocument, TransactionConfiguration transactionConfiguration, List<TechKey> itemsToDelete) Updates object in the back end by putting the data into the underlying storage.voidvalidate(SalesDocument salesDocument) Validates a sales document.Methods inherited from class de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.IsaBackendBusinessObjectBaseSalesERP
adjustFreeGoods, getHeaderDocFlow, getHeaderPriceAttribs, getHeaderPropMap, getItemDocFlow, getItemsPriceAttribMap, getItemsPropMap, getLoadState, getMessageList, getOrCreateMessageList, getSavedItemsMap, getShipToMap, isDocflowRead, removeMessageFromMessageList, setDocflowRead, setHeaderDocFlow, setItemDocFlow, setShipToMapMethods inherited from class de.hybris.platform.sap.core.bol.backend.jco.BackendBusinessObjectBaseJCo
getDefaultConnectionName, getDefaultDestinationName, getDefaultJCoConnection, getJCoConnection, getJCoConnection, getModuleId, setDefaultConnectionName, setDefaultDestinationName, setManagedConnectionContainer, toStringMethods inherited from class de.hybris.platform.sap.core.bol.backend.BackendBusinessObjectBase
destroyBackendObject, setGenericFactory, setModuleConfigurationAccessMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.hybris.platform.sap.core.bol.backend.BackendBusinessObject
destroyBackendObjectMethods inherited from interface de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.interf.SalesDocumentBackend
getSalesDocumentType
-
Field Details
-
RESOURCE_KEY
- See Also:
-
STRATEGY_FACTORY_ERP
constant naming the key referenced in factory-config.xml where the strategy class is specified- See Also:
-
ORDER_ITEM_STRUCTURE
UI controller relevant constant for 'OrderItemStructure'- See Also:
-
ORDER_HEADER_STRUCTURE
UI controller relevant constant for 'OrderHeaderStructure'- See Also:
-
isUMEDisabledWarningNecessary
protected boolean isUMEDisabledWarningNecessaryWarning message in case UME is disabled. Then we only have one session in ERP, and we cannot fully support multiple documents. UME disabling will not be possible in productive environments. -
getAllStrategy
Strategy pattern to support various LO-API versions -
lrdActionsStrategy
-
setStrategy
-
itemVariantMap
-
showInlineConfig
protected boolean showInlineConfig -
headerCondTypeFreight
-
isIncompletionLogRequested
protected boolean isIncompletionLogRequested -
deliveryPriority
-
erroneous
protected boolean erroneous -
transactionConfiguration
-
createProcess
protected boolean createProcess -
additionalPricing
-
-
Constructor Details
-
SalesDocumentERP
protected SalesDocumentERP()
-
-
Method Details
-
getItemBuffer
- Returns:
- the itemBuffer
-
setItemBuffer
- Parameters:
itemBuffer- the itemBuffer to set
-
getGetAllStrategy
- Returns:
- the getAllStrategy
-
setGetAllStrategy
- Parameters:
getAllStrategy- the getAllStrategy to set
-
getLrdActionsStrategy
- Returns:
- the lrdActionsStrategy
-
setLrdActionsStrategy
- Parameters:
lrdActionsStrategy- the lrdActionsStrategy to set
-
getSetStrategy
- Returns:
- the setStrategy
-
setSetStrategy
- Parameters:
setStrategy- the setStrategy to set
-
isDocumentInitial
public boolean isDocumentInitial()- Specified by:
isDocumentInitialin interfaceBackendState- Returns:
- Sales document is initial
-
setSoldToHandle
Description copied from interface:BackendStateSets handle of soldTo partner- Specified by:
setSoldToHandlein interfaceBackendState- Parameters:
soldTo- handle of the soldto partner function
-
setPayerHandle
Description copied from interface:BackendStateSets handle of payer- Specified by:
setPayerHandlein interfaceBackendState- Parameters:
payer- handle of the payer partner function
-
getPayerHandle
- Specified by:
getPayerHandlein interfaceBackendState- Returns:
- handle of the payer
-
getSoldToHandle
- Specified by:
getSoldToHandlein interfaceBackendState- Returns:
- handle of the soldTo partner
-
setDocumentInitial
public void setDocumentInitial(boolean isInitial) Description copied from interface:BackendStateSales document is initial. The first update might need to do specific shipto handling- Specified by:
setDocumentInitialin interfaceBackendState- Parameters:
isInitial- true if document is initial
-
createInBackend
Create back end representation of the object- Parameters:
salesDocument- sales document to be created in back end- Throws:
BackendException- case of a back-end error
-
createInBackend
public void createInBackend(TransactionConfiguration transactionConfiguration, SalesDocument salesDocument) throws BackendException Create back end representation of the object without providing information about the user. This may happen in the B2C scenario where the login may be done later.- Specified by:
createInBackendin interfaceSalesDocumentBackend- Parameters:
transactionConfiguration- The current shopsalesDocument- The document to read the data in- Throws:
BackendException- in case of a back-end or communication error
-
handleInvalidHeaderAfterUpdate
Document couldn't be created. Now the header needs to be corrected, and the document is again sent to ERP.- Throws:
BackendException
-
restoreErroneousHeaderAfterSet
Restoring header: Initializing delivery date.- Parameters:
header-
-
fixErroneousHeader
Fixing a header which cannot be digested from ERP. This implementation sets a delivery date because this is the only error which can be corrected by means of attributes available in WCEM -
deleteItemInBackend
public void deleteItemInBackend(SalesDocument salesDocument, TechKey itemToDelete) throws BackendException Deletes a single item in the backend.- Specified by:
deleteItemInBackendin interfaceSalesDocumentBackend- Parameters:
salesDocument- document to delete item fromitemToDelete- item technical key that is going to be deleted- Throws:
BackendException- in case of a back-end or communication error
-
deleteItemsInBackend
public void deleteItemsInBackend(SalesDocument salesDocument, TechKey[] itemsToDelete, TransactionConfiguration transConf) throws BackendException Deletes multiple items in the backend.- Specified by:
deleteItemsInBackendin interfaceSalesDocumentBackend- Parameters:
salesDocument- Document to delete item fromitemsToDelete- Array of item keys that are going to be deletedtransConf- TransactionConfiguration to delete items dependent on shop settings- Throws:
BackendException- in case of a back-end or communication error
-
removeErroneousItems
Description copied from interface:BackendStateRemove entries from list of error restore information .- Specified by:
removeErroneousItemsin interfaceBackendState
-
emptyInBackend
Description copied from interface:SalesDocumentBackendEmpties the representation of the provided object in the underlying storage. This means that all items and the header information are cleared. The provided document itself is not changed, so you are responsible for clearing the data representation on the business object layer on your own.- Specified by:
emptyInBackendin interfaceSalesDocumentBackend- Parameters:
salesDocument- the document to remove the representation in the storage- Throws:
BackendException- in case of a back-end or communication error
-
getItemVariantMap
Returns the map, to store item variant information- Specified by:
getItemVariantMapin interfaceBackendState- Specified by:
getItemVariantMapin classIsaBackendBusinessObjectBaseSalesERP- Returns:
- HashMap, the map to store item varaint information in
-
fixErroneousItem
-
initBackendObject
Initializes this Business Object.- Specified by:
initBackendObjectin interfaceBackendBusinessObject- Overrides:
initBackendObjectin classIsaBackendBusinessObjectBaseSalesERP- Throws:
BackendException-BackendException
-
isCreateProcess
public boolean isCreateProcess()Description copied from interface:BackendStateIn case an order has just been created, or just been saved, we do not expect certain data to be present already. For Example DocFlow data. So for performance reasons it makes sense not to request those data.- Specified by:
isCreateProcessin interfaceBackendState- Returns:
- true, if the salesdocument is just created
-
isErroneous
public boolean isErroneous()- Returns:
- true, if error occured
-
isMultipleAddressesSupported
public boolean isMultipleAddressesSupported()Description copied from interface:SalesDocumentBackendChecks in the back end whether the multiple addresses are supported.- Specified by:
isMultipleAddressesSupportedin interfaceSalesDocumentBackend- Returns:
truewhen the back end supports the multiple addresses
-
readForUpdateFromBackend
Read the complete document from backend and reset the dirty flags.- Specified by:
readForUpdateFromBackendin interfaceSalesDocumentBackend- Parameters:
salesDocument- Sales Document- Throws:
BackendException- in case of a back-end or communication error
-
checkForInitializationError
-
isInBackend
-
readFromBackend
public void readFromBackend(SalesDocument salesDocument, TransactionConfiguration transConf, boolean directRead) throws BackendException Description copied from interface:SalesDocumentBackendReads Data from the back end. Every document consists of two parts: the header and the items. This method retrieves the header and the item information. If a soldTo is set in the partner list, ship to information should be read- Specified by:
readFromBackendin interfaceSalesDocumentBackend- Parameters:
salesDocument- Sales Document to be readtransConf- Transaction Configuration object that holds the configuration settingsdirectRead- In case other sessions/channels update the sales document in parallel, it is only guaranteed that the most recent data is returned if direct read is set totrue, otherwise the data might be returned from a buffer.- Throws:
BackendException- in case of a back-end or communication error
-
handleInvalidHeaderAfterRead
Actions which are needed for the header after a read step. Messages might need to be restored, because the header has been temporarily adjusted before. -
restoreErroneousHeaderAfterRead
Restore invalid header after read step. Restore required delivery date and messages. -
handleInvalidItemsAfterRead
Restores the sales document items after read and adds the information which needed to be removed before.- Parameters:
salesDocument- The cart sales document.
-
restoreErroneousItem
If an item has been fixed so that LO-API can consume it, we later on need to restore the user inputs, so that the user sees the data he/she has entered which need to be corrected.- Parameters:
savedState- The original, saved state of the itemerrItm- State of the erroneous item after LO-API can digest it
-
getErroneousItems
Description copied from interface:BackendStateReturns the previously stored information about erroneous items. Even if the sales document items are technically ok and can be sent via LO-API, this list holds the information which causes the trouble, and which needs to be put to the items after read to persist the user entry- Specified by:
getErroneousItemsin interfaceBackendState- Returns:
- Map for all erroneous items
-
handleInvalidItems
Checks for invalid items and initialises them, so that they can be deleted afterwards. This call is done before the LO-API is called for reading item information.
The items which cannot be digested by LO-API are fixed, the info needed to restore the document are kept ingetErroneousItems()- Parameters:
salesDocument- Cart sales document- Returns:
- Could we fix the document.
- Throws:
BackendException
-
clearErroneousItems
public void clearErroneousItems()Description copied from interface:BackendStateClear list of erroneous items- Specified by:
clearErroneousItemsin interfaceBackendState
-
addErroneousItem
Description copied from interface:BackendStateStores an erroneous item to be later able to restore its attrtibutes- Specified by:
addErroneousItemin interfaceBackendState- Parameters:
item- The item (including message list, productId which we need to restore
-
recoverFromBackend
public boolean recoverFromBackend(SalesDocument salesDoc, TechKey basketGuid) throws BackendException Description copied from interface:SalesDocumentBackendRecovers the whole document for the given TechKey from the back end. Before calling this method, it should be checked if the back end is capable of recovering a document. This can be done by calling checkRecoveryInBackend. So far the recovery feature is only available for the java basket (see SalesDocumentDB), it is used during startup to recover a basket via a cookie (see BasketCookieHandler).- Specified by:
recoverFromBackendin interfaceSalesDocumentBackend- Parameters:
salesDoc- The document to load the data in.basketGuid- The TechKey of the basket to read- Returns:
- success
truewhen the recovering is successful - Throws:
BackendException- in case of a back-end or communication error
-
setErroneous
public void setErroneous(boolean bool) Description copied from interface:BackendStateSet the error state read from the backend- Specified by:
setErroneousin interfaceBackendState- Parameters:
bool- true if ERRKZ is 'X', otherwise false
-
setGData
public void setGData(SalesDocument salesDocument, TransactionConfiguration shop) throws BackendException Call the ERP_LORD_LOAD for edit.- Specified by:
setGDatain interfaceSalesDocumentBackend- Parameters:
salesDocument- The salesDoc to set the data toshop- Transaction configuration- Throws:
BackendException- in case of a back-end or communication error
-
setLoadStateCreate
public void setLoadStateCreate()Description copied from interface:SalesDocumentBackendCopies back end data from basket to the order.- Specified by:
setLoadStateCreatein interfaceSalesDocumentBackend
-
updateInBackend
Description copied from interface:SalesDocumentBackendUpdates object in the back end without supplying extra information about the transactionConfiguration. This method is normally necessary only for the B2C scenario.
Note: For a correct support of the business event AddToDocument the techkey of the items should be filled from the back end.- Specified by:
updateInBackendin interfaceSalesDocumentBackend- Parameters:
salesDocument- the object to update- Throws:
BackendException- in case of a back-end or communication error
-
updateInBackend
public void updateInBackend(SalesDocument salesDocument, TransactionConfiguration shop) throws BackendException Update object in the backend by putting the data into the underlying storage.- Specified by:
updateInBackendin interfaceSalesDocumentBackend- Parameters:
salesDocument- the document to updateshop- the current shop- Throws:
BackendException- This exception is thrown if an error occurs in the back end
-
afterWriteDocument
- Parameters:
salesDocument-aJCoCon-
-
afterReadFromBackend
-
handleInvalidHeaderBeforeUpdate
Actions which are needed before an update call if error situations occur. Implementation re-initializes the required delivery date in case nothing was entered- Parameters:
salesDocument- Sales document
-
handleInvalidItemsAfterUpdate
Clear session storage of erroneous items for those items which are fine after the set call to SD- Parameters:
salesDocument-
-
checkShippingConditions
Check whether shipping conditions have been changed, and trigger a new pricing if necessary.- Parameters:
salesDocument-- Throws:
BackendException
-
setShippingCondition
Description copied from interface:BackendStateSets stored shipping condition. We need this to decide whether a pricing update is necessary.- Specified by:
setShippingConditionin interfaceBackendState- Parameters:
currentShippingCondition- Shipping condition
-
getShippingCondition
Description copied from interface:BackendStateReturns stored shipping condition. We need this to decide whether a pricing update is necessary.- Specified by:
getShippingConditionin interfaceBackendState- Returns:
- Shipping condition
-
updateInBackend
public void updateInBackend(SalesDocument salesDocument, TransactionConfiguration transactionConfiguration, List<TechKey> itemsToDelete) throws BackendException Description copied from interface:SalesDocumentBackendUpdates object in the back end by putting the data into the underlying storage.
Note: For a correct support of the business event AddToDocument the techkey of the items should be filled from the back end.- Specified by:
updateInBackendin interfaceSalesDocumentBackend- Parameters:
salesDocument- the document to updatetransactionConfiguration- Transaction Configuration object that holds the configuration settingsitemsToDelete- List of techkeys of the items to be deleted in the back end- Throws:
BackendException- This exception is thrown if an error occurs in the back end
-
clearItemBuffer
public void clearItemBuffer()Description copied from interface:SalesDocumentBackendRemoves all buffered item information- Specified by:
clearItemBufferin interfaceSalesDocumentBackend
-
getErroneousHeader
Description copied from interface:BackendStateReturns the previously stored information about the erroneous header.- Specified by:
getErroneousHeaderin interfaceBackendState- Returns:
- Sales document header
-
setErroneousHeader
Description copied from interface:BackendStateSets erroneous header.- Specified by:
setErroneousHeaderin interfaceBackendState- Parameters:
header- Sales document header
-
executeAdditionalPricing
protected void executeAdditionalPricing(SalesDocument salesDocument, TransactionConfiguration shop) throws BackendException Execute additional pricing call if document is error free- Parameters:
salesDocument- Sales documentshop- Sales configuration- Throws:
BackendException- Exception from backend call
-
isItemBasedAvailability
public boolean isItemBasedAvailability()Description copied from interface:SalesDocumentBackendChecks if availability is compiled only based on item information.- Specified by:
isItemBasedAvailabilityin interfaceSalesDocumentBackend- Returns:
- Availability is compiled only based on item information?
-
getModuleConfigurationAccess
Description copied from class:BackendBusinessObjectBaseReturns the module configuration access.- Overrides:
getModuleConfigurationAccessin classBackendBusinessObjectBase- Returns:
- the moduleConfigurationAccess
-
getAdditionalPricing
- Returns:
- the additionalPricing
-
setAdditionalPricing
- Parameters:
additionalPricing- the additionalPricing to set
-
validate
Description copied from interface:SalesDocumentBackendValidates a sales document. Validation messages should be attached to salesDocument after validation- Specified by:
validatein interfaceSalesDocumentBackend- Throws:
BackendException
-
prepareForValidation
Prepares the sales document for the validation call. In this implementation, to be sure to get all warnings related to order quantity: Changes all item quantities- Parameters:
salesDocument-- Returns:
- Item list in its initial state
-
isBackendDown
public boolean isBackendDown()- Specified by:
isBackendDownin interfaceSalesDocumentBackend- Returns:
- Is back end in planned downtime?
-
getCloseStrategy
- Returns:
- the closeStrategy
-
setCloseStrategy
- Parameters:
closeStrategy- the closeStrategy to set
-
closeBackendSession
public void closeBackendSession()Description copied from interface:SalesDocumentBackendCloses sales document in backend- Specified by:
closeBackendSessionin interfaceSalesDocumentBackend
-
getSalesDocumentERPHooks
- Returns:
- the salesDocumentERPHooks
-
setSalesDocumentERPHooks
- Parameters:
salesDocumentERPHooks- the salesDocumentERPHooks to set
-