Class PluginEntitiesConnectionRetVal
- java.lang.Object
-
- de.xima.fc.plugin.models.retval.entities.PluginEntitiesConnectionRetVal
-
- All Implemented Interfaces:
IPluginEntitiesConnectionRetVal
,Serializable
public class PluginEntitiesConnectionRetVal extends Object implements IPluginEntitiesConnectionRetVal
A simple implementation ofIPluginEntitiesConnectionRetVal
you may use in a plugin.- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PluginEntitiesConnectionRetVal(boolean useSystemDatabase, EDatenbankTyp databaseType, DataSource dataSource, Map<String,Object> additionalProperties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IPluginEntitiesConnectionRetVal
forSystemDbWithAdditionalProperties(Map<String,Object> additionalProperties)
Creates a new connection details object for a connection to the FORMCYCLE database.Map<String,Object>
getAdditionalProperties()
This method lets you pass additional properties to the persistence provider (which is currently Hibernate).EDatenbankTyp
getDatabaseType()
Different database management systems behave slightly differently, so we need to know about which type of database we are connecting to.DataSource
getDataSource()
This method returns a custom data source for connecting to the database where you would like to save the plugin entities.boolean
isUseSystemDatabase()
You may want to save you entities in the same database that is used by FORMCYCLE.
-
-
-
Constructor Detail
-
PluginEntitiesConnectionRetVal
public PluginEntitiesConnectionRetVal(boolean useSystemDatabase, EDatenbankTyp databaseType, DataSource dataSource, Map<String,Object> additionalProperties)
-
-
Method Detail
-
getAdditionalProperties
public Map<String,Object> getAdditionalProperties()
Description copied from interface:IPluginEntitiesConnectionRetVal
This method lets you pass additional properties to the persistence provider (which is currently Hibernate). These properties override any settings made by FORMCYCLE. Property keys you can use include, but are not limited to, the options found inEnvironment
.- Specified by:
getAdditionalProperties
in interfaceIPluginEntitiesConnectionRetVal
- Returns:
- Additional properties for use by the persistence provider. If
null
or empty, no additional properties are set.
-
getDatabaseType
public EDatenbankTyp getDatabaseType()
Description copied from interface:IPluginEntitiesConnectionRetVal
Different database management systems behave slightly differently, so we need to know about which type of database we are connecting to. If you do not specify a type explicitly, the system will try to guess the type, but note that this may fail for some types of database management systems.- Specified by:
getDatabaseType
in interfaceIPluginEntitiesConnectionRetVal
- Returns:
- The database type to which we are connecting, or
null
to guess the type.
-
getDataSource
public DataSource getDataSource()
Description copied from interface:IPluginEntitiesConnectionRetVal
This method returns a custom data source for connecting to the database where you would like to save the plugin entities. Ignored ifIPluginEntitiesConnectionRetVal.isUseSystemDatabase()
returnstrue
.This method may create a new data source (which is potentially a costly operation): the system will call this method only once when the plugin is initialized.
- Specified by:
getDataSource
in interfaceIPluginEntitiesConnectionRetVal
- Returns:
- The data source used to connect to the database that will store the plugin entities. If
IPluginEntitiesConnectionRetVal.isUseSystemDatabase()
returnsfalse
, this must not returnnull
, or an exception will be thrown when the plugin is initialized. IfIPluginEntitiesConnectionRetVal.isUseSystemDatabase()
returnstrue
, the returned value is ignored.
-
isUseSystemDatabase
public boolean isUseSystemDatabase()
Description copied from interface:IPluginEntitiesConnectionRetVal
You may want to save you entities in the same database that is used by FORMCYCLE. To do so, have this method returntrue
. If you do, theIPluginEntitiesConnectionRetVal.getDataSource()
will be ignored, but you can still useIPluginEntitiesConnectionRetVal.getAdditionalProperties()
orIPluginEntitiesConnectionRetVal.getDataSource()
to customize the database connection. Also, make sure you use unique names for the tables of your entities that do not conflict with existing FORMCYCLE table names. For example, consider prepending a prefix to all table names.On the other hand, if you return
false
here, you need to specify aIPluginEntitiesConnectionRetVal.getDataSource()
.- Specified by:
isUseSystemDatabase
in interfaceIPluginEntitiesConnectionRetVal
- Returns:
true
to use the FORMCYCLE system database, orfalse
otherwise.
-
forSystemDbWithAdditionalProperties
public static IPluginEntitiesConnectionRetVal forSystemDbWithAdditionalProperties(Map<String,Object> additionalProperties)
Creates a new connection details object for a connection to the FORMCYCLE database. You may also pass additional settings, such asAvailableSettings.HBM2DDL_AUTO
.- Parameters:
additionalProperties
- Additional properties that are passed to the JPA provider.- Returns:
- The connection details for a connection to the system database.
-
-