Package org.openbravo.service.datasource
Class BaseDataSourceService
- java.lang.Object
-
- org.openbravo.service.datasource.BaseDataSourceService
-
- All Implemented Interfaces:
DataSourceService
- Direct Known Subclasses:
ComboTableDatasourceService
,DefaultDataSourceService
,ModelDataSourceService
public abstract class BaseDataSourceService extends Object implements DataSourceService
A base data source service which can be extended. It combines the common parts for data sources which are based on an entity and full-computed data sources.- Author:
- mtaal
-
-
Constructor Summary
Constructors Constructor Description BaseDataSourceService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkEditDatasourceAccess(Map<String,String> parameters)
This method allows to implement a security access to a DataSource when it is used add(), update() or remove() methods.void
checkFetchDatasourceAccess(Map<String,String> parameters)
This method allows to implement a security access to a DataSource when it is used fetch() method.DataSource
getDataSource()
This method allows to implement a security access to a DataSource when it is used add(), update() or remove() methods.List<DataSourceProperty>
getDataSourceProperties(Map<String,Object> parameters)
Create the properties used in the template.String
getDataUrl()
Entity
getEntity()
String
getName()
The name of this service, in the default implementation this is the entityname of theEntity
to get/insert/update/delete.Template
getTemplate()
protected String
getWhereAndFilterClause(Map<String,String> parameters)
This method returns a String with the where and filter clauses that will be applied.String
getWhereClause()
protected void
handleExceptionUnsecuredDSAccess(OBSecurityException securityException)
void
setDataSource(DataSource dataSource)
Passes in the data source read from the database.void
setDataUrl(String dataUrl)
void
setEntity(Entity entity)
void
setName(String name)
void
setWhereClause(String whereClause)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openbravo.service.datasource.DataSourceService
add, fetch, remove, update
-
-
-
-
Method Detail
-
getTemplate
public Template getTemplate()
- Specified by:
getTemplate
in interfaceDataSourceService
- Returns:
- the Template used to render the data source
-
getName
public String getName()
Description copied from interface:DataSourceService
The name of this service, in the default implementation this is the entityname of theEntity
to get/insert/update/delete.- Specified by:
getName
in interfaceDataSourceService
- Returns:
- the name of the service
-
getDataUrl
public String getDataUrl()
- Specified by:
getDataUrl
in interfaceDataSourceService
-
setDataUrl
public void setDataUrl(String dataUrl)
- Specified by:
setDataUrl
in interfaceDataSourceService
-
getWhereClause
public String getWhereClause()
- Specified by:
getWhereClause
in interfaceDataSourceService
-
setWhereClause
public void setWhereClause(String whereClause)
- Specified by:
setWhereClause
in interfaceDataSourceService
-
getDataSourceProperties
public List<DataSourceProperty> getDataSourceProperties(Map<String,Object> parameters)
Description copied from interface:DataSourceService
Create the properties used in the template.- Specified by:
getDataSourceProperties
in interfaceDataSourceService
- Parameters:
parameters
- parameters used for this request- Returns:
- the list of DataSourceProperty instances to use in the template
-
getDataSource
public DataSource getDataSource()
Description copied from interface:DataSourceService
This method allows to implement a security access to a DataSource when it is used add(), update() or remove() methods. It can be overridden in specific DataSources to apply a particular security mechanism.- Specified by:
getDataSource
in interfaceDataSourceService
- Returns:
- the data source read from the database. Note: can be null for data sources which are created in-memory on request.
-
setDataSource
public void setDataSource(DataSource dataSource)
Description copied from interface:DataSourceService
Passes in the data source read from the database. Is the place to initialize the data in the service class- Specified by:
setDataSource
in interfaceDataSourceService
- Parameters:
dataSource
- the data source read from the database.
-
checkEditDatasourceAccess
public void checkEditDatasourceAccess(Map<String,String> parameters)
Description copied from interface:DataSourceService
This method allows to implement a security access to a DataSource when it is used add(), update() or remove() methods. It can be overridden in specific DataSources to apply a particular security mechanism.- Specified by:
checkEditDatasourceAccess
in interfaceDataSourceService
-
checkFetchDatasourceAccess
public void checkFetchDatasourceAccess(Map<String,String> parameters)
Description copied from interface:DataSourceService
This method allows to implement a security access to a DataSource when it is used fetch() method. It can be overridden in specific DataSources to apply a particular security mechanism.- Specified by:
checkFetchDatasourceAccess
in interfaceDataSourceService
-
getWhereAndFilterClause
protected String getWhereAndFilterClause(Map<String,String> parameters)
This method returns a String with the where and filter clauses that will be applied.- Returns:
- A String with the value of the where and filter clause. It can be null when there is no filter clause nor where clause.
-
handleExceptionUnsecuredDSAccess
protected void handleExceptionUnsecuredDSAccess(OBSecurityException securityException)
-
getEntity
public Entity getEntity()
- Specified by:
getEntity
in interfaceDataSourceService
-
setEntity
public void setEntity(Entity entity)
- Specified by:
setEntity
in interfaceDataSourceService
-
setName
public void setName(String name)
- Specified by:
setName
in interfaceDataSourceService
-
-