Package com.basiscomponents.bc
Interface BusinessComponent
-
- All Known Subinterfaces:
IConfigurationsBC
- All Known Implementing Classes:
ConfigurationsBC
,SqlTableBC
public interface BusinessComponent
Interface to represent a BusinessComponent
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default DataRow
getAllowedFilter()
Returns a DataRow with fields (the values are not used) which are allowed for filtering.DataRow
getAttributesRecord()
Returns an empty DataRow including all field attributes (like field name, editable, label etc.), which the retrieve method could return.BusinessComponent
getLookup(String fieldName, DataRow dr)
returns a bc that contains data providing predefined values for a field.ResultSet
getLookupData(String fieldName, DataRow dr)
like getLookup, but instead returns a resultset containg the lookup data.DataRow
getNewObjectTemplate(DataRow conditions)
Returns a new (predefined) DataRow including all field attributes (like field name, editable, label etc.).void
remove(DataRow row)
Removes a DataRow.ResultSet
retrieve()
Retrieves a ResultSet with DataRow's.
If a filter is set, this will be applied to filter the result.
If a scope and/or a field selection is set, it will be used to retrieve the desired fields.ResultSet
retrieve(int first, int last)
Retrieves a ResultSet containing a subset of DataRow's (for pagination f.g.).
If a filter is set, this will be applied to filter the result.
If a scope and/or a field selection is set, it will be used to retrieve the desired fields.void
setFieldSelection(DataRow fieldSelection)
Set a field selection to retrieve a custom set of fields.
All fields will be returned if no field selection is set.void
setFieldSelection(Collection<String> fieldSelection)
Set a field selection to retrieve a custom set of fields.
The default scope will be used if no field selection is set.void
setFilter(DataRow filter)
Set a filter for the search result.
If the filter is set it will be used in the retrieve method.
If no filter is set, the retrieve method will return all data.void
setScope(String scope)
Set a field selection scope (A, B, C, etc.).
If no or a wrong scope is set then all fields will be returned.ResultSet
validateRemove(DataRow dr)
Validates a DataRow object before it can be removed.
This method is internally used by the remove method.
But it can also be called from the frontend to check for dependencies before it can be removed.ResultSet
validateWrite(DataRow dr)
Validates a DataRow object before it can be written.
This method is internally used by the write method.
But it can also be called from the frontend to check for required or missing data.DataRow
write(DataRow row)
Write/persist a DataRow.
-
-
-
Method Detail
-
getAttributesRecord
DataRow getAttributesRecord()
Returns an empty DataRow including all field attributes (like field name, editable, label etc.), which the retrieve method could return.- Returns:
- an empty DataRow with field attributes.
-
setFilter
void setFilter(DataRow filter)
Set a filter for the search result.
If the filter is set it will be used in the retrieve method.
If no filter is set, the retrieve method will return all data.- Parameters:
filter
- a DataRow including field names and values to filter for. Filters are AND combined.- See Also:
retrieve()
-
setFieldSelection
void setFieldSelection(DataRow fieldSelection)
Set a field selection to retrieve a custom set of fields.
All fields will be returned if no field selection is set.- Parameters:
fieldSelection
- a DataRow containing the field names for retrieving. Only the field names in the DataRow are used.
-
setFieldSelection
void setFieldSelection(Collection<String> fieldSelection)
Set a field selection to retrieve a custom set of fields.
The default scope will be used if no field selection is set.- Parameters:
fieldSelection
- a String Collection containing the field names for retrieving.
-
setScope
void setScope(String scope)
Set a field selection scope (A, B, C, etc.).
If no or a wrong scope is set then all fields will be returned.- Parameters:
scope
- the scope to set.
-
retrieve
ResultSet retrieve() throws Exception
Retrieves a ResultSet with DataRow's.
If a filter is set, this will be applied to filter the result.
If a scope and/or a field selection is set, it will be used to retrieve the desired fields.- Returns:
- a ResultSet with DataRow's (may be empty).
- Throws:
Exception
- may occur during reading.
-
retrieve
ResultSet retrieve(int first, int last) throws Exception
Retrieves a ResultSet containing a subset of DataRow's (for pagination f.g.).
If a filter is set, this will be applied to filter the result.
If a scope and/or a field selection is set, it will be used to retrieve the desired fields.- Parameters:
first
- the index to start from (0 based).last
- the index of the last element in the subset.- Returns:
- a ResultSet with DataRow's (may be empty).
- Throws:
Exception
- may occur during reading.
-
validateWrite
ResultSet validateWrite(DataRow dr)
Validates a DataRow object before it can be written.
This method is internally used by the write method.
But it can also be called from the frontend to check for required or missing data.- Parameters:
dr
- a DataRow to validated.- Returns:
- a ResultSet with validation messages (empty ResultSet means no validation errors).
Each DataRow in the ResultSet should have following fields: FIELD_NAME, TYPE and MESSAGE.
FIELD_NAME: the name of the validated field
TYPE: INFO, WARNING or ERROR
MESSAGE: the validation message
-
write
DataRow write(DataRow row) throws Exception
Write/persist a DataRow.- Parameters:
row
- the DataRow to write.- Returns:
- the updated DataRow (may contain auto generated values/ID's).
- Throws:
Exception
- when writing failed.- See Also:
validateWrite(DataRow dr)
-
validateRemove
ResultSet validateRemove(DataRow dr)
Validates a DataRow object before it can be removed.
This method is internally used by the remove method.
But it can also be called from the frontend to check for dependencies before it can be removed.- Parameters:
dr
- the DataRow that should be removed.- Returns:
- a ResultSet with validation messages (empty ResultSet means no validation errors).
Each DataRow in the ResultSet should have following fields: FIELD_NAME, TYPE and MESSAGE.
FIELD_NAME: the name of the validated field
TYPE: INFO, WARNING or ERROR
MESSAGE: the validation message
-
remove
void remove(DataRow row) throws Exception
Removes a DataRow.- Parameters:
row
- the DataRow to remove.- Throws:
Exception
- if deleting failed.- See Also:
validateRemove(DataRow dr)
-
getNewObjectTemplate
DataRow getNewObjectTemplate(DataRow conditions)
Returns a new (predefined) DataRow including all field attributes (like field name, editable, label etc.).- Parameters:
conditions
- a DataRow with predefined fields.- Returns:
- a new predefined DataRow with the field attributes.
-
getAllowedFilter
default DataRow getAllowedFilter()
Returns a DataRow with fields (the values are not used) which are allowed for filtering. The default implementation returns getAttributesRecord().- Returns:
- a DataRow with fields used for filtering.
-
getLookup
BusinessComponent getLookup(String fieldName, DataRow dr)
returns a bc that contains data providing predefined values for a field. for example a lookup for a field "country" could return a countryBC which can retrieve values to fill a ListButton with. other fields are ignored.- Parameters:
fieldName
- the field to retrieve the Lookup fordr
- current datarow- Returns:
- the lookup BC
-
-