Class RequestItemProcessor
Abstract class for processing a single item in a request.
Inheritance
Inherited Members
Namespace: Mediachase.Commerce.InventoryService.BusinessLogic
Assembly: Mediachase.Commerce.dll
Version: 10.8.0Syntax
public abstract class RequestItemProcessor
Constructors
RequestItemProcessor()
Declaration
protected RequestItemProcessor()
Methods
Apply()
Apply() will be called after the parent processor has called LoadRequestedRecords(IInventoryService), within the same transaction. Apply() is expected to apply all requested changes to the RecordStateSet associated with the request.
Declaration
public abstract void Apply()
CreateDefaultResponseItem(InventoryRequestItem, Boolean, RecordState, String, InventoryResponseType, InventoryResponseTypeInfo)
Creates a response item with sensible defaults.
Declaration
protected InventoryResponseItem[] CreateDefaultResponseItem(InventoryRequestItem requestItem, bool isOverallSuccess, RecordState recordState, string operationKey, InventoryResponseType responseType, InventoryResponseTypeInfo responseTypeInfo)
Parameters
Type | Name | Description |
---|---|---|
InventoryRequestItem | requestItem | The request item that the response is for. |
System.Boolean | isOverallSuccess | True if the overall operation is successful, false if any item failed. |
RecordState | recordState | The record state associated with the item. May be null. |
System.String | operationKey | The serialied operation key for the operation. May be null. |
InventoryResponseType | responseType | The response type to return. |
InventoryResponseTypeInfo | responseTypeInfo | Additional information abotutthe response type (typically None). |
Returns
Type | Description |
---|---|
InventoryResponseItem[] | An array containing one InventoryResponseItem describing the result of the operation. |
GetPostValidateChanges()
GetPostValidateChanges() will be called after Validate() has been called on all RequestItemProcessor instances, if all Validate() calls return true. If GetPostValidateChanges() returns any changes, they will be applied without further validation.
Declaration
public virtual IEnumerable<InventoryChange> GetPostValidateChanges()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<InventoryChange> | An enumerable of changes to apply after the operation has been validated. |
GetResponseItems(Boolean)
Returns the final InventoryResponseItem instances for the item (typically, only one unless the operation is a split). CreateDefaultResponseItem(InventoryRequestItem, Boolean, RecordState, String, InventoryResponseType, InventoryResponseTypeInfo) can be used to generate response items in most cases.
Declaration
public abstract InventoryResponseItem[] GetResponseItems(bool isOverallSuccess)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isOverallSuccess | True if all items wer successful, false if any item returned false from Validate(). |
Returns
Type | Description |
---|---|
InventoryResponseItem[] |
Validate()
Validate() will be called after Apply() has been called on all RequestItemProcessor instances, still within the transaction, to check if the item in the request should be successful. Validate() is called after all calles to Apply() so that the overall result of the operation can be verified, instead of only verifying individual results.
Declaration
public abstract bool Validate()
Returns
Type | Description |
---|---|
System.Boolean |