Package net.sf.basedb.core.data
Interface ExtendableData
-
- All Superinterfaces:
IdentifiableData
- All Known Implementing Classes:
BaseFileImporter.RawDataProxy
,BaseFileImporter.ReporterProxy
,RawData
,RawDataBatcher.ReporterProxy
,ReporterData
,UserData
public interface ExtendableData extends IdentifiableData
This class is inherited by data classes that supports per-server additions of columns to the underlying database table.The added columns must be described in the
extended-properties.xml
configuration file. The format of the XML file is forced by a DTD. In summary:<?xml version="1.0" ?> <!DOCTYPE extended-properties SYSTEM "extended-properties.dtd" > <extended-properties> <class name="ReporterData"> <property name="extra1" title="Extra property" column="extra1" type="string" length="255" null="true" update="true" insert="true" averagemethod="geometric_mean" description="An extra property for all reporters" /> </class> </extended-properties>
The
name
attribute of the<class>
tag is the name of the data class that the extra property should be added to. That class must of course implement this interface. The<class>
tag may contain one or more<property>
tags. Here is a short description of the attributes for the<property>
tag.Extended attributes Attribute Description name (required) The property name of the extended property. See ExtendedProperty.getName()
. The name must only contain letters, numbers and underscores but the first character can't be a number. The name must be unique within the class.title The display title for the extended property. See ExtendedProperty.getTitle()
.description A short description of the extended property. See ExtendedProperty.getDescription()
.column (required) The database column name of the extended property. This value must be unique for each class. The value is validated by the DbEngine.isValidColumnName(String)
which normally means it must follow the same rules as thename
attribute. SeeExtendedProperty.getColumn()
.type (required) The type of the column. Allowed values are: - int
- long
- float
- double
- boolean
- string
- date
ExtendedProperty.getType()
.length The maximum allowed length of the value if it is a string property. See ExtendedProperty.getLength()
. The default value is 255.null If the column supports null values or not. Allowed values are: - true (default)
- false
ExtendedProperty.isNullable()
.insert If the value for this property should be inserted into the database or not. - true (default)
- false
ExtendedProperty.isInsertable()
.update If the value for this property should be updated in the database or not. - true (default)
- false
ExtendedProperty.isUpdateable()
.averagable This attribute has been deprecated and is replaced by averagemethod
!
If it makes sense to take the average of multiple values for this property. By default all numerical columns are averagable. For non-numerical columns, this attribute is ignored. The default method is to calculate the arithmetic mean.- true
- false
ExtendedProperty.isAveragable()
.averagemethod The method to use when calculating the average of a set of values. This attribute replaces the averagable
attribute. The following values can be used:- none: do not use this property when calculating averages
- arithmetic_mean: calculate the arithmetic mean
- geometric_mean: calculate the geometric mean
- min: use the minimum value among the values in the set
- max: use the maximum value among the values in the set
ExtendedProperty.getAverageMethod()
.Reference implementation
private Map<String, Object> extendedProperties; public Object getExtended(String name) { return extendedProperties == null ? null : extendedProperties.get(name); } public void setExtended(String name, Object value) { if (extendedProperties == null) extendedProperties = new HashMap<String, Object>(); extendedProperties.put(name, value); }
- Version:
- 2.0
- Author:
- Nicklas, Samuel
- See Also:
ExtendedProperties
,ExtendedProperty
, Developer documentation: Basic classes and interfaces
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object
getExtended(String name)
Get the value of an extended property.void
setExtended(String name, Object value)
Set the value of an extended property.-
Methods inherited from interface net.sf.basedb.core.data.IdentifiableData
getId, getVersion
-
-