Class IdentifiedRecordTemplate
- java.lang.Object
-
- org.silverpeas.core.contribution.content.form.record.IdentifiedRecordTemplate
-
- All Implemented Interfaces:
Serializable
,RecordTemplate
public class IdentifiedRecordTemplate extends Object implements RecordTemplate, Serializable
AIdentifiedRecordTemplate
decorates aRecordTemplate
with a database identifier and an external identifier.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IdentifiedRecordTemplate(RecordTemplate wrappedTemplate)
A IdentifiedRecordTemplate is built upon a wrapped template.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkDataRecord(DataRecord record)
Checks the specifiedDataRecord
instance matches this template.DataRecord
getEmptyRecord()
Gets an empty DataRecord built on this template.String
getExternalId()
Gets the external template id.int
getFieldIndex(String fieldName)
Gets the index in this template of of the named field.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.String
getInstanceId()
int
getInternalId()
Gets the internal identifier.String
getTemplateName()
RecordTemplate
getWrappedTemplate()
Gets the wrapped template.boolean
isEncrypted()
void
setEncrypted(boolean encrypted)
void
setExternalId(String externalId)
Gives an external id to the template.void
setInternalId(int id)
Sets the internal identifier to this template.void
setTemplateName(String templateName)
-
-
-
Constructor Detail
-
IdentifiedRecordTemplate
public IdentifiedRecordTemplate(RecordTemplate wrappedTemplate)
A IdentifiedRecordTemplate is built upon a wrapped template.- Parameters:
wrappedTemplate
- anotherRecordTemplate
instance.
-
-
Method Detail
-
getWrappedTemplate
public RecordTemplate getWrappedTemplate()
Gets the wrapped template.- Returns:
- the wrapped
RecordTemplate
instance.
-
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() throws FormException
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. - Throws:
FormException
- is an error occurs while getting the template of the fields.
-
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.
-
getExternalId
public String getExternalId()
Gets the external template id.- Returns:
- the external identifier set.
-
setExternalId
public void setExternalId(String externalId)
Gives an external id to the template.- Parameters:
externalId
- an identifier.
-
getInternalId
public int getInternalId()
Gets the internal identifier. It is for internal mechanism.- Returns:
- an identifier.
-
setInternalId
public void setInternalId(int id)
Sets the internal identifier to this template. It is for internal mechanism.- Parameters:
id
- an internal identifier.
-
getTemplateName
public String getTemplateName()
-
setTemplateName
public void setTemplateName(String templateName)
-
setEncrypted
public void setEncrypted(boolean encrypted)
-
isEncrypted
public boolean isEncrypted()
-
getInstanceId
public String getInstanceId()
-
-