java.lang.Object
de.hybris.platform.warehousingbackoffice.actions.exportpointsofservice.ExportPointsOfServiceAction
All Implemented Interfaces:
com.hybris.cockpitng.actions.CockpitAction<Map,Object>

public class ExportPointsOfServiceAction extends Object implements com.hybris.cockpitng.actions.CockpitAction<Map,Object>
Action to export a list of PointOfServiceModel as a CSV file so it can be later imported to Google Business.
  • Field Details

  • Constructor Details

    • ExportPointsOfServiceAction

      public ExportPointsOfServiceAction()
  • Method Details

    • perform

      public com.hybris.cockpitng.actions.ActionResult<Object> perform(com.hybris.cockpitng.actions.ActionContext<Map> actionContext)
      Specified by:
      perform in interface com.hybris.cockpitng.actions.CockpitAction<Map,Object>
    • writeBinaryResponse

      protected void writeBinaryResponse(String csvContent)
      Writes a CSV file to the browser for download.
      Parameters:
      csvContent - a string representation of the contents of the file
    • createCsv

      protected String createCsv(List<PointOfServiceModel> pointsOfService)
      Builds a CSV based upon a list of PointOfServiceModels
      Parameters:
      pointsOfService - list of PointOfServiceModels
      Returns:
      a CSV string representation of the list of PointOfServiceModels including column headers
    • createCsvContent

      protected void createCsvContent(StringBuilder stringBuilder, List<PointOfServiceModel> pointsOfService)
      Creates a CSV body representing a list of PointOfServiceModels
      Parameters:
      stringBuilder - StringBuilder used to build CSV
      pointsOfService - the PointOfServiceModels to be represented as CSVs
    • buildCsv

      protected void buildCsv(StringBuilder stringBuilder, PointOfServiceModel pointOfService)
      Builds the CSV
      Parameters:
      stringBuilder - StringBuilder used to build CSV
      pointOfService - the PointOfServiceModels to be represented as CSVs
    • validatePointOfServiceMeetsRequirements

      protected boolean validatePointOfServiceMeetsRequirements(PointOfServiceModel pointOfService)
      Returns true if the PointOfServiceModel contains or references all of the data required to pass minimum requirements for an import to Google My Business
      Parameters:
      pointOfService - the PointOfServiceModel to be validated
      Returns:
      whether or not the PointOfServiceModel meets the requirements of Google My Business
    • isPointOfServiceMeetsRequirements

      protected boolean isPointOfServiceMeetsRequirements(PointOfServiceModel pointOfService, String url)
      Checks conditions for which pointOfServiceMeetsRequirements will be false
      Parameters:
      pointOfService - the PointOfServiceModel to be validated
      url - the url of the site
      Returns:
      true or false
    • getDailySchedule

      protected String getDailySchedule(PointOfServiceModel pointOfService, int dayOfWeek)
      Generates a formatted 24 hour representation of the opening hours of a PointOfServiceModel for a given day of the week
      Parameters:
      pointOfService - the PointOfServiceModel for which the opening hours must be represented
      dayOfWeek - the day of the week specified as a Calendar constant
      Returns:
      a formatted 24 hour representation of the opening hours
    • getSpecialDaySchedule

      protected String getSpecialDaySchedule(SpecialOpeningDayModel specialOpeningDayModel)
      Provides the opening and closing times for a SpecialOpeningDayModel showing the date as well sa the hours, or an 'x' in the case of being closed.
      Parameters:
      specialOpeningDayModel - SpecialOpeningDayModel for which to show the date and opening times
      Returns:
      String of the format "yyyy-MM-dd: HH:mm-HH:mm" if open or "yyyy-MM-dd: x" if closed
    • prepareCsvValue

      protected String prepareCsvValue(String value)
      Prepares a value to be inserted into a CSV
      Parameters:
      value - the value to be prepared
      Returns:
      a CSV-ready value
    • canPerform

      public boolean canPerform(com.hybris.cockpitng.actions.ActionContext<Map> ctx)
      Specified by:
      canPerform in interface com.hybris.cockpitng.actions.CockpitAction<Map,Object>
    • needsConfirmation

      public boolean needsConfirmation(com.hybris.cockpitng.actions.ActionContext<Map> ctx)
      Specified by:
      needsConfirmation in interface com.hybris.cockpitng.actions.CockpitAction<Map,Object>
    • getConfirmationMessage

      public String getConfirmationMessage(com.hybris.cockpitng.actions.ActionContext<Map> ctx)
      Specified by:
      getConfirmationMessage in interface com.hybris.cockpitng.actions.CockpitAction<Map,Object>
    • getSiteBaseUrlResolutionService

      protected SiteBaseUrlResolutionService getSiteBaseUrlResolutionService()