Class CancelOrderController

java.lang.Object
org.zkoss.zk.ui.event.GenericEventListener
org.zkoss.zk.ui.util.GenericComposer<T>
org.zkoss.zk.ui.util.GenericAutowireComposer<T>
org.zkoss.zk.ui.util.GenericForwardComposer<org.zkoss.zk.ui.Component>
com.hybris.cockpitng.util.ViewAnnotationAwareComposer
com.hybris.cockpitng.util.DefaultWidgetController
de.hybris.platform.omsbackoffice.widgets.order.cancelorder.CancelOrderController
All Implemented Interfaces:
com.hybris.cockpitng.core.WidgetController, com.hybris.cockpitng.dnd.WidgetDragAndDropAware, com.hybris.cockpitng.engine.WidgetInstanceManagerAware, Serializable, org.zkoss.zk.ui.event.EventListener, org.zkoss.zk.ui.event.SerializableEventListener, org.zkoss.zk.ui.util.ComponentActivationListener, org.zkoss.zk.ui.util.ComponentCloneListener, org.zkoss.zk.ui.util.Composer<org.zkoss.zk.ui.Component>, org.zkoss.zk.ui.util.ComposerExt<org.zkoss.zk.ui.Component>

public class CancelOrderController extends com.hybris.cockpitng.util.DefaultWidgetController
This controller creates a pop-up to cancel an order or its entries.
See Also:
  • Field Details

    • IN_SOCKET

      protected static final String IN_SOCKET
      See Also:
    • CONFIRM_ID

      protected static final String CONFIRM_ID
      See Also:
    • COMPLETED

      protected static final Object COMPLETED
    • CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_PICKUP

      protected static final String CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_PICKUP
      See Also:
    • CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_CONFIRM_TITLE

      protected static final String CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_CONFIRM_TITLE
      See Also:
    • CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_CONFIRM_ERROR

      protected static final String CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_CONFIRM_ERROR
      See Also:
    • CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_CONFIRM_MSG

      protected static final String CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_CONFIRM_MSG
      See Also:
    • CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_ERROR_QTYCANCELLED_INVALID

      protected static final String CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_ERROR_QTYCANCELLED_INVALID
      See Also:
    • CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_MISSING_QUANTITY

      protected static final String CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_MISSING_QUANTITY
      See Also:
    • CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_ERROR_REASON

      protected static final String CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_ERROR_REASON
      See Also:
    • CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_MISSING_SELECTED_LINE

      protected static final String CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_MISSING_SELECTED_LINE
      See Also:
    • CANCELORDER_CONFIRM_ICON

      protected static final String CANCELORDER_CONFIRM_ICON
      See Also:
    • COLUMN_INDEX_PENDING_QUANTITY

      protected static final int COLUMN_INDEX_PENDING_QUANTITY
      See Also:
    • COLUMN_INDEX_CANCEL_QUANTITY

      protected static final int COLUMN_INDEX_CANCEL_QUANTITY
      See Also:
    • COLUMN_INDEX_CANCEL_REASON

      protected static final int COLUMN_INDEX_CANCEL_REASON
      See Also:
    • COLUMN_INDEX_CANCEL_COMMENT

      protected static final int COLUMN_INDEX_CANCEL_COMMENT
      See Also:
  • Constructor Details

    • CancelOrderController

      public CancelOrderController()
  • Method Details

    • confirmCancellation

      public void confirmCancellation()
      Confirm the cancel order request
    • initCancellationOrderForm

      public void initCancellationOrderForm(OrderModel inputObject)
      Initialize the popup to cancel orders
      Parameters:
      inputObject - the order for which we want to cancel several entries
    • determineDeliveryMode

      protected String determineDeliveryMode(AbstractOrderEntryModel orderEntry)
      determines the delivery mode for a given orderEntry. A pick up Entry is an entry that have a DeliveryPointOfService, other wise we take the value from Entry DeliveryMode if not null, other wise we take the value from DeliveryMode on order level.
      Parameters:
      orderEntry - the AbstractOrderEntryModel for which to determine the delivery mode
      Returns:
      the delivery mode name for a given orderEntry
    • reset

      public void reset()
      Reinitialize the popup
    • addListeners

      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.
    • applyToGrid

      protected void applyToGrid(Object data, int childrenIndex)
      Apply a value to the elements contained in the grid
      Parameters:
      data - the value to pass to the grid
      childrenIndex - the index indicating where to find the right component in the grid
    • applyToRow

      protected void applyToRow(Object data, int childrenIndex, org.zkoss.zk.ui.Component row)
      Apply a specific change to a specific row of the grid
      Parameters:
      data - the new value to set
      childrenIndex - the index of the component in the grid
      row - the row to which the change needs to be applied
    • autoSelect

      protected void autoSelect(org.zkoss.zk.ui.event.Event event)
      Automatically select the checkbox in front of the row
      Parameters:
      event - the event that triggered the autoselect
    • buildCancelRequest

      protected OrderCancelRequest buildCancelRequest()
      Build the context parameter to cancel an order and return the given process
      Returns:
      a cancel request with the selected fields
    • createOrderCancelEntry

      protected void createOrderCancelEntry(List<OrderCancelEntry> orderCancelEntries, Object entry)
      Creates an OrderCancelEntry
      Parameters:
      orderCancelEntries - the list which contains all OrderCancelEntry
      entry - the entry to be converted into a OrderCancelEntry
    • getReasonIndex

      protected int getReasonIndex(CancelReason cancelReason)
      Gets the reason index within the combobox model
      Parameters:
      cancelReason - the reason for which we want to know the index
      Returns:
      the index of the given cancel reason
    • getSelectedCancelReason

      protected Optional<CancelReason> getSelectedCancelReason(org.zkoss.zk.ui.event.Event event)
      get the corresponding cancel reason according to the selected item in the combobox if existing
      Parameters:
      event - the select event on the combobox
      Returns:
      the corresponding cancel reason
    • handleGlobalCancelComment

      protected void handleGlobalCancelComment(org.zkoss.zk.ui.event.Event event)
      Applies a global comment to all individual entries after an event is triggered
      Parameters:
      event - the on changing event that was triggered by the user
    • handleGlobalCancelReason

      protected void handleGlobalCancelReason(org.zkoss.zk.ui.event.Event event)
      Applies a global reason to all individual entries after an event is triggered
      Parameters:
      event - the on select event that was triggered by the user
    • handleIndividualCancelReason

      protected void handleIndividualCancelReason(org.zkoss.zk.ui.event.Event event)
      Applies a cancel reason to an individual entry after an event is triggered
      Parameters:
      event - the on select event that was triggered by the user
    • handleRow

      protected void handleRow(org.zkoss.zul.Row row)
      Set or Reset the given row with the appropriate default information
      Parameters:
      row - the row to set/reset
    • getCustomSelectedCancelReason

      protected Optional<CancelReason> getCustomSelectedCancelReason(org.zkoss.zk.ui.event.Event event)
      Gets the label for the selected cancel reason in case the event has a target of Combobox
      Parameters:
      event - the event that was fired
      Returns:
      the CancelReason corresponding to the label.
    • matchingComboboxCancelReason

      protected Optional<CancelReason> matchingComboboxCancelReason(String cancelReasonLabel)
      Retrieve the CancelReason according to the selected label in the combobox
      Parameters:
      cancelReasonLabel - a String representation of the reason
      Returns:
      the CancelReason corresponding to the label
    • processCancellation

      protected void processCancellation(org.zkoss.zk.ui.event.Event obj)
      Process the cancellation Check if the user confirm the cancellation, then it sends the information to the service.
      Parameters:
      obj - the Event
    • selectAllEntries

      protected void selectAllEntries()
      Select or unselect all the rows of the grid and set the default values for each of them
    • showMessageBox

      protected void showMessageBox()
      Displays a message box whether the user wants to cancel the order
    • targetFieldToApplyValidation

      protected org.zkoss.zk.ui.Component targetFieldToApplyValidation(String stringToValidate, int indexLabelToCheck, int indexTargetComponent)
      Retrieve the row who needs to apply a validation message
      Parameters:
      stringToValidate - the string to compare to identify a specific row in the grid
      indexLabelToCheck - the index of the label to which we want to compare the passed string
      indexTargetComponent - the index of the grid where the target component is located
    • validateOrderEntry

      protected void validateOrderEntry(OrderEntryToCancelDto entry)
      Validate each order entry and throw a WrongValueException if it fails any check
      Parameters:
      entry - the individual entry to validate
    • validateRequest

      protected void validateRequest()
      Check if the data provided by the form are compliant with the validation rules
    • getOrderEntriesGridRows

      protected List<org.zkoss.zk.ui.Component> getOrderEntriesGridRows()
    • getLocale

      protected Locale getLocale()
    • getCockpitLocaleService

      protected BackofficeLocaleService getCockpitLocaleService()
    • getOrderEntries

      protected org.zkoss.zul.Grid getOrderEntries()
    • getOrderModel

      protected OrderModel getOrderModel()
    • setOrderModel

      public void setOrderModel(OrderModel orderModel)
    • getOrderCancelService

      protected OrderCancelService getOrderCancelService()
    • getEnumerationService

      protected EnumerationService getEnumerationService()
    • getModelService

      protected ModelService getModelService()
    • getCockpitEventQueue

      protected com.hybris.cockpitng.core.events.CockpitEventQueue getCockpitEventQueue()
    • getUserService

      protected UserService getUserService()
    • getNotificationService

      protected com.hybris.cockpitng.util.notifications.NotificationService getNotificationService()