Interface SalesDocumentBackend
- All Superinterfaces:
BackendBusinessObject
- All Known Subinterfaces:
BasketBackend,OrderBackend,OrderBaseBackend,OrderHistoryBackend
- All Known Implementing Classes:
BasketERP,OrderBaseERP,OrderERP,OrderHistoryERP,SalesDocumentERP
Common interface for the back-end implementation of all sales documents (i.e.
Note - There was a design decision to give all back-end interfaces and their implementors a stateless-like behaviour. This means that the back-end objects are not truly stateless because the connection management of the actual used back-end systems cannot support this at all, but the method signatures are similar to stateless objects. This feature forces you to provide a reference to the object the back-end method should work on as a method parameter. This may seem a little bit complicated, but it allows us to migrate to an EJB-Solution with real stateless session beans very easy.
Order and
Basket). This grouping may not be suitable for all possible back-end/front-end scenarios but saves a lot
of implementation effort for the default scenario, where the only back end system is the CRM.Note - There was a design decision to give all back-end interfaces and their implementors a stateless-like behaviour. This means that the back-end objects are not truly stateless because the connection management of the actual used back-end systems cannot support this at all, but the method signatures are similar to stateless objects. This feature forces you to provide a reference to the object the back-end method should work on as a method parameter. This may seem a little bit complicated, but it allows us to migrate to an EJB-Solution with real stateless session beans very easy.
-
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all buffered item informationvoidCloses sales document in backendvoidcreateInBackend(TransactionConfiguration transactionConfiguration, SalesDocument salesDocument) Creates a back-end representation of this object in the back end.voiddeleteItemInBackend(SalesDocument salesDocument, TechKey itemToDelete) Deletes one item of the document in the underlying storage.voiddeleteItemsInBackend(SalesDocument salesDocument, TechKey[] itemsToDelete, TransactionConfiguration transConf) Deletes list of items from the underlying storage.voidemptyInBackend(SalesDocument salesDocument) Empties the representation of the provided object in the underlying storage.Each implementing class has to define the used sales document type.booleanbooleanChecks if availability is compiled only based on item information.booleanChecks in the back end whether the multiple addresses are supported.voidreadForUpdateFromBackend(SalesDocument salesDocument) Reads the sales document from the back end and lock this document, so that it can be modified.voidreadFromBackend(SalesDocument salesDocument, TransactionConfiguration transactionConfiguration, 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.voidsetGData(SalesDocument salesDoc, TransactionConfiguration transactionConfiguration) Sets the global data in the back end.voidCopies back end data from basket to the order.voidupdateInBackend(SalesDocument salesDocument) Updates object in the back end without supplying extra information about the transactionConfiguration.voidupdateInBackend(SalesDocument salesDocument, TransactionConfiguration transactionConfiguration) Updates object in the back end 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 interface de.hybris.platform.sap.core.bol.backend.BackendBusinessObject
destroyBackendObject, initBackendObject
-
Method Details
-
createInBackend
void createInBackend(TransactionConfiguration transactionConfiguration, SalesDocument salesDocument) throws BackendException Creates a back-end representation of this object in the back end.- Parameters:
transactionConfiguration- Transaction Configuration object that holds the configuration settingssalesDocument- The sales document object contains data to be used for creating sales document in the back-end- Throws:
BackendException- in case of a back-end or communication error
-
deleteItemInBackend
Deletes one item of the document in the underlying storage. The document in the business object layer is not changed at all.- 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
void deleteItemsInBackend(SalesDocument salesDocument, TechKey[] itemsToDelete, TransactionConfiguration transConf) throws BackendException Deletes list of items from the underlying storage. The document in the business object layer is not changed at all.- 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
-
emptyInBackend
Empties 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.- Parameters:
salesDocument- the document to remove the representation in the storage- Throws:
BackendException- in case of a back-end or communication error
-
getSalesDocumentType
SalesDocumentType getSalesDocumentType()Each implementing class has to define the used sales document type. This is e.g. used for finding the right strategies.- Returns:
- sales document type
-
isMultipleAddressesSupported
boolean isMultipleAddressesSupported()Checks in the back end whether the multiple addresses are supported.- Returns:
truewhen the back end supports the multiple addresses
-
readForUpdateFromBackend
Reads the sales document from the back end and lock this document, so that it can be modified.- Parameters:
salesDocument- Sales Document- Throws:
BackendException- in case of a back-end or communication error
-
readFromBackend
void readFromBackend(SalesDocument salesDocument, TransactionConfiguration transactionConfiguration, boolean directRead) throws BackendException Reads 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- Parameters:
salesDocument- Sales Document to be readtransactionConfiguration- 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
-
recoverFromBackend
Recovers 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).- 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
-
setGData
void setGData(SalesDocument salesDoc, TransactionConfiguration transactionConfiguration) throws BackendException Sets the global data in the back end. Use this action, if you don't know the soldTo of the sales document.- Parameters:
salesDoc- The salesDoc to set the data totransactionConfiguration- Transaction configuration- Throws:
BackendException- in case of a back-end or communication error
-
setLoadStateCreate
void setLoadStateCreate()Copies back end data from basket to the order. -
updateInBackend
Updates 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.- Parameters:
salesDocument- the object to update- Throws:
BackendException- in case of a back-end or communication error
-
updateInBackend
void updateInBackend(SalesDocument salesDocument, TransactionConfiguration transactionConfiguration) throws BackendException Updates 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.- Parameters:
salesDocument- the document to updatetransactionConfiguration- Transaction Configuration object that holds the configuration settings- Throws:
BackendException- This exception is thrown if an error occurs in the back end
-
updateInBackend
void updateInBackend(SalesDocument salesDocument, TransactionConfiguration transactionConfiguration, List<TechKey> itemsToDelete) throws BackendException Updates 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.- 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
void clearItemBuffer()Removes all buffered item information -
isItemBasedAvailability
boolean isItemBasedAvailability()Checks if availability is compiled only based on item information.- Returns:
- Availability is compiled only based on item information?
-
validate
Validates a sales document. Validation messages should be attached to salesDocument after validation- Parameters:
salesDocument-- Throws:
BackendException
-
isBackendDown
boolean isBackendDown()- Returns:
- Is back end in planned downtime?
-
closeBackendSession
void closeBackendSession()Closes sales document in backend
-