Class DefaultOrderHistoryService
- java.lang.Object
-
- de.hybris.platform.orderhistory.impl.DefaultOrderHistoryService
-
- All Implemented Interfaces:
OrderHistoryService
public class DefaultOrderHistoryService extends java.lang.Object implements OrderHistoryService
Default Implementation class ofOrderHistoryService
-
-
Constructor Summary
Constructors Constructor Description DefaultOrderHistoryService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OrderModelcreateHistorySnapshot(OrderModel currentVersion)Creates a exact copy of the given order except that the copy will be marked as copy by settingOrderModel.VERSIONIDtotrue.protected java.util.Collection<java.lang.String>getEntriesDescriptions(java.util.Collection<OrderHistoryEntryModel> entries)Fetches the collection of history entries descriptionsjava.util.Collection<OrderHistoryEntryModel>getHistoryEntries(OrderModel ownerOrder, EmployeeModel employee)Fetches history entries of the ownerOrder from the given employeejava.util.Collection<OrderHistoryEntryModel>getHistoryEntries(OrderModel ownerOrder, java.util.Date dateFrom, java.util.Date dateTo)Fetches history entries of the ownerOrder from the given time rangeprotected java.util.CollectiongetHistoryEntries(OrderModel ownerOrder, java.util.Date dateFrom, java.util.Date dateTo, boolean descriptionOnly)Returns collection ofOrderHistoryEntryModelorOrderHistoryEntryModel.DESCRIPTIONfor a given time rangejava.util.Collection<OrderHistoryEntryModel>getHistoryEntries(UserModel user, java.util.Date dateFrom, java.util.Date dateTo)Fetches history entries of the orders placed by the user in the given time rangejava.util.Collection<java.lang.String>getHistoryEntriesDescriptions(OrderModel ownerOrder, java.util.Date dateFrom, java.util.Date dateTo)Fetches the descriptions of history entries of the ownerOrder from the given time rangejava.util.Collection<OrderModel>getHistorySnapshots(OrderModel ownerOrder)Fetches all snapshots which have been created and assigned to the given order's history entries.protected ModelServicegetModelService()KeyGeneratorgetVersionIDGenerator()protected booleanisWithingDateRange(OrderHistoryEntryModel entry, java.util.Date from, java.util.Date to)voidsaveHistorySnapshot(OrderModel snapshot)Actually persists a previously created order snapshot.voidsetModelService(ModelService modelService)voidsetVersionIDGenerator(KeyGenerator versionIDGenerator)
-
-
-
Method Detail
-
getVersionIDGenerator
public KeyGenerator getVersionIDGenerator()
-
setVersionIDGenerator
public void setVersionIDGenerator(KeyGenerator versionIDGenerator)
-
createHistorySnapshot
public OrderModel createHistorySnapshot(OrderModel currentVersion)
Description copied from interface:OrderHistoryServiceCreates a exact copy of the given order except that the copy will be marked as copy by settingOrderModel.VERSIONIDtotrue.- Specified by:
createHistorySnapshotin interfaceOrderHistoryService- Parameters:
currentVersion- the original order to be copied copy- Returns:
- a newly created order model (which is not persisted yet!)
-
saveHistorySnapshot
public void saveHistorySnapshot(OrderModel snapshot)
Description copied from interface:OrderHistoryServiceActually persists a previously created order snapshot. Please note that it is necessary to use this method instead just callingModelService.save(Object)to overcome Jalo layer business logic resetting some attributes. In future this may not be necessary.- Specified by:
saveHistorySnapshotin interfaceOrderHistoryService- Parameters:
snapshot- the order snapshot
-
getHistorySnapshots
public java.util.Collection<OrderModel> getHistorySnapshots(OrderModel ownerOrder)
Description copied from interface:OrderHistoryServiceFetches all snapshots which have been created and assigned to the given order's history entries.- Specified by:
getHistorySnapshotsin interfaceOrderHistoryService- Parameters:
ownerOrder- the original order- Returns:
- all history snapshots
-
getHistoryEntries
protected java.util.Collection getHistoryEntries(OrderModel ownerOrder, java.util.Date dateFrom, java.util.Date dateTo, boolean descriptionOnly)
Returns collection ofOrderHistoryEntryModelorOrderHistoryEntryModel.DESCRIPTIONfor a given time range- Parameters:
ownerOrder- - requireddateFrom- - possible null valuedateTo- - possible null valuedescriptionOnly- - set to true to get descriptions only instead of the wholeOrderHistoryEntryModelobjects- Returns:
- Collection
-
isWithingDateRange
protected boolean isWithingDateRange(OrderHistoryEntryModel entry, java.util.Date from, java.util.Date to)
-
getHistoryEntries
public java.util.Collection<OrderHistoryEntryModel> getHistoryEntries(OrderModel ownerOrder, EmployeeModel employee)
Description copied from interface:OrderHistoryServiceFetches history entries of the ownerOrder from the given employee- Specified by:
getHistoryEntriesin interfaceOrderHistoryService- Parameters:
ownerOrder- the owner orderemployee- instance ofEmployeeModelto get the history of orders for- Returns:
- collection of
OrderHistoryEntryModel
-
getHistoryEntries
public java.util.Collection<OrderHistoryEntryModel> getHistoryEntries(UserModel user, java.util.Date dateFrom, java.util.Date dateTo)
Description copied from interface:OrderHistoryServiceFetches history entries of the orders placed by the user in the given time range- Specified by:
getHistoryEntriesin interfaceOrderHistoryService- Parameters:
user- user that placed the ordersdateFrom- set dateFrom to null if you want to make the time range only half limiteddateTo- set dateTo to null if you want to make the time range only half limited- Returns:
- collection of
OrderHistoryEntryModel
-
getEntriesDescriptions
protected java.util.Collection<java.lang.String> getEntriesDescriptions(java.util.Collection<OrderHistoryEntryModel> entries)
Fetches the collection of history entries descriptions- Parameters:
entries- history entries that you want to fetch descriptions from- Returns:
- collection of history entries description
-
getHistoryEntries
public java.util.Collection<OrderHistoryEntryModel> getHistoryEntries(OrderModel ownerOrder, java.util.Date dateFrom, java.util.Date dateTo)
Description copied from interface:OrderHistoryServiceFetches history entries of the ownerOrder from the given time range- Specified by:
getHistoryEntriesin interfaceOrderHistoryService- Parameters:
ownerOrder- the owner orderdateFrom- upper limit of the time rangedateTo- lower limit of the time range- Returns:
- Collection of history entries of the given ownerOrder that were captured in the given time range
-
getHistoryEntriesDescriptions
public java.util.Collection<java.lang.String> getHistoryEntriesDescriptions(OrderModel ownerOrder, java.util.Date dateFrom, java.util.Date dateTo)
Description copied from interface:OrderHistoryServiceFetches the descriptions of history entries of the ownerOrder from the given time range- Specified by:
getHistoryEntriesDescriptionsin interfaceOrderHistoryService- Parameters:
ownerOrder- the owner orderdateFrom- upper limit of the time rangedateTo- lower limit of the time range- Returns:
- Collection of history entries of the given ownerOrder that were captured in the given time range
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
-