Interface ImportRow


public interface ImportRow
Definition of an import row.

At the raw level, it is an (actual name, string value) map.
At the typed level, it is an (actual name, object value) map.

Author:
Damien Carbonne
  • Field Details

    • ERASE

      static final String ERASE
      The special value used to erase (set to null) an attribute.

      This special value can only be used for updates of optional data.

      See Also:
  • Method Details

    • getSystemId

      String getSystemId()
      Returns:
      The systemId of the imported data.
    • getSheetName

      String getSheetName()
      Returns:
      The sheet name of the imported row.
    • getTemplateInstance

      SheetTemplateInstance getTemplateInstance()
    • getTemplate

      SheetTemplate getTemplate()
      Returns:
      The associated template.
    • getNames

      Set<String> getNames()
      Returns:
      The column names.
    • getNumber

      int getNumber()
      Returns the number (1-based) of this row.

      The first data row should start at 2.

      Returns:
      The row number (1-based).
    • getAction

      @Deprecated(since="2024-06-29", forRemoval=true) default ImportAction getAction()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      The action to be taken for this row.
    • getAction

      ImportAction getAction(Optional<ImportAction> defaultAction)
      Returns the action to take for the row:
      • If an action is defined in the row, then it is returned.
      • If no action is defined in the row, and defaultAction is set, then defaultAction is returned.
      • If no action is defined in the row, and defaultAction is not set, then SheetTemplate.getDefaultAction() is returned.
      Parameters:
      defaultAction - The optional default action.
      Returns:
      The action to be taken for this row.
    • isErase

      boolean isErase(String name)
      Returns true if the data associated to a column must be erased.
      Parameters:
      name - The column name.
      Returns:
      true if the data associated to column named name must be erased.
      Throws:
      IllegalArgumentException - When name is null.
    • isErase

      default boolean isErase(ColumnTemplate<?> column)
      Returns true if the data associated to a name column must be erased.

      WARNING: MUST be used with a name column.

      Parameters:
      column - The column.
      Returns:
      true if the data associated to column must be erased.
      Throws:
      IllegalArgumentException - When column is null or is not a name column.
    • getRawDataOrNull

      String getRawDataOrNull(String name)
      Returns the raw data associated to a column or null.
      Parameters:
      name - The column name.
      Returns:
      The raw data associated to column named name or null.
      Throws:
      IllegalArgumentException - When name is null.
    • getDataOrNull

      Object getDataOrNull(String name)
      Returns the data associated to a column or null.

      If data must be erased, null is returned.

      Parameters:
      name - The column name.
      Returns:
      The data associated to column named name or null.
      Throws:
      IllegalArgumentException - When name is null.
    • getData

      default Object getData(String name, Object def)
      Returns the data associated to a column or a default value.

      If data must be erased, the default value def is returned.

      Parameters:
      name - The column name.
      def - The default value.
      Returns:
      The data associated to column named name or def.
      Throws:
      IllegalArgumentException - When name is null.
    • getDataOrNull

      <T> T getDataOrNull(Class<T> cls, String name)
      Returns the data associated to a column or null.

      WARNING: if data must be erased, null is returned.

      Type Parameters:
      T - The result type.
      Parameters:
      cls - The result class.
      name - The column name.
      Returns:
      The data associated to column named name or null.
      Throws:
      IllegalArgumentException - When cls or name is null.
      ClassCastException - When the associated data can not be converted to cls
    • getData

      default <T> T getData(Class<T> cls, String name, T def)
      Returns the data associated to a column or a default value.

      WARNING: if data must be erased, the default value (def) is returned.

      Type Parameters:
      T - The result type.
      Parameters:
      cls - The result class.
      name - The column name.
      def - The default value.
      Returns:
      The data associated to column named name or def.
      Throws:
      IllegalArgumentException - When cls or name is null.
      ClassCastException - When the associated data can not be converted to cls
    • getDataOrNull

      default <T> T getDataOrNull(ColumnTemplate<T> column)
      Returns the data associated to a column or null.

      WARNING: if data must be erased, null is returned.

      Type Parameters:
      T - The result type.
      Parameters:
      column - The column.
      Returns:
      The data associated to column or null.
      Throws:
      IllegalArgumentException - When column is null or is not a name column.
      ClassCastException - When the associated data can not be converted to column data type.
    • getData

      default <T> T getData(ColumnTemplate<T> column, T def)
      Returns the data associated to a column or a default value.

      WARNING: if data must be erased, the default value def is returned.

      Type Parameters:
      T - The result type.
      Parameters:
      column - The column.
      def - The default value.
      Returns:
      The data associated to column or def.
      Throws:
      IllegalArgumentException - When column is null or is not a name.
      ClassCastException - When the associated data can not be converted to column data type.
    • getDataOrDef

      default <T> T getDataOrDef(ColumnTemplate<T> column)
      Returns the data associated to a column or the column default value.

      WARNING: if data must be erased, the column default value is returned.

      Type Parameters:
      T - The result type.
      Parameters:
      column - The column.
      Returns:
      The data associated to column or the column default value (ColumnTemplate.getDef()).
    • getIssues

      List<cdc.issues.Issue> getIssues()
      Returns:
      The issues associated to this row.
    • canBeProcessed

      boolean canBeProcessed()
      Returns:
      true if this row can be processed.
      There are no CRITICAL (or more severe) issues.
    • isEmpty

      boolean isEmpty()
      Returns:
      true if this row is empty. This may happen when rows are removed from a sheet.
    • getLocation

      cdc.issues.locations.WorkbookLocation getLocation()
      Returns:
      The location corresponding to this row.