public abstract class SpreadsheetWorksheet extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
alias |
protected boolean |
dataTypeStrict |
protected boolean |
existsInSpreadsheet |
protected SpreadsheetWorksheetHeader |
header |
protected SpreadsheetModel |
model |
protected String |
name |
| Constructor and Description |
|---|
SpreadsheetWorksheet(SpreadsheetModel model,
String name,
boolean existsInSpreadsheet) |
| Modifier and Type | Method and Description |
|---|---|
SpreadsheetColumn |
addColumn(int index,
String name)
Adds information about an existing header column to the worksheet.
|
SpreadsheetColumn |
addColumn(ISpreadsheetMetadata.SpreadsheetColumnMetadata metadata)
Adds information about an existing header column to the worksheet.
|
SpreadsheetRow |
addRow(Map<String,Object> parameters)
Writes a row to the worksheet.
|
SpreadsheetRow |
addRowWithValuesInColumns(Map<SpreadsheetColumn,Object> parameters)
Writes a row to the worksheet.
|
protected void |
addWorksheetMetadata(ISpreadsheetMetadata.SpreadsheetWorksheetMetadata metadata)
Adds worksheet metadata to the worksheet
|
protected void |
checkThatWorksheetExists()
This method checks if this worksheet exists in the spreadsheet.
|
protected abstract SpreadsheetColumn |
createColumn(int index)
Creates a column with the specified column index
|
protected abstract void |
createInSpreadsheet()
The purpose of this method is to create this worksheet in the spreadsheet
|
void |
deleteRow(SpreadsheetRow row)
Deletes the given row from the worksheet.
|
List<SpreadsheetRow> |
findRows(SpreadsheetColumn column,
String value)
Finds all rows in the worksheet whose cell, corresponding to the given
column, has the provided value.
|
String |
getAlias() |
SpreadsheetColumn |
getColumn(int index)
Gets the header column with the matching index
|
SpreadsheetColumn |
getColumn(String identifier)
Gets the column with the matching identifier
|
abstract String |
getDefaultEmptyCellValue()
This method returns the default value to be written to a cell when a new
empty row is created in a worksheet that is not enforcing data type
strictness.
|
boolean |
getDoesNotExistInSpreadsheet() |
boolean |
getExistsInSpreadsheet() |
SpreadsheetWorksheetHeader |
getHeader() |
SpreadsheetModel |
getModel() |
String |
getName() |
protected String |
getNonexistentWorksheetMessage() |
abstract List<SpreadsheetRow> |
getRows()
Gets all rows contained by the worksheet
|
Map<SpreadsheetColumn,String> |
getValuesForEmptyRow()
The purpose of this method is to return a map where each column of this
worksheet is associated with its default value.
|
protected abstract SpreadsheetRow |
insertRow(Map<SpreadsheetColumn,String> values)
Inserts a new row in the worksheet with given values in the given columns.
|
boolean |
isDataTypeStrict() |
boolean |
isIdentifiablyBy(String identifier)
A worksheet can be identified by either it's name or alias.
|
protected abstract void |
loadHeader()
Loads header row information - index and name - from the spreadsheet if the
worksheet exists in the spreadsheet
|
abstract void |
removeRow(SpreadsheetRow row)
Deletes the given row from the actual worksheet.
|
String |
toString() |
protected SpreadsheetModel model
protected SpreadsheetWorksheetHeader header
protected boolean existsInSpreadsheet
protected String name
protected String alias
protected boolean dataTypeStrict
public SpreadsheetWorksheet(SpreadsheetModel model, String name, boolean existsInSpreadsheet)
public SpreadsheetModel getModel()
public SpreadsheetWorksheetHeader getHeader()
public boolean getExistsInSpreadsheet()
public boolean getDoesNotExistInSpreadsheet()
public String getName()
public String getAlias()
public boolean isDataTypeStrict()
public boolean isIdentifiablyBy(String identifier)
identifier - protected abstract void createInSpreadsheet()
RuntimeExceptionprotected abstract void loadHeader()
throws EolModelLoadingException
EolModelLoadingExceptionprotected void addWorksheetMetadata(ISpreadsheetMetadata.SpreadsheetWorksheetMetadata metadata) throws IllegalArgumentException
metadata - IllegalArgumentExceptionpublic SpreadsheetColumn getColumn(String identifier)
identifier - public SpreadsheetColumn getColumn(int index)
index - public SpreadsheetColumn addColumn(int index, String name)
index - name - public SpreadsheetColumn addColumn(ISpreadsheetMetadata.SpreadsheetColumnMetadata metadata)
metadata - protected abstract SpreadsheetColumn createColumn(int index)
index - public abstract List<SpreadsheetRow> getRows()
public SpreadsheetRow addRow(Map<String,Object> parameters)
getDefaultEmptyCellValue() or the default value for the
column's data type if worksheet is data type strict.parameters - IllegalArgumentException - if a column identifier could not be mapped
to a column in the worksheetpublic SpreadsheetRow addRowWithValuesInColumns(Map<SpreadsheetColumn,Object> parameters)
getDefaultEmptyCellValue() or the default value for the column's
data type if worksheet is data type strict.parameters - public Map<SpreadsheetColumn,String> getValuesForEmptyRow()
public abstract String getDefaultEmptyCellValue()
protected abstract SpreadsheetRow insertRow(Map<SpreadsheetColumn,String> values)
values - public void deleteRow(SpreadsheetRow row) throws EolRuntimeException
row - EolRuntimeExceptionpublic abstract void removeRow(SpreadsheetRow row)
row - EolRuntimeExceptionpublic List<SpreadsheetRow> findRows(SpreadsheetColumn column, String value)
column - value - protected void checkThatWorksheetExists()
throws IllegalStateException
IllegalStateException - if worksheet does not existprotected String getNonexistentWorksheetMessage()
Copyright © 2020. All rights reserved.