Package org.openbravo.service.dataset
Class DataSetService
- java.lang.Object
-
- org.openbravo.service.dataset.DataSetService
-
- All Implemented Interfaces:
OBProvidable
,OBSingleton
public class DataSetService extends Object implements OBSingleton
Offers services around datasets. The main function is to retrieve DataSets and to determine which Properties of an Entity can be exported and which objects can be exported.- Author:
- Martin Taal
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DataSetService.BaseOBIDHexComparator
static class
DataSetService.BaseStringComparator
-
Constructor Summary
Constructors Constructor Description DataSetService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DataSet
getDataSetByValue(String value)
Finds a dataset solely on the basis of its valueDataSet
getDataSetByValueModule(String value, String moduleId)
Retrieves a dataset using the value and module of the datasetList<DataSetColumn>
getDataSetColumns(DataSetTable dataSetTable)
Deprecated.use dataSetTable.getDataSetColumnList()List<DataSet>
getDataSetsByModuleID(String moduleId)
Finds datasets belonging to the Module with a specific moduleId.List<DataSetTable>
getDataSetTables(DataSet dataSet)
Deprecated.use dataSet.getDataSetTableList()List<Property>
getEntityProperties(BaseOBObject bob, DataSetTable dataSetTable, List<DataSetColumn> dataSetColumns)
This method will return the properties as defined by the DataSetcolumns definition.List<BaseOBObject>
getExportableObjects(DataSetTable dataSetTable, String moduleId)
Determines which objects are exportable using the DataSetTable whereClause.List<BaseOBObject>
getExportableObjects(DataSetTable dataSetTable, String moduleId, Map<String,Object> parameters)
Determines which objects are exportable using the DataSetTable whereClause.Iterator<BaseOBObject>
getExportableObjectsIterator(DataSetTable dataSetTable, String moduleId, Map<String,Object> parameters)
Determines which objects are exportable using the DataSetTable whereClause.List<Property>
getExportableProperties(BaseOBObject bob, DataSetTable dataSetTable, List<DataSetColumn> dataSetColumns)
This method will return the properties as defined by the DataSetcolumns definition.List<Property>
getExportableProperties(BaseOBObject bob, DataSetTable dataSetTable, List<DataSetColumn> dataSetColumns, boolean exportTransients)
This method will return the properties which are exportable as defined by the DataSetcolumns definition.static DataSetService
getInstance()
<T extends BaseOBObject>
booleanhasChanged(DataSet dataSet, Date afterDate)
Checks if objects of aDataSetTable
of theDataSet
have changed since a specific date.boolean
hasData(DataSet dataSet)
Returns true if theDataSet
has data.void
removeAuditInfo(List<Property> properties)
static void
setInstance(DataSetService instance)
-
-
-
Method Detail
-
getInstance
public static DataSetService getInstance()
-
setInstance
public static void setInstance(DataSetService instance)
-
hasData
public boolean hasData(DataSet dataSet)
Returns true if theDataSet
has data. Note that the client/organization of the current user are used for querying- Parameters:
dataSet
- the data set to check for content- Returns:
- true if there are objects in the data set, false other wise
- See Also:
DataSet.getDataSetTableList()
,DataSetTable
-
hasChanged
public <T extends BaseOBObject> boolean hasChanged(DataSet dataSet, Date afterDate)
Checks if objects of aDataSetTable
of theDataSet
have changed since a specific date. Note that this method does not use whereclauses or other filters defined in the dataSetTable. It checks all instances of the table of the DataSetTable.- Parameters:
dataSet
- the DataSetTables of this dataSet are checked.afterDate
- the time limit- Returns:
- true if there is at least one object which has changed since afterDate, false afterwards
-
getDataSetByValueModule
public DataSet getDataSetByValueModule(String value, String moduleId)
Retrieves a dataset using the value and module of the dataset- Parameters:
value
- the value used to find the dataset in the databasemoduleId
- the id of the module used to find the dataset in the database- Returns:
- the found DataSet
-
getDataSetsByModuleID
public List<DataSet> getDataSetsByModuleID(String moduleId)
Finds datasets belonging to the Module with a specific moduleId.- Parameters:
moduleId
- the moduleId of the module to use for searching datasets- Returns:
- the list of found datasets
-
getDataSetByValue
public DataSet getDataSetByValue(String value)
Finds a dataset solely on the basis of its value- Parameters:
value
- the value to search for- Returns:
- the found DataSet
-
getDataSetTables
@Deprecated public List<DataSetTable> getDataSetTables(DataSet dataSet)
Deprecated.use dataSet.getDataSetTableList()Returns a list of DataSet tables instances on the basis of the DataSet- Parameters:
dataSet
- the DataSet for which the list of tables is required- Returns:
- the DataSetTables of the DataSet
-
getDataSetColumns
@Deprecated public List<DataSetColumn> getDataSetColumns(DataSetTable dataSetTable)
Deprecated.use dataSetTable.getDataSetColumnList()Return the list of DataSet columns for a table- Parameters:
dataSetTable
- the dataSetTable for which the columns need to be found- Returns:
- the list of DataSetColumns of the dataSetTable
-
getExportableObjects
public List<BaseOBObject> getExportableObjects(DataSetTable dataSetTable, String moduleId)
Determines which objects are exportable using the DataSetTable whereClause.- Parameters:
dataSetTable
- the dataSetTable defines the Entity and the whereClause to usemoduleId
- the moduleId is a parameter in the whereClause- Returns:
- the list of exportable business objects
-
getExportableObjects
public List<BaseOBObject> getExportableObjects(DataSetTable dataSetTable, String moduleId, Map<String,Object> parameters)
Determines which objects are exportable using the DataSetTable whereClause.- Parameters:
dataSetTable
- the dataSetTable defines the Entity and the whereClause to usemoduleId
- the moduleId is a parameter in the whereClauseparameters
- a collection of named parameters which are used in the whereClause of the dataSetTable- Returns:
- the list of exportable business objects
-
getExportableObjectsIterator
public Iterator<BaseOBObject> getExportableObjectsIterator(DataSetTable dataSetTable, String moduleId, Map<String,Object> parameters)
Determines which objects are exportable using the DataSetTable whereClause. Returns an iterator over these objects. The returned objects are sorted by id.- Parameters:
dataSetTable
- the dataSetTable defines the Entity and the whereClause to usemoduleId
- the moduleId is a parameter in the whereClauseparameters
- a collection of named parameters which are used in the whereClause of the dataSetTable- Returns:
- iterator over the exportable objects
-
getEntityProperties
public List<Property> getEntityProperties(BaseOBObject bob, DataSetTable dataSetTable, List<DataSetColumn> dataSetColumns)
This method will return the properties as defined by the DataSetcolumns definition. It will return transient properties but not the audit-info properties if so excluded by the DataSet definition.- Parameters:
bob
- the business object to exportdataSetTable
- the dataSetTable to exportdataSetColumns
- the list of potential columns to export- Returns:
- the list of properties which are exportable
-
getExportableProperties
public List<Property> getExportableProperties(BaseOBObject bob, DataSetTable dataSetTable, List<DataSetColumn> dataSetColumns)
This method will return the properties as defined by the DataSetcolumns definition. It will not return transient properties and neither the audit-info properties if so excluded by the DataSet definition.- Parameters:
bob
- the business object to exportdataSetTable
- the dataSetTable to exportdataSetColumns
- the list of potential columns to export- Returns:
- the list of properties which are exportable
-
getExportableProperties
public List<Property> getExportableProperties(BaseOBObject bob, DataSetTable dataSetTable, List<DataSetColumn> dataSetColumns, boolean exportTransients)
This method will return the properties which are exportable as defined by the DataSetcolumns definition. It will include transient properties depending on the parameter. Audit-info properties are never exported- Parameters:
bob
- the business object to exportdataSetTable
- the dataSetTable to exportdataSetColumns
- the list of potential columns to exportexportTransients
- if true then transient properties are also exportable- Returns:
- the list of properties which are exportable
-
-