Package de.hybris.platform.order
Interface QuoteService
-
- All Known Implementing Classes:
DefaultQuoteService
public interface QuoteService
Business service for handling quotes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description QuoteModel
createQuoteFromCart(CartModel cart)
Creates a new quote based on the given cart.QuoteModel
createQuoteSnapshot(QuoteModel quote, QuoteState quoteState)
Creates a new quote snapshot by cloning the givenQuoteModel
.QuoteModel
getCurrentQuoteForCode(java.lang.String code)
Returns the latest quote snapshot for the given code, i.e.QuoteModel
getQuoteForCodeAndVersion(java.lang.String code, java.lang.Integer version)
Returns a uniqueQuoteModel
for the given code and version.java.util.List<QuoteModel>
getQuotesForCode(java.lang.String code)
Returns a list of all quotes snapshots for the given code, ordered by version in descending order, i.e.
-
-
-
Method Detail
-
getCurrentQuoteForCode
QuoteModel getCurrentQuoteForCode(java.lang.String code)
Returns the latest quote snapshot for the given code, i.e. the one with the highest version.- Parameters:
code
- the code to query for- Returns:
- latest quote snapshot for the given code
- Throws:
java.lang.IllegalArgumentException
- in case code is nullModelNotFoundException
- in case there is no latest snapshot for the given code
-
getQuoteForCodeAndVersion
QuoteModel getQuoteForCodeAndVersion(java.lang.String code, java.lang.Integer version)
Returns a uniqueQuoteModel
for the given code and version.- Parameters:
code
- the code to query forversion
- the version to query for- Returns:
- unique quote for the given code and version
- Throws:
java.lang.IllegalArgumentException
- in case one of the parameters is nullModelNotFoundException
- in case there is no unique quote for the given code and version
-
getQuotesForCode
java.util.List<QuoteModel> getQuotesForCode(java.lang.String code)
Returns a list of all quotes snapshots for the given code, ordered by version in descending order, i.e. the first item in the returned list is the latest snapshot of the quote.- Parameters:
code
- the code to query for- Returns:
- a list of ordered quote snapshots for the given code
- Throws:
java.lang.IllegalArgumentException
- in case code is null
-
createQuoteFromCart
QuoteModel createQuoteFromCart(CartModel cart)
Creates a new quote based on the given cart. Please note that it is the caller's responsibility to persist the quote that is returned by this method. Callers may either set quote specific attributes before persisting the item or leave it to theDefaultQuotePrepareInterceptor
to set default values. The cart that is passed into this method is not affected by its logic.- Parameters:
cart
- the cart based on which the new quote will be created- Returns:
- the new quote
- Throws:
java.lang.IllegalArgumentException
- in case cart is null
-
createQuoteSnapshot
QuoteModel createQuoteSnapshot(QuoteModel quote, QuoteState quoteState)
Creates a new quote snapshot by cloning the givenQuoteModel
. The state of the new snapshot is determined by the givenQuoteState
, its version is the given quote's version incremented by 1. Please note that it is the caller's responsibility to persist the quote that is returned by this method. The original quote passed into this method is not affected by its logic.- Parameters:
quote
- quote to create the snapshot fromquoteState
- desired state of the quote- Returns:
- the new quote snapshot.
- Throws:
java.lang.IllegalArgumentException
- in case one of the parameters is null
-
-