Class ListViewExportCSVAction
- java.lang.Object
-
- com.hybris.cockpitng.actions.export.csv.ListViewExportCSVAction
-
- All Implemented Interfaces:
CockpitAction<java.util.Map,java.lang.Object>
public class ListViewExportCSVAction extends java.lang.Object implements CockpitAction<java.util.Map,java.lang.Object>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBEGIN_SPREADSHEET_FORMULA_CHARACTERDeprecated, for removal: This API element is subject to removal in a future version.since 6.5static java.lang.StringCOCKPITNG_EXPORT_CSV_ACTION_INPUT_SANITIZATION_ENABLEDstatic java.lang.StringCOCKPITNG_EXPORT_CSV_ACTION_INPUT_SANITIZATION_MODEstatic java.lang.StringCOCKPITNG_EXPORT_CSV_ACTION_INPUT_SANITIZATION_PREFIXstatic java.lang.StringCONFIRMATION_THRESHOLDstatic java.lang.StringCSV_DELIMETERDeprecated, for removal: This API element is subject to removal in a future version.since 6.5static java.lang.StringCSV_DELIMITERstatic java.lang.StringDEFAULT_SANITIZATION_PREFIXstatic java.lang.StringEXPORT_CSV_CONFIRMATIONprotected static char[]FORMULA_CHARACTERSstatic java.lang.StringMODEL_COLUMNS_CONFIGstatic java.lang.StringMODEL_PAGEABLEstatic java.lang.StringSANITIZATION_MODE_PREFIXstatic java.lang.StringSANITIZATION_MODE_TRIM
-
Constructor Summary
Constructors Constructor Description ListViewExportCSVAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanPerform(ActionContext<java.util.Map> ctx)Returns true if the action can be performed for the given context, false otherwise.protected java.lang.StringescapeForCSV(java.lang.String value)CockpitLocaleServicegetCockpitLocaleService()CockpitPropertiesgetCockpitProperties()java.lang.StringgetConfirmationMessage(ActionContext<java.util.Map> ctx)Returns the confirmation message to be shown to the user in the confirmation dialog if confirmation is needed (seeCockpitAction.needsConfirmation(ActionContext)).LabelServicegetLabelService()PermissionFacadegetPermissionFacade()PropertyValueServicegetPropertyValueService()protected java.lang.ObjectgetSpringBean(java.lang.String springBeanName)TypeFacadegetTypeFacade()booleanneedsConfirmation(ActionContext<java.util.Map> ctx)Returns true if the action should be confirmed by user before being performed, false otherwise.protected booleanpayloadStartsWithFormulaCharacter(java.lang.String result)ActionResult<java.lang.Object>perform(ActionContext<java.util.Map> ctx)Performs the action.protected java.lang.StringsanitizeInput(java.lang.String payload)The main purpose of this method is to sanitize the given payload in a way that will allow CSV processing tools - like Excel - to open it without the risk of malicious script being activated.voidsetCockpitLocaleService(CockpitLocaleService cockpitLocaleService)voidsetCockpitProperties(CockpitProperties cockpitProperties)voidsetLabelService(LabelService labelService)voidsetPermissionFacade(PermissionFacade permissionFacade)voidsetPropertyValueService(PropertyValueService propertyValueService)voidsetTypeFacade(TypeFacade typeFacade)protected voidwriteBinaryResponse(java.lang.String csvContent)
-
-
-
Field Detail
-
MODEL_PAGEABLE
public static final java.lang.String MODEL_PAGEABLE
- See Also:
- Constant Field Values
-
MODEL_COLUMNS_CONFIG
public static final java.lang.String MODEL_COLUMNS_CONFIG
- See Also:
- Constant Field Values
-
CONFIRMATION_THRESHOLD
public static final java.lang.String CONFIRMATION_THRESHOLD
- See Also:
- Constant Field Values
-
EXPORT_CSV_CONFIRMATION
public static final java.lang.String EXPORT_CSV_CONFIRMATION
- See Also:
- Constant Field Values
-
BEGIN_SPREADSHEET_FORMULA_CHARACTER
@Deprecated(since="6.5", forRemoval=true) public static final java.lang.String BEGIN_SPREADSHEET_FORMULA_CHARACTERDeprecated, for removal: This API element is subject to removal in a future version.since 6.5- See Also:
CSV_DELIMITER, Constant Field Values
-
CSV_DELIMITER
public static final java.lang.String CSV_DELIMITER
- See Also:
- Constant Field Values
-
CSV_DELIMETER
@Deprecated(since="6.5", forRemoval=true) public static final java.lang.String CSV_DELIMETERDeprecated, for removal: This API element is subject to removal in a future version.since 6.5- See Also:
CSV_DELIMITER, Constant Field Values
-
COCKPITNG_EXPORT_CSV_ACTION_INPUT_SANITIZATION_ENABLED
public static final java.lang.String COCKPITNG_EXPORT_CSV_ACTION_INPUT_SANITIZATION_ENABLED
- See Also:
- Constant Field Values
-
COCKPITNG_EXPORT_CSV_ACTION_INPUT_SANITIZATION_MODE
public static final java.lang.String COCKPITNG_EXPORT_CSV_ACTION_INPUT_SANITIZATION_MODE
- See Also:
- Constant Field Values
-
COCKPITNG_EXPORT_CSV_ACTION_INPUT_SANITIZATION_PREFIX
public static final java.lang.String COCKPITNG_EXPORT_CSV_ACTION_INPUT_SANITIZATION_PREFIX
- See Also:
- Constant Field Values
-
SANITIZATION_MODE_TRIM
public static final java.lang.String SANITIZATION_MODE_TRIM
- See Also:
- Constant Field Values
-
SANITIZATION_MODE_PREFIX
public static final java.lang.String SANITIZATION_MODE_PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_SANITIZATION_PREFIX
public static final java.lang.String DEFAULT_SANITIZATION_PREFIX
- See Also:
- Constant Field Values
-
FORMULA_CHARACTERS
protected static final char[] FORMULA_CHARACTERS
-
-
Method Detail
-
perform
public ActionResult<java.lang.Object> perform(ActionContext<java.util.Map> ctx)
Description copied from interface:CockpitActionPerforms the action.- Specified by:
performin interfaceCockpitAction<java.util.Map,java.lang.Object>- Parameters:
ctx- context containing the data and other information- Returns:
- the action result
-
writeBinaryResponse
protected void writeBinaryResponse(java.lang.String csvContent)
-
getSpringBean
protected java.lang.Object getSpringBean(java.lang.String springBeanName)
-
escapeForCSV
protected java.lang.String escapeForCSV(java.lang.String value)
-
sanitizeInput
protected java.lang.String sanitizeInput(java.lang.String payload)
The main purpose of this method is to sanitize the given payload in a way that will allow CSV processing tools - like Excel - to open it without the risk of malicious script being activated.- Parameters:
payload- text to be placed in the final SCV file- Returns:
- sanitized version of payload
-
payloadStartsWithFormulaCharacter
protected boolean payloadStartsWithFormulaCharacter(java.lang.String result)
-
canPerform
public boolean canPerform(ActionContext<java.util.Map> ctx)
Description copied from interface:CockpitActionReturns true if the action can be performed for the given context, false otherwise.- Specified by:
canPerformin interfaceCockpitAction<java.util.Map,java.lang.Object>- Parameters:
ctx- context containing the data and other information- Returns:
- true if the action can be performed for the given context, false otherwise
-
needsConfirmation
public boolean needsConfirmation(ActionContext<java.util.Map> ctx)
Description copied from interface:CockpitActionReturns true if the action should be confirmed by user before being performed, false otherwise. This is evaluated by the action renderer.- Specified by:
needsConfirmationin interfaceCockpitAction<java.util.Map,java.lang.Object>- Parameters:
ctx- context containing the data and other information- Returns:
- true if the action should be confirmed by user before being performed, false otherwise
-
getConfirmationMessage
public java.lang.String getConfirmationMessage(ActionContext<java.util.Map> ctx)
Description copied from interface:CockpitActionReturns the confirmation message to be shown to the user in the confirmation dialog if confirmation is needed (seeCockpitAction.needsConfirmation(ActionContext)).- Specified by:
getConfirmationMessagein interfaceCockpitAction<java.util.Map,java.lang.Object>- Parameters:
ctx- context containing the data and other information- Returns:
- the confirmation message to be shown to the user in the confirmation dialog
- See Also:
CockpitAction.needsConfirmation(ActionContext)
-
getLabelService
public LabelService getLabelService()
-
setLabelService
public void setLabelService(LabelService labelService)
-
getPermissionFacade
public PermissionFacade getPermissionFacade()
-
setPermissionFacade
public void setPermissionFacade(PermissionFacade permissionFacade)
-
getPropertyValueService
public PropertyValueService getPropertyValueService()
-
setPropertyValueService
public void setPropertyValueService(PropertyValueService propertyValueService)
-
getTypeFacade
public TypeFacade getTypeFacade()
-
setTypeFacade
public void setTypeFacade(TypeFacade typeFacade)
-
getCockpitLocaleService
public CockpitLocaleService getCockpitLocaleService()
-
setCockpitLocaleService
public void setCockpitLocaleService(CockpitLocaleService cockpitLocaleService)
-
getCockpitProperties
public CockpitProperties getCockpitProperties()
-
setCockpitProperties
public void setCockpitProperties(CockpitProperties cockpitProperties)
-
-