public class DataSourceFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_SEPARATOR
Key separator.
|
static java.lang.String |
TYPE_GROUPING
Constant for type="grouping".
|
static java.lang.String |
TYPE_NONE
Constant for type="none" (stock data source).
|
Constructor and Description |
---|
DataSourceFactory() |
Modifier and Type | Method and Description |
---|---|
static DataSource |
addIfAbsent(java.lang.String viewName,
java.lang.String dataSourceId,
DataSource dataSource)
Adds data source instance to the cache using viewName:dataSourceId as a key.
|
static DataSource |
addOrReplace(java.lang.String viewName,
java.lang.String dataSourceId,
DataSource dataSource)
Adds data source instance to the cache using viewName:dataSourceId as a key.
|
static DataSource |
addOrReplace(java.lang.String viewName,
java.lang.String dataSourceId,
DataSource dataSource,
boolean loadAndAttachDefinition)
Adds data source instance to the cache using viewName:dataSourceId as a key.
|
static java.lang.String |
cacheToString()
Prints the cache state to string.
|
static void |
clearCache()
Clears the cache.
|
static DataSource |
createDataSource()
Creates new empty data source instance.
|
static DataSource |
createDataSource(java.lang.String type)
Creates new empty data source instance for specified type.
|
static DataSource |
createDataSourceForFields(java.lang.String[] tableNames,
java.lang.String[] fieldNames) |
static DataSource |
createDataSourceForFields(java.lang.String[] tableNames,
java.lang.String[] fieldNames,
boolean isDistinct) |
static DataSource |
createDataSourceForFields(java.lang.String mainTableName,
java.lang.String[] fieldNames)
Creates data source instance for specified table name and field names.
|
static DataSource |
createDataSourceForFields(java.lang.String mainTableName,
java.lang.String[] fieldNames,
boolean isDistinct) |
static DataSource |
createDataSourceForTable(java.lang.String tableName)
Creates a data source for all fields in a specified table.
|
static int |
getSize()
Returns the number of objects in the cache.
|
static com.archibus.model.view.datasource.AbstractDataSourceDef |
loadDataSourceDef(java.lang.String viewName,
java.lang.String dataSourceId)
Loads a data source definition from a view file.
|
static DataSource |
loadDataSourceFromCache(java.lang.Object context,
java.lang.String viewName,
int groupIndex,
java.lang.String dataSourceId)
Creates data source instance for specified view, group index, and optional data source ID.
|
static DataSource |
loadDataSourceFromFile(java.lang.String viewName,
java.lang.String dataSourceId)
Creates data source instance for specified view name and data source ID.
|
static java.lang.Object |
remove(java.lang.String viewName,
java.lang.String dataSourceId)
Removes object from the cache if it exists.
|
public static final java.lang.String TYPE_NONE
public static final java.lang.String TYPE_GROUPING
public static final java.lang.String KEY_SEPARATOR
public static DataSource createDataSource()
public static DataSource createDataSource(java.lang.String type)
public static DataSource createDataSourceForTable(java.lang.String tableName)
tableName
- public static DataSource createDataSourceForFields(java.lang.String mainTableName, java.lang.String[] fieldNames) throws com.archibus.utility.ExceptionBase
mainTableName
- fieldNames
- com.archibus.utility.ExceptionBase
public static DataSource createDataSourceForFields(java.lang.String mainTableName, java.lang.String[] fieldNames, boolean isDistinct) throws com.archibus.utility.ExceptionBase
com.archibus.utility.ExceptionBase
public static DataSource createDataSourceForFields(java.lang.String[] tableNames, java.lang.String[] fieldNames) throws com.archibus.utility.ExceptionBase
com.archibus.utility.ExceptionBase
public static DataSource createDataSourceForFields(java.lang.String[] tableNames, java.lang.String[] fieldNames, boolean isDistinct) throws com.archibus.utility.ExceptionBase
com.archibus.utility.ExceptionBase
public static DataSource loadDataSourceFromFile(java.lang.String viewName, java.lang.String dataSourceId) throws com.archibus.utility.ExceptionBase
Creates data source instance for specified view name and data source ID.
Finds cached data source definition and creates a copy of it, so that cached definitions are never accessed directly and thus cannot be changed from the calling code.
If the data source is not found in the cache, loads the view object containing the data source, then adds loaded data source to the cache.
viewName
- View file name without extension, i.e. 'ab-ex-wr-grid'.dataSourceId
- Data source ID attribute as defined in the view, i.e. 'wr-ds'.com.archibus.utility.ExceptionBase
public static DataSource loadDataSourceFromCache(java.lang.Object context, java.lang.String viewName, int groupIndex, java.lang.String dataSourceId) throws com.archibus.utility.ExceptionBase
This method is for backward compatibility with Web Central 17.1 and is not recommended to use in new code.
context
- Web Central context object, such as UserSessionImpl.viewName
- View file name without extension, i.e. 'ab-ex-wr-grid'.groupIndex
- 0-based index of the afmTableGroup in the view.dataSourceId
- Data source ID attribute as defined in the view, i.e. 'wr-ds'.com.archibus.utility.ExceptionBase
public static DataSource addIfAbsent(java.lang.String viewName, java.lang.String dataSourceId, DataSource dataSource)
viewName
- View file name without extension, i.e. 'ab-ex-wr-grid'.dataSourceId
- Data source ID attribute as defined in the view, i.e. 'wr-ds'.dataSource
- DataSource instance to be cached.public static DataSource addOrReplace(java.lang.String viewName, java.lang.String dataSourceId, DataSource dataSource)
viewName
- View file name without extension, i.e. 'ab-ex-wr-grid'.dataSourceId
- Data source ID attribute as defined in the view, i.e. 'wr-ds'.dataSource
- DataSource instance to be cached.public static DataSource addOrReplace(java.lang.String viewName, java.lang.String dataSourceId, DataSource dataSource, boolean loadAndAttachDefinition)
viewName
- View file name without extension, i.e. 'ab-ex-wr-grid'.dataSourceId
- Data source ID attribute as defined in the view, i.e. 'wr-ds'.dataSource
- DataSource instance to be cached.loadAndAttachDefinition
- If true, loads the data source definition from file and
attaches it to the data source.public static java.lang.Object remove(java.lang.String viewName, java.lang.String dataSourceId)
objectKey
- public static com.archibus.model.view.datasource.AbstractDataSourceDef loadDataSourceDef(java.lang.String viewName, java.lang.String dataSourceId)
viewName
- View file name without extension, i.e. 'ab-ex-wr-grid'.dataSourceId
- Data source ID attribute as defined in the view, i.e. 'wr-ds'.public static void clearCache()
public static int getSize()
public static java.lang.String cacheToString()