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 of
IPluginEntitiesConnectionRetVal
you may use in a plugin.- Author:
- XIMA MEDIA GmbH
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPluginEntitiesConnectionRetVal
(boolean useSystemDatabase, EDatenbankTyp databaseType, DataSource dataSource, Map<String, Object> additionalProperties) -
Method Summary
Modifier and TypeMethodDescriptionforSystemDbWithAdditionalProperties
(Map<String, Object> additionalProperties) Creates a new connection details object for a connection to the formcycle database.This method lets you pass additional properties to the persistence provider (which is currently Hibernate).Different database management systems behave slightly differently, so we need to know about which type of database we are connecting to.This method returns a custom data source for connecting to the database where you would like to save the plugin entities.boolean
You may want to save you entities in the same database that is used by formcycle.
-
Constructor Details
-
PluginEntitiesConnectionRetVal
public PluginEntitiesConnectionRetVal(boolean useSystemDatabase, EDatenbankTyp databaseType, DataSource dataSource, Map<String, Object> additionalProperties)
-
-
Method Details
-
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
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
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.
-