public class CreateReturnRequestController
extends DefaultWidgetController
ReturnRequestModel. It offers to select manually the reason of
the return as well as the custom amount to refund for each item. If not specified, the amount to refund will be
automatically set to the base price of the product. It also offer to set an optional comment.| Modifier and Type | Field and Description |
|---|---|
protected static int |
COLUMN_INDEX_RETURN_AMOUNT |
protected static int |
COLUMN_INDEX_RETURN_COMMENT |
protected static int |
COLUMN_INDEX_RETURN_QUANTITY |
protected static int |
COLUMN_INDEX_RETURN_REASON |
protected static Object |
COMPLETED |
protected static String |
IN_SOCKET |
protected static String |
OUT_CONFIRM |
| Constructor and Description |
|---|
CreateReturnRequestController() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addListeners()
Add listeners on Intbox, Combobox and Textbox so that when a change happens on one of these components, we are
catching it.
|
protected void |
applyToGrid(Object data,
int childrenIndex)
Apply a value to the elements contained in the grid
|
protected void |
applyToRow(Object data,
int childrenIndex,
Component row)
Apply a specific change to a specific row of the grid
|
protected void |
autoSelect(Event event)
Automatically select the checkbox in front of the row
|
protected void |
calculateRowAmount(Row myRow,
ReturnEntryToCreateDto myReturnEntry,
int qtyEntered)
Calculates the total refund amount for a specific return entry according to the the quantity to return
|
protected void |
calculateTotalRefundAmount()
Calculate the total refund amount to display it to the end user
|
void |
confirmCreation()
Create the return request
|
protected RefundEntryModel |
createRefundWithCustomAmount(ReturnRequestModel returnRequest,
ReturnEntryToCreateDto entry)
Create and set the custom price of the refund entry.
|
protected CockpitEventQueue |
getCockpitEventQueue() |
protected BackofficeLocaleService |
getCockpitLocaleService() |
protected Optional<RefundReason> |
getCustomSelectedRefundReason(Event event)
Gets the label for the selected refund reason in case the event has a target of Combobox
|
protected EnumerationService |
getEnumerationService() |
EventService |
getEventService() |
protected ModelService |
getModelService() |
protected OrderModel |
getOrder() |
protected int |
getReasonIndex(RefundReason refundReason)
Gets the reason index within the combobox model
|
RefundService |
getRefundService() |
Grid |
getReturnEntries() |
ReturnService |
getReturnService() |
protected Optional<RefundReason> |
getSelectedRefundReason(Event event)
get the corresponding refund reason according to the selected item in the combobox if existing
|
protected void |
handleGlobalComment(Event event)
Updates all entries with the selected global comment
|
protected void |
handleGlobalReason(Event event)
Updates all entries with the selected global reason
|
protected void |
handleIndividualAmountToReturn(Event event)
Calculates the row amount for a return for the selected entry after an event was triggered
|
protected void |
handleIndividualQuantityToReturn(Event event)
Calculates the row amount for a return for the selected entry after an event was triggered
|
protected void |
handleIndividualRefundReason(Event event)
Applies a refund reason to an individual entry after an event is triggered.
|
protected void |
handleRow(Row row)
Set or Reset the given row with the appropriate default informations
|
void |
initCreateReturnRequestForm(OrderModel inputOrder)
Initialize the popup to create a
ReturnRequestModel |
protected Optional<RefundReason> |
matchingComboboxReturnReason(String refundReasonLabel)
Retrieve the
RefundReason according to the selected label in the
combobox |
void |
reset()
Reinitialize the popup.
|
protected void |
selectAllEntries()
Select or unselect all the rows of the grid and sets the default values for each of them
|
void |
setCockpitEventQueue(CockpitEventQueue cockpitEventQueue) |
void |
setCockpitLocaleService(BackofficeLocaleService cockpitLocaleService) |
void |
setEnumerationService(EnumerationService enumerationService) |
void |
setEventService(EventService eventService) |
void |
setModelService(ModelService modelService) |
void |
setOrder(OrderModel order) |
void |
setRefundService(RefundService refundService) |
void |
setReturnEntries(Grid returnEntries) |
void |
setReturnService(ReturnService returnService) |
protected Component |
targetFieldToApplyValidation(String stringToValidate,
int indexLabelToCheck,
int indexTargetComponent)
Retrieve the row who needs to apply a validation message
|
protected void |
validateRequest()
Check if the data provided by the form are compliant with the validation rules
|
protected void |
validateReturnEntry(ReturnEntryToCreateDto entry)
Validate each return entry and throw a
WrongValueException if it fails any check |
protected static final String IN_SOCKET
protected static final String OUT_CONFIRM
protected static final Object COMPLETED
protected static final int COLUMN_INDEX_RETURN_QUANTITY
protected static final int COLUMN_INDEX_RETURN_AMOUNT
protected static final int COLUMN_INDEX_RETURN_REASON
protected static final int COLUMN_INDEX_RETURN_COMMENT
public void initCreateReturnRequestForm(OrderModel inputOrder)
ReturnRequestModelinputOrder - the order for which we want to create the return requestprotected void addListeners()
protected void handleIndividualAmountToReturn(Event event)
event - the on change event that was triggered by the userprotected void handleIndividualQuantityToReturn(Event event)
event - the on change event that was triggered by the userprotected void handleIndividualRefundReason(Event event)
event - the on select event that was triggered by the userprotected void handleGlobalComment(Event event)
event - the event that triggered the changeprotected void handleGlobalReason(Event event)
event - the event that triggered the changeprotected void calculateRowAmount(Row myRow,
ReturnEntryToCreateDto myReturnEntry,
int qtyEntered)
myRow - the row I want the calculation to applymyReturnEntry - the targeted return entryqtyEntered - the quantity to be returnedprotected void calculateTotalRefundAmount()
protected void autoSelect(Event event)
event - the event that triggered the autoselectprotected void handleRow(Row row)
row - the row to set/resetprotected void selectAllEntries()
protected int getReasonIndex(RefundReason refundReason)
refundReason - the reason for which we want to know the indexprotected Optional<RefundReason> getSelectedRefundReason(Event event)
event - the select event on the comboboxprotected Optional<RefundReason> getCustomSelectedRefundReason(Event event)
event - the event that was firedprotected void applyToGrid(Object data, int childrenIndex)
data - the value to pass to the gridchildrenIndex - the index indicating where to find the right component in the gridprotected void applyToRow(Object data, int childrenIndex, Component row)
data - the new value to setchildrenIndex - the index of the component in the gridrow - the row to which the change needs to be appliedpublic void reset()
public void confirmCreation()
throws InterruptedException
InterruptedExceptionprotected RefundEntryModel createRefundWithCustomAmount(ReturnRequestModel returnRequest, ReturnEntryToCreateDto entry)
returnRequest - the associated ReturnRequestModel to the RefundEntryModelentry - the RefundEntryModel use to get the custom informationsRefundEntryModel createdprotected void validateReturnEntry(ReturnEntryToCreateDto entry)
WrongValueException if it fails any checkentry - the individual entry to validateprotected void validateRequest()
protected Component targetFieldToApplyValidation(String stringToValidate, int indexLabelToCheck, int indexTargetComponent)
stringToValidate - the string to compare to identify a specific row in the gridindexLabelToCheck - the index of the label to which we want to compare the passed stringindexTargetComponent - the index of the grid where the target component is locatedprotected Optional<RefundReason> matchingComboboxReturnReason(String refundReasonLabel)
RefundReason according to the selected label in the
comboboxrefundReasonLabel - a Stringprotected OrderModel getOrder()
public void setOrder(OrderModel order)
public Grid getReturnEntries()
public void setReturnEntries(Grid returnEntries)
public ReturnService getReturnService()
public EventService getEventService()
public void setEventService(EventService eventService)
public void setReturnService(ReturnService returnService)
protected EnumerationService getEnumerationService()
public void setEnumerationService(EnumerationService enumerationService)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected BackofficeLocaleService getCockpitLocaleService()
public void setCockpitLocaleService(BackofficeLocaleService cockpitLocaleService)
protected CockpitEventQueue getCockpitEventQueue()
public void setCockpitEventQueue(CockpitEventQueue cockpitEventQueue)
public RefundService getRefundService()
public void setRefundService(RefundService refundService)
Copyright © 2017 SAP SE. All Rights Reserved.