Class GenericRecordTemplate
- java.lang.Object
-
- org.silverpeas.core.contribution.content.form.record.GenericRecordTemplate
-
- All Implemented Interfaces:
Serializable
,RecordTemplate
public class GenericRecordTemplate extends Object implements RecordTemplate, Serializable
A GenericRecordTemplate is the template for all of theGenericDataRecord
s. It uses a map in which each field name is mapped to an indexed field template.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GenericRecordTemplate()
The default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFieldTemplate(FieldTemplate fieldTemplate)
Adds a new field template at the end of this record template.boolean
checkDataRecord(DataRecord record)
Checks the specifiedDataRecord
instance matches this template.DataRecord
getEmptyRecord()
Gets an empty DataRecord built on this template.int
getFieldIndex(String fieldName)
Gets the index in this template of of the named field.List<FieldTemplate>
getFieldList()
Gets all the templates modelling each of them a field of aDataRecord
.String[]
getFieldNames()
Gets all the field names of theDataRecord
s built on this template.FieldTemplate
getFieldTemplate(String fieldName)
Gets theFieldTemplate
modelling the specified named field.FieldTemplate[]
getFieldTemplates()
Gets all the fields defined by this template.void
setTemplateName(String templateName)
-
-
-
Method Detail
-
getFieldList
public List<FieldTemplate> getFieldList()
Gets all the templates modelling each of them a field of aDataRecord
.- Returns:
- a list of
FieldTemplate
s.
-
addFieldTemplate
public void addFieldTemplate(FieldTemplate fieldTemplate)
Adds a new field template at the end of this record template.- Parameters:
fieldTemplate
- the template of a field.
-
getFieldNames
public String[] getFieldNames()
Description copied from interface:RecordTemplate
Gets all the field names of theDataRecord
s built on this template.- Specified by:
getFieldNames
in interfaceRecordTemplate
- Returns:
- an array with the name of the fields defined by this template.
-
getFieldTemplates
public FieldTemplate[] getFieldTemplates()
Description copied from interface:RecordTemplate
Gets all the fields defined by this template.- Specified by:
getFieldTemplates
in interfaceRecordTemplate
- Returns:
- an array of
FieldTemplate
instances, each of them being a template of aDataRecord
field.
-
getFieldTemplate
public FieldTemplate getFieldTemplate(String fieldName) throws FormException
Description copied from interface:RecordTemplate
Gets theFieldTemplate
modelling the specified named field.- Specified by:
getFieldTemplate
in interfaceRecordTemplate
- Parameters:
fieldName
- the name of a field- Returns:
- a
FieldTemplate
instance or null if there is no such template. - Throws:
FormException
- if the template of the specified named field cannot be got.
-
getFieldIndex
public int getFieldIndex(String fieldName) throws FormException
Description copied from interface:RecordTemplate
Gets the index in this template of of the named field.- Specified by:
getFieldIndex
in interfaceRecordTemplate
- Parameters:
fieldName
- the name of a field.- Returns:
- the index of the named field in this template or -1 if no template of this field can be found.
- Throws:
FormException
- if the template of the specified named field cannot be got.
-
getEmptyRecord
public DataRecord getEmptyRecord() throws FormException
Description copied from interface:RecordTemplate
Gets an empty DataRecord built on this template.- Specified by:
getEmptyRecord
in interfaceRecordTemplate
- Returns:
- an empty
DataRecord
instance. - Throws:
FormException
-
checkDataRecord
public boolean checkDataRecord(DataRecord record)
Description copied from interface:RecordTemplate
Checks the specifiedDataRecord
instance matches this template.- Specified by:
checkDataRecord
in interfaceRecordTemplate
- Parameters:
record
- aDataRecord
object.- Returns:
- true if the data record is built on this template and all the constraints are satisfied.
-
setTemplateName
public void setTemplateName(String templateName)
-
-