Interface DataRecord

    • Method Detail

      • getId

        String getId()
        Returns the data record identifier. This id is unique within the RecordSet from witch this data record has been get. This id is null when it has been built from a RecordTemplate but not yet inserted into a RecordSet.
      • setId

        void setId​(String externalId)
        Gives an id to the data record. This id must be set before the record is inserted in a RecordSet.
        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.