Class AdminOfferController


@Controller("blAdminOfferController") @RequestMapping("/offer") public class AdminOfferController extends AdminBasicEntityController
Handles admin operations for the Offer entity. Certain Offer fields should only render when specific values are set for other fields; we provide the support for that in this controller.
Author:
Andre Azzolini (apazzolini)
  • Field Details

  • Constructor Details

    • AdminOfferController

      public AdminOfferController()
  • Method Details

    • getSectionKey

      protected String getSectionKey(Map<String,String> pathVars)
      Description copied from class: AdminAbstractController
      This method is used to determine the current section key. For this default implementation, the sectionKey is pulled from the pathVariable, {sectionKey}, as defined by the request mapping on this controller. To support controller inheritance and allow more specialized controllers to delegate some methods to this basic controller, overridden implementations of this method could return a hardcoded value instead of reading the map
      Overrides:
      getSectionKey in class AdminAbstractController
      Parameters:
      pathVars - - the map of all currently bound path variables for this request
      Returns:
      the sectionKey for this request
    • getSectionCustomCriteria

      public String[] getSectionCustomCriteria()
      Description copied from class: AdminAbstractController
      This method is invoked for every request for this controller. By default, we do not want to specify a custom criteria, but specialized controllers may want to.
      Overrides:
      getSectionCustomCriteria in class AdminAbstractController
      Returns:
      the custom criteria for this section for all requests, if any
    • viewEntityList

      @RequestMapping(value="", method=GET) public String viewEntityList(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String,String> pathVars, @RequestParam org.springframework.util.MultiValueMap<String,String> requestParams) throws Exception
      Description copied from class: AdminBasicEntityController
      Renders the main entity listing for the specified class, which is based on the current sectionKey with some optional criteria.
      Overrides:
      viewEntityList in class AdminBasicEntityController
      requestParams - a Map of property name -> list critiera values
      Returns:
      the return view path
      Throws:
      Exception
    • viewEntityForm

      @RequestMapping(value="/{id}", method=GET) public String viewEntityForm(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String,String> pathVars, @PathVariable("id") String id) throws Exception
      Description copied from class: AdminBasicEntityController
      Renders the main entity form for the specified entity
      Overrides:
      viewEntityForm in class AdminBasicEntityController
      Returns:
      the return view path
      Throws:
      Exception
    • viewAddEntityForm

      @RequestMapping(value="/add", method=GET) public String viewAddEntityForm(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String,String> pathVars, @RequestParam(defaultValue="") String entityType) throws Exception
      Description copied from class: AdminBasicEntityController
      Renders the modal form that is used to add a new parent level entity. Note that this form cannot render any subcollections as operations on those collections require the parent level entity to first be saved and have and id. Once the entity is initially saved, we will redirect the user to the normal manage entity screen where they can then perform operations on sub collections.
      Overrides:
      viewAddEntityForm in class AdminBasicEntityController
      Returns:
      the return view path
      Throws:
      Exception
    • addEntity

      @RequestMapping(value="/add", method=POST) public String addEntity(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String,String> pathVars, @ModelAttribute("entityForm") EntityForm entityForm, org.springframework.validation.BindingResult result) throws Exception
      Description copied from class: AdminBasicEntityController
      Processes the request to add a new entity. If successful, returns a redirect to the newly created entity.
      Overrides:
      addEntity in class AdminBasicEntityController
      Returns:
      the return view path
      Throws:
      Exception
    • duplicateEntity

      @Deprecated @RequestMapping(value="/{id}/duplicate", method=POST) public String duplicateEntity(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String,String> pathVars, @PathVariable("id") String id, @ModelAttribute("entityForm") EntityForm entityForm, org.springframework.validation.BindingResult result) throws Exception
      Deprecated.
      Moved method to superclass
      Overrides:
      duplicateEntity in class AdminBasicEntityController
      Throws:
      Exception
    • modifyModelAttributes

      protected void modifyModelAttributes(org.springframework.ui.Model model)
      Offer field visibility is dependent on other fields in the entity. Mark the form with the appropriate class so that the Javascript will know to handle this form.

      We also want to tell the UI to make item target criteria required. We cannot manage this at the entity level via an