public interface OsidForm extends Identifiable, Suppliable
The OsidForm
is the vehicle used to create and update
objects. The form is a container for data to be sent to an update or
create method of a session. Applications should persist their own data
until a form is successfully submitted in an update or create transaction.
The form may provide some feedback as to the validity of certain data updates before the update transaction is issued to the correspodning session but a successful modification of the form is not a guarantee of success for the update transaction. A consumer may elect to perform all updates within a single update transaction or break up a large update intio smaller units. The tradeoff is the granularity of error feedback vs. the performance gain of a single transaction.
OsidForms
are Identifiable.
The
Id
of the OsidForm
is used to uniquely identify the
update or create transaction and not that of the object being updated.
Currently, it is not necessary to have these Ids
persisted.
As with all aspects of the OSIDs, nulls cannot be used. Methods to clear values are also defined in the form.
A new OsidForm
should be acquired for each transaction
upon an OsidObject.
Forms should not be reused from one
object to another even if the supplied data is the same as the forms may
encapsulate data specific to the object requested. Example of changing a
display name and a color defined in a color interface extension:
ObjectForm form = session.getObjectFormForUpdate(objectId); form.setDisplayName("new name"); ColorForm recordForm = form.getFormRecord(colorRecordType); recordForm.setColor("green"); session.updateObject(objectId, form);
Modifier and Type | Method and Description |
---|---|
Locale |
getDefaultLocale()
Gets a default locale for
DisplayTexts when a locale is
not specified. |
Metadata[] |
getInvalidMetadata()
Gets a list of metadata for the elements in this form which are not
valid.
|
Metadata |
getJournalCommentMetadata()
Gets the metadata for the comment corresponding to this form
submission.
|
LocaleList |
getLocales()
Gets a list of locales for available
DisplayText
translations that can be performed using this form. |
DisplayText[] |
getValidationMessages()
Gets text messages corresponding to additional instructions to pass
form validation.
|
boolean |
isForUpdate()
Tests if this form is for an update operation.
|
boolean |
isValid()
Tests if ths form is in a valid state for submission.
|
void |
setJournalComment(java.lang.String comment)
Sets a comment.
|
void |
setLocale(Type languageType,
Type scriptType)
Specifies a language and script type for
DisplayText
fields in this form. |
getId, isCurrent
boolean isForUpdate()
true
if this form is for an update operation,
false
if for a create operationmandatory
- This method must be implemented. Locale getDefaultLocale()
DisplayTexts
when a locale is
not specified.mandatory
- This method must be implemented. LocaleList getLocales()
DisplayText
translations that can be performed using this form.mandatory
- This method must be implemented. void setLocale(Type languageType, Type scriptType)
DisplayText
fields in this form. Setting a locale to something other than the
default locale may affect the Metadata
in this form.
If multiple locales are available for managing translations, the
Metadata
indicates the fields are unset as they may be
returning a defeult value based on the default locale.languageType
- the language typescriptType
- the script typeNullArgumentException
- languageType
or
scriptType
is nullUnsupportedException
- languageType
and
scriptType
not available from
getLocales()
mandatory
- This method must be implemented. Metadata getJournalCommentMetadata()
mandatory
- This method must be implemented. void setJournalComment(java.lang.String comment)
comment
- the new commentInvalidArgumentException
- comment
is
invalidNoAccessException
- Metadata.isReadonly()
is true
NullArgumentException
- comment
is
null
mandatory
- This method must be implemented. boolean isValid() throws OperationFailedException
false
if there is a known error in this form,
true
otherwiseOperationFailedException
- attempt to perform
validation failedmandatory
- This method must be implemented. DisplayText[] getValidationMessages()
mandatory
- This method must be implemented. Metadata[] getInvalidMetadata()
mandatory
- This method must be implemented.