public class OfferMediator extends AbstractPriceBaseMediator
This mediator is used to create and populate a list of physical table data objects, which are all instances of TableDataObject, from a price list logical noun. See transform(Object, boolean) for more details.
The operations that this performs include:
The unique index to determine an offer is:
The tables populated by this mediator include:
Constructor and Description |
---|
OfferMediator() |
Modifier and Type | Method and Description |
---|---|
void | close()
This method will perform cleanup on the business object mediator.
|
protected void | deleteOffer(com.ibm.commerce.price.facade.datatypes.PriceListType priceListNoun)
Deletes the offers in the given price list physically or marks the offers for delete.
|
protected void | deleteOffer(java.lang.String catalogEntryId, java.lang.String priceListId, java.lang.String identifier)
Deletes the offers from OFFER table and related tables physically.
|
void | init()
Performs initialization for the offer mediator.
|
protected boolean | isMarkForDelete()
To see whether Mark for delete is enabled for the mediator or not.
|
protected boolean | isRepalceOfferWithoutMarkAsReplaced()
To see whether replace offer without mark as replaced is enabled for the mediator or not.
|
protected void | markOfferForDelete(java.lang.String catalogEntryId, java.lang.String priceListId, java.lang.String identifier)
Marks the offers as deleted.
|
protected TableDataObject | populateOFFER(com.ibm.commerce.price.facade.datatypes.PriceEntryType priceEntry, java.lang.String aCatEntryId, java.lang.String aPriceListId)
Creates and populates the physical data object intended for the OFFER table from the PriceEntry logical object.
|
protected void | populateOFFER(com.ibm.commerce.price.facade.datatypes.PriceListType priceListNoun)
Creates and populates a physical data object intended for the OFFER table from the PriceList logic object.
|
protected TableDataObject | populateOFFERDESCRIPTION(com.ibm.commerce.price.facade.datatypes.PriceEntryType priceEntry, java.lang.String offerId)
Creates and populates the table data object intended for the OFFERDESC from the priceEntry logic object.
|
protected void | populateOFFERPRICE(com.ibm.commerce.price.facade.datatypes.PriceEntryType priceEntry, java.lang.String offerId)
Creates and populates the table data object intended for the OFFERPRICE table from the priceEntry logic object.
|
protected TableDataObject | populateOfferPriceForCurrency(MonetaryAmountType monetaryAmount, boolean isPrimaryCurrency, java.lang.String offerId)
Creates and populates the table data object intended for OFFERPRICE table from the monetaryAmount logic object.
|
protected void | replaceOffer(com.ibm.commerce.price.facade.datatypes.PriceListType priceListNoun)
Creates and populates physical data object intended for the OFFER table from the PriceList logic object in replace mode.
|
protected void | transform(java.lang.Object priceListObj, boolean deleteFlag)
Transforms the price list logical noun to a list of physical objects.
|
protected void transform(java.lang.Object priceListObj, boolean deleteFlag) throws DataLoadException
The transformed data object is created and transferred externally using AbstractBusinessObjectMediator.createBaseTableDataObjectWithUniqueIndex(String, Map).
protected TableDataObject populateOFFER(com.ibm.commerce.price.facade.datatypes.PriceEntryType priceEntry, java.lang.String aCatEntryId, java.lang.String aPriceListId) throws DataLoadException
The object is created and transferred externally using AbstractBusinessObjectMediator.createBaseTableDataObjectWithUniqueIndex(String, Map).
Data for the OFFER table is obtained by using the PriceList noun to find the PriceEntry. The table and column data for the OFFER table are put in a TableDataObject. Physical data objects for OFFERPRICE and OFFERDESC tables are also created and populated.
protected void populateOFFER(com.ibm.commerce.price.facade.datatypes.PriceListType priceListNoun) throws DataLoadException
The table and column data for the OFFER table are contained in a TableDataObject. This object is created and transferred externally using AbstractBusinessObjectMediator.createBaseTableDataObjectWithUniqueIndex(String, Map).
If the catalog entry ID from priceListNoun is null, an exception will be thrown. If PriceListID is null, the ID of the default price list will be used instead.
protected TableDataObject populateOFFERDESCRIPTION(com.ibm.commerce.price.facade.datatypes.PriceEntryType priceEntry, java.lang.String offerId)
The table and column data for the OFFERDESC table are contained in a TableDataObject. This object is created and transferred externally using AbstractBusinessObjectMediator.createBaseTableDataObjectWithUniqueIndex(String, Map).
The method contains some steps to obtain value for each column of OFFERDESC table. The table and column data for the OFFER table are contained in a TableDataObject.
protected void populateOFFERPRICE(com.ibm.commerce.price.facade.datatypes.PriceEntryType priceEntry, java.lang.String offerId) throws DataLoadException
The table and column data for the OFFERPRICE table are contained in a TableDataObject. This object is created and transferred externally using AbstractBusinessObjectMediator.createBaseTableDataObjectWithUniqueIndex(String, Map).
The method contains some steps to obtain value for each column of OFFERPRICE table from PriceEntry in PriceList noun. The table and column data for the OFFER table are contained in a TableDataObject.
The method first deals with primary price, then deals with alternative currency price.
protected TableDataObject populateOfferPriceForCurrency(MonetaryAmountType monetaryAmount, boolean isPrimaryCurrency, java.lang.String offerId) throws DataLoadException
The table and column data for the OFFERPRICE table are contained in a TableDataObject. This object is created and transferred externally using AbstractBusinessObjectMediator.createBaseTableDataObjectWithUniqueIndex(String, Map).
Note that the currency in business context will be retrieved when currency from monetaryAmount is null and isPrimaryCurrency is true.
protected void deleteOffer(java.lang.String catalogEntryId, java.lang.String priceListId, java.lang.String identifier) throws DataLoadException
If identifier is not null, the offers will be deleted from OFFER table by catalogEntryId and priceListId and identifier, or else by catalogEntryId and priceListId.
Note that this method cannot be called before init() because all SQL statements needed are initialized in init().
protected void markOfferForDelete(java.lang.String catalogEntryId, java.lang.String priceListId, java.lang.String identifier) throws DataLoadException
Note that this method will be called when isMarkOfferForDelete is true. If identifier is not null, the offer will be updated in OFFER table by catalogEntryId and priceListId and identifier, or else by catalogEntryId and priceListId.
protected void replaceOffer(com.ibm.commerce.price.facade.datatypes.PriceListType priceListNoun) throws DataLoadException
The table and column data for the OFFER table are contained in a TableDataObject. This object is created and transferred externally using AbstractBusinessObjectMediator.createBaseTableDataObjectWithUniqueIndex(String, Map).
protected void deleteOffer(com.ibm.commerce.price.facade.datatypes.PriceListType priceListNoun) throws DataLoadException
Mark for delete does not delete the offer physically, the PUBLISHED column of database table OFFER will be set to 2 instead.
Note that it depends on isMarkOfferForDelete. Do marking for delete if isMarkOfferForDelete is true, or else delete physically.
protected boolean isRepalceOfferWithoutMarkAsReplaced()
protected boolean isMarkForDelete()
public void init() throws DataLoadException
Initialization includes:
public void close() throws DataLoadException
This method will perform cleanup on the business object mediator. It will attempt to close all of the data writers configured for this business object mediator.
This method will flush and commit any data waiting to be persisted in the batch as well as clear the ID resolver cache.