Package org.openbravo.service.datasource
Class DefaultDataSourceService
- java.lang.Object
-
- org.openbravo.service.datasource.BaseDataSourceService
-
- org.openbravo.service.datasource.DefaultDataSourceService
-
- All Implemented Interfaces:
DataSourceService
- Direct Known Subclasses:
ADAlertDatasourceService
,DataSourceServiceProviderTest.ExtendedDataSource
,NoteDataSource
,ProductCharacteristicsDS
,ReadOnlyDataSourceService
,TreeDatasourceService
public class DefaultDataSourceService extends BaseDataSourceService
The default implementation of theDataSourceService
. Supports data retrieval, update operations as well as creation of the datasource in javascript. Makes extensive use of theDefaultJsonDataService
. Check the javadoc on that class for more information.- Author:
- mtaal
-
-
Constructor Summary
Constructors Constructor Description DefaultDataSourceService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
add(Map<String,String> parameters, String content)
Execute an insert action.protected String
add(Map<String,String> parameters, String content, boolean shouldFilterOnRedeableOrganizations)
protected void
addFetchParameters(Map<String,String> parameters)
Adds some extra parameters that will be used to fetch data.String
fetch(Map<String,String> parameters)
Execute a query request and return the result as a json string.protected String
fetch(Map<String,String> parameters, boolean shouldFilterOnRedeableOrganizations)
void
fetch(Map<String,String> parameters, DefaultJsonDataService.QueryResultWriter writer)
List<DataSourceProperty>
getDataSourceProperties(Map<String,Object> parameters)
Create the properties used in the template.protected List<DataSourceProperty>
getInitialProperties(Entity entity, boolean minimalProperties)
String
remove(Map<String,String> parameters)
Execute a delete action.protected String
remove(Map<String,String> parameters, boolean shouldFilterOnRedeableOrganizations)
String
update(Map<String,String> parameters, String content)
Execute an update action.-
Methods inherited from class org.openbravo.service.datasource.BaseDataSourceService
checkEditDatasourceAccess, checkFetchDatasourceAccess, getDataSource, getDataUrl, getEntity, getName, getTemplate, getWhereAndFilterClause, getWhereClause, handleExceptionUnsecuredDSAccess, setDataSource, setDataUrl, setEntity, setName, setWhereClause
-
-
-
-
Method Detail
-
fetch
public String fetch(Map<String,String> parameters)
Description copied from interface:DataSourceService
Execute a query request and return the result as a json string.- Parameters:
parameters
- the parameters often coming from the HTTP request- Returns:
- the json result string
-
fetch
protected String fetch(Map<String,String> parameters, boolean shouldFilterOnRedeableOrganizations)
-
fetch
public void fetch(Map<String,String> parameters, DefaultJsonDataService.QueryResultWriter writer)
-
addFetchParameters
protected void addFetchParameters(Map<String,String> parameters)
Adds some extra parameters that will be used to fetch data.
-
remove
public String remove(Map<String,String> parameters)
Description copied from interface:DataSourceService
Execute a delete action. The id of the deleted record is present in the parameters.- Parameters:
parameters
- the parameters often coming from the HTTP request- Returns:
- the result message as a json string
-
remove
protected String remove(Map<String,String> parameters, boolean shouldFilterOnRedeableOrganizations)
-
add
public String add(Map<String,String> parameters, String content)
Description copied from interface:DataSourceService
Execute an insert action.- Parameters:
parameters
- the parameters often coming from the HTTP requestcontent
- , the request content, is assumed to be a json string- Returns:
- the result message as a json string
-
add
protected String add(Map<String,String> parameters, String content, boolean shouldFilterOnRedeableOrganizations)
-
update
public String update(Map<String,String> parameters, String content)
Description copied from interface:DataSourceService
Execute an update action.- Parameters:
parameters
- the parameters often coming from the HTTP requestcontent
- , the request content, is assumed to be a json string- Returns:
- the result message as a json string
-
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
- Overrides:
getDataSourceProperties
in classBaseDataSourceService
- Parameters:
parameters
- parameters used for this request- Returns:
- the list of DataSourceProperty instances to use in the template
-
getInitialProperties
protected List<DataSourceProperty> getInitialProperties(Entity entity, boolean minimalProperties)
-
-