Class ExportPointsOfServiceAction
java.lang.Object
de.hybris.platform.warehousingbackoffice.actions.exportpointsofservice.ExportPointsOfServiceAction
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuildCsv(StringBuilder stringBuilder, PointOfServiceModel pointOfService) Builds the CSVbooleancanPerform(com.hybris.cockpitng.actions.ActionContext<Map> ctx) protected StringcreateCsv(List<PointOfServiceModel> pointsOfService) Builds a CSV based upon a list ofPointOfServiceModelsprotected voidcreateCsvContent(StringBuilder stringBuilder, List<PointOfServiceModel> pointsOfService) Creates a CSV body representing a list ofPointOfServiceModelsgetConfirmationMessage(com.hybris.cockpitng.actions.ActionContext<Map> ctx) protected StringgetDailySchedule(PointOfServiceModel pointOfService, int dayOfWeek) Generates a formatted 24 hour representation of the opening hours of aPointOfServiceModelfor a given day of the weekprotected SiteBaseUrlResolutionServiceprotected StringgetSpecialDaySchedule(SpecialOpeningDayModel specialOpeningDayModel) Provides the opening and closing times for aSpecialOpeningDayModelshowing the date as well sa the hours, or an 'x' in the case of being closed.protected booleanisPointOfServiceMeetsRequirements(PointOfServiceModel pointOfService, String url) Checks conditions for which pointOfServiceMeetsRequirements will be falsebooleanneedsConfirmation(com.hybris.cockpitng.actions.ActionContext<Map> ctx) com.hybris.cockpitng.actions.ActionResult<Object>protected StringprepareCsvValue(String value) Prepares a value to be inserted into a CSVprotected booleanvalidatePointOfServiceMeetsRequirements(PointOfServiceModel pointOfService) Returns true if thePointOfServiceModelcontains or references all of the data required to pass minimum requirements for an import to Google My Businessprotected voidwriteBinaryResponse(String csvContent) Writes a CSV file to the browser for download.
-
Field Details
-
CSV_HEADERS
- See Also:
-
MODEL_PAGEABLE
- See Also:
-
-
Constructor Details
-
ExportPointsOfServiceAction
public ExportPointsOfServiceAction()
-
-
Method Details
-
perform
-
writeBinaryResponse
Writes a CSV file to the browser for download.- Parameters:
csvContent- a string representation of the contents of the file
-
createCsv
Builds a CSV based upon a list ofPointOfServiceModels- Parameters:
pointsOfService- list ofPointOfServiceModels- 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 ofPointOfServiceModels- Parameters:
stringBuilder-StringBuilderused to build CSVpointsOfService- thePointOfServiceModels to be represented as CSVs
-
buildCsv
Builds the CSV- Parameters:
stringBuilder-StringBuilderused to build CSVpointOfService- thePointOfServiceModels to be represented as CSVs
-
validatePointOfServiceMeetsRequirements
Returns true if thePointOfServiceModelcontains or references all of the data required to pass minimum requirements for an import to Google My Business- Parameters:
pointOfService- thePointOfServiceModelto be validated- Returns:
- whether or not the
PointOfServiceModelmeets the requirements of Google My Business
-
isPointOfServiceMeetsRequirements
Checks conditions for which pointOfServiceMeetsRequirements will be false- Parameters:
pointOfService- thePointOfServiceModelto be validatedurl- the url of the site- Returns:
- true or false
-
getDailySchedule
Generates a formatted 24 hour representation of the opening hours of aPointOfServiceModelfor a given day of the week- Parameters:
pointOfService- thePointOfServiceModelfor which the opening hours must be representeddayOfWeek- the day of the week specified as aCalendarconstant- Returns:
- a formatted 24 hour representation of the opening hours
-
getSpecialDaySchedule
Provides the opening and closing times for aSpecialOpeningDayModelshowing the date as well sa the hours, or an 'x' in the case of being closed.- Parameters:
specialOpeningDayModel-SpecialOpeningDayModelfor 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
Prepares a value to be inserted into a CSV- Parameters:
value- the value to be prepared- Returns:
- a CSV-ready value
-
canPerform
-
needsConfirmation
-
getConfirmationMessage
-
getSiteBaseUrlResolutionService
-