Package net.sf.basedb.core.data
Interface ExtendableData
- All Superinterfaces:
IdentifiableData
- All Known Implementing Classes:
BaseFileImporter.RawDataProxy
,BaseFileImporter.ReporterProxy
,RawData
,RawDataBatcher.ReporterProxy
,ReporterData
,UserData
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.
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 the name
attribute. See ExtendedProperty.getColumn() .
|
type (required) |
The type of the column. Allowed values are:
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:
ExtendedProperty.isNullable() .
|
insert |
If the value for this property should be inserted into the database
or not.
ExtendedProperty.isInsertable() .
|
update |
If the value for this property should be updated in the database
or not.
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.
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:
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:
-
Method Summary
Modifier and TypeMethodDescriptiongetExtended
(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
-
Method Details
-
getExtended
Get the value of an extended property.- Parameters:
name
- The name of the property- Returns:
- The value of the property or null if not found
-
setExtended
Set the value of an extended property.- Parameters:
name
- The name of the propertyvalue
- The new value for the property
-