Class JdbcField
- java.lang.Object
-
- org.silverpeas.core.contribution.content.form.AbstractField
-
- org.silverpeas.core.contribution.content.form.field.TextField
-
- org.silverpeas.core.contribution.content.form.field.JdbcField
-
- All Implemented Interfaces:
Serializable
,Comparable<Field>
,Field
public class JdbcField extends TextField
A JdbcField stores a value of database field.- See Also:
Field
,FieldDisplayer
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
TYPE
The jdbc field type name.-
Fields inherited from class org.silverpeas.core.contribution.content.form.field.TextField
CONTENT_TYPE, CONTENT_TYPE_FLOAT, CONTENT_TYPE_INT, PARAM_MAXLENGTH
-
Fields inherited from interface org.silverpeas.core.contribution.content.form.Field
FILE_PARAM_NAME_SUFFIX, TYPE_FILE
-
-
Constructor Summary
Constructors Constructor Description JdbcField()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connection
connect(String dataSourceName, String login, String password)
Connects to the specified data source by using the specified credentials.boolean
equals(Object o)
Tests equality between this field and the specified field.String
getStringValue()
Returns the string value of this field.String
getTypeName()
Returns the type name.int
hashCode()
boolean
isReadOnly()
Returns true if the value is read only.Collection<String>
selectSql(Connection connection, String query, String currentUserId)
void
setStringValue(String value)
Set the string value of this field.-
Methods inherited from class org.silverpeas.core.contribution.content.form.field.TextField
acceptObjectValue, acceptStringValue, acceptValue, acceptValue, compareTo, getObjectValue, getValue, getValue, isNull, setNull, setObjectValue, setValue, setValue
-
Methods inherited from class org.silverpeas.core.contribution.content.form.AbstractField
getName, getOccurrence, setName, setOccurrence
-
-
-
-
Field Detail
-
TYPE
public static final String TYPE
The jdbc field type name.- See Also:
- Constant Field Values
-
-
Method Detail
-
getTypeName
public String getTypeName()
Returns the type name.- Specified by:
getTypeName
in interfaceField
- Overrides:
getTypeName
in classTextField
- Returns:
- the name of this field type.
-
getStringValue
public String getStringValue()
Returns the string value of this field.- Returns:
- the
String
representation of the value of this field.
-
setStringValue
public void setStringValue(String value)
Set the string value of this field.- Parameters:
value
- theString
value to set
-
isReadOnly
public boolean isReadOnly()
Returns true if the value is read only.- Specified by:
isReadOnly
in classTextField
-
connect
public Connection connect(String dataSourceName, String login, String password) throws FormException
Connects to the specified data source by using the specified credentials. If no credentials are provided, then the authentication is performed by using the credentials set with the data source configuration in the JEE application server.- Parameters:
dataSourceName
- the JNDI name of the data source from which it can be retrieved.login
- the login of the user to access the data source. Can be empty or null if no explicit authentication is required.password
- the password of the user to access the data source. Can be empty or null if no password was set or if no explicit authentication is required.- Returns:
- a connection to the specified data source.
- Throws:
FormException
- if an error occurs while either looking up the data source or opening a connection with the specified data source.
-
selectSql
public Collection<String> selectSql(Connection connection, String query, String currentUserId) throws FormException
- Throws:
FormException
-
equals
public boolean equals(Object o)
Description copied from class:TextField
Tests equality between this field and the specified field.
-
-