Class 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 Detail

      • 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_CHARACTER
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 6.5
        See Also:
        CSV_DELIMITER, Constant Field Values
      • CSV_DELIMETER

        @Deprecated(since="6.5",
                    forRemoval=true)
        public static final java.lang.String CSV_DELIMETER
        Deprecated, 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
    • Constructor Detail

      • ListViewExportCSVAction

        public ListViewExportCSVAction()
    • Method Detail

      • perform

        public ActionResult<java.lang.Object> perform​(ActionContext<java.util.Map> ctx)
        Description copied from interface: CockpitAction
        Performs the action.
        Specified by:
        perform in interface CockpitAction<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: CockpitAction
        Returns true if the action can be performed for the given context, false otherwise.
        Specified by:
        canPerform in interface CockpitAction<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: CockpitAction
        Returns true if the action should be confirmed by user before being performed, false otherwise. This is evaluated by the action renderer.
        Specified by:
        needsConfirmation in interface CockpitAction<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
      • setLabelService

        public void setLabelService​(LabelService labelService)
      • setPermissionFacade

        public void setPermissionFacade​(PermissionFacade permissionFacade)
      • setPropertyValueService

        public void setPropertyValueService​(PropertyValueService propertyValueService)
      • getTypeFacade

        public TypeFacade getTypeFacade()
      • setTypeFacade

        public void setTypeFacade​(TypeFacade typeFacade)
      • setCockpitLocaleService

        public void setCockpitLocaleService​(CockpitLocaleService cockpitLocaleService)
      • setCockpitProperties

        public void setCockpitProperties​(CockpitProperties cockpitProperties)