Package org.openbravo.service.datasource
Class ModelDataSourceService
- java.lang.Object
-
- org.openbravo.service.datasource.BaseDataSourceService
-
- org.openbravo.service.datasource.ModelDataSourceService
-
- All Implemented Interfaces:
DataSourceService
- Direct Known Subclasses:
SelectorFieldPropertyDataSource
public class ModelDataSourceService extends BaseDataSourceService
A data source which provides the data for a field which refers to properties in the data model.- Author:
- mtaal, iperdomo
-
-
Constructor Summary
Constructors Constructor Description ModelDataSourceService()
-
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.String
fetch(Map<String,String> parameters)
Execute a query request and return the result as a json string.protected Entity
getBaseEntity(Map<String,String> parameters)
Returns an entity based on the table record id.protected List<Property>
getEntityProperties(Entity entity)
Returns the list of properties sorted alphabetically and with a extra _identifier propertyString
remove(Map<String,String> parameters)
Execute a delete action.String
update(Map<String,String> parameters, String content)
Execute an update action.-
Methods inherited from class org.openbravo.service.datasource.BaseDataSourceService
checkEditDatasourceAccess, checkFetchDatasourceAccess, getDataSource, getDataSourceProperties, getDataUrl, getEntity, getName, getTemplate, getWhereAndFilterClause, getWhereClause, handleExceptionUnsecuredDSAccess, setDataSource, setDataUrl, setEntity, setName, setWhereClause
-
-
-
-
Method Detail
-
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
-
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
-
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
-
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
-
getBaseEntity
protected Entity getBaseEntity(Map<String,String> parameters)
Returns an entity based on the table record id. Returns null if the ipadTableId input is not present or no Entity is found for a given table id.- Parameters:
parameters
- Map of the parameters from the request- Returns:
- the Entity or null if not found
-
getEntityProperties
protected List<Property> getEntityProperties(Entity entity)
Returns the list of properties sorted alphabetically and with a extra _identifier property- Parameters:
entity
- the parent Entity from which the Property will be extracted- Returns:
- a list of properties plus an extra _identifier property
-
-