Interface DataRecord
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractProcessInstanceDataRecord
,DummyDataRecord
,DummyFileDataRecord
,GenericDataRecord
,LazyProcessInstanceDataRecord
,ProcessInstanceDataRecord
,ProcessInstanceRowRecord
public interface DataRecord extends Serializable
A DataRecord is the interface used by all the form components to exchange, display and save a set of named and typed fields which are unknown at compile time but defined by a silverpeas end user in a workflow process model or a publication model. A DataRecord is modelled by a RecordTemplate that defined the fields by their name and type. A DataRecord is built, managed and saved by a RecordSet.- See Also:
Field
,RecordSet
,RecordTemplate
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Field
getField(int fieldIndex)
Gets the field at the index position in this data record.Field
getField(String fieldName)
Gets the specified named field.Field
getField(String fieldName, int occurrence)
Gets the nth occurrence of the specified named field.String[]
getFieldNames()
Gets the name of all the fields set in this data record.String
getId()
Returns the data record identifier.String
getLanguage()
Gets the language in which any text valued some of the fields are.ResourceReference
getResourceReference()
Gets the reference to the resource in Silverpeas to which this data record belongs.Map<String,String>
getValues(String language)
Gets a dictionary of all field values, each of them mapped to the name of their corresponding field.boolean
isNew()
Is this data record a new one?void
setId(String externalId)
Gives an id to the data record.void
setLanguage(String language)
Sets the language in which the text fields are valued.int
size()
Gets the size of this data record or -1 whether this operation isn't supported.
-
-
-
Method Detail
-
getId
String getId()
Returns the data record identifier. This id is unique within theRecordSet
from witch this data record has been get. This id is null when it has been built from aRecordTemplate
but not yet inserted into aRecordSet
.
-
setId
void setId(String externalId)
Gives an id to the data record. This id must be set before the record is inserted in aRecordSet
.- Parameters:
externalId
- the identifier to set to this data record.
-
isNew
boolean isNew()
Is this data record a new one?- Returns:
- true if this record has not been inserted in a
RecordSet
. False otherwise.
-
getField
Field getField(String fieldName) throws FormException
Gets the specified named field. If there is several fields with the given name, then only the first one is returned.- Parameters:
fieldName
- the name of a field.- Returns:
- the named field or, in the case there is no such field, either null or an empty field.
- Throws:
FormException
- if the field cannot be got.- API Note:
- the
FormException
can be thrown if the named field cannot be found instead of returning null or an empty field. It depends of the implementation of the concrete class.
-
getField
Field getField(String fieldName, int occurrence)
Gets the nth occurrence of the specified named field.- Parameters:
fieldName
- the name of a field.occurrence
- the nth occurrence of such a field.- Returns:
- the named field or, in the case there is no such field, either null or an empty field.
-
getField
Field getField(int fieldIndex) throws FormException
Gets the field at the index position in this data record.- Parameters:
fieldIndex
- the index of the field in the data record.- Returns:
- the field or, in the case there is no such field, either null or an empty field.
- Throws:
FormException
- when the index is invalid.
-
getFieldNames
String[] getFieldNames()
Gets the name of all the fields set in this data record.- Returns:
- an array with the name of the fields.
-
size
int size()
Gets the size of this data record or -1 whether this operation isn't supported.- Returns:
- the total number of fields making this record, whatever their name. If this method isn't supported, -1 is returned.
-
getLanguage
String getLanguage()
Gets the language in which any text valued some of the fields are.- Returns:
- the ISO-631 code of a supported language.
-
setLanguage
void setLanguage(String language)
Sets the language in which the text fields are valued.- Parameters:
language
- the ISO-631 code of a supported language.
-
getValues
Map<String,String> getValues(String language)
Gets a dictionary of all field values, each of them mapped to the name of their corresponding field.- Parameters:
language
- the language in which are the valued the text fields.- Returns:
- a
Map
of field values mapped to their corresponding field name.
-
getResourceReference
ResourceReference getResourceReference()
Gets the reference to the resource in Silverpeas to which this data record belongs.- Returns:
- a reference to a resource in Silverpeas.
-
-