Interface TextAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
TextBatchAdminSession
This session creates, updates, and deletes Texts . The data for
create and update is provided by the consumer via the form object.
OsidForms are requested for each create or update and may not be reused.
Create and update operations differ in their usage. To create a
Text , a TextForm is requested using
getTextFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned TextForm
will indicate that it is to be used with a create operation and can be
used to examine metdata or validate data prior to creation. Once the
TextForm is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each TextForm corresponds to an attempted transidiom.
For updates, TextForms are requested to the Text
Id that is to be updated using getTextFormForUpdate() .
Similarly, the TextForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
TextForm can only be used once for a successful update and cannot
be reused.
The delete operations delete Texts . To unmap a Text
from the current Press , the TextPressAssignmentSession
should be used. These delete operations attempt to remove the Text
itself thus removing it from all known Press catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds anIdto aTextfor the purpose of creating compatibility.booleanTests if this user can createTexts.booleancanCreateTextWithRecordTypes(Type[] textRecordTypes) Tests if this user can create a singleTextusing the desired record types.booleanTests if this user can deleteTexts.booleanTests if this user can manageIdaliases forTexts.booleanTests if this user can updateTexts.createText(TextForm textForm) Creates a newText.voiddeleteText(Id textId) Deletes aText.getPress()Gets thePressassociated with this session.Gets thePressIdassociated with this session.getTextFormForCreate(Type[] textRecordTypes) Gets the text form for creating new texts.getTextFormForUpdate(Id textId) Gets the text form for updating an existing text.voidupdateText(TextForm textForm) Updates an existing text.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getPressId
Id getPressId()Gets thePressIdassociated with this session.- Returns:
- the
Press Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getPress
Gets thePressassociated with this session.- Returns:
- the press
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateTexts
boolean canCreateTexts()Tests if this user can createTexts. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aTextwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifTextcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateTextWithRecordTypes
Tests if this user can create a singleTextusing the desired record types. WhileLexiconManager.getTextRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificText. Providing an empty array tests if aTextcan be created with no records.- Parameters:
textRecordTypes- array of text record types- Returns:
trueifTextcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-textRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getTextFormForCreate
TextForm getTextFormForCreate(Type[] textRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the text form for creating new texts. A new form should be requested for each create transidiom.- Parameters:
textRecordTypes- array of text record types- Returns:
- the text form
- Throws:
NullArgumentException-textRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createText
Creates a newText.- Parameters:
textForm- the form for thisText- Returns:
- the new
Text - Throws:
IllegalStateException-textFormalready used in a create transidiomInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-textFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-textFormdid not originate fromgetTextFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateTexts
boolean canUpdateTexts()Tests if this user can updateTexts. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aTextwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifTextmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getTextFormForUpdate
TextForm getTextFormForUpdate(Id textId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the text form for updating an existing text. A new text form should be requested for each update transidiom.- Parameters:
textId- theIdof theText- Returns:
- the text form
- Throws:
NotFoundException-textIdis not foundNullArgumentException-textIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateText
Updates an existing text.- Parameters:
textForm- the form containing the elements to be updated- Throws:
IllegalStateException-textFormalready used in an update transatcionInvalidArgumentException- the form contains an invalid valueNullArgumentException-textFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-textFormdid not originate fromgetTextFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteTexts
boolean canDeleteTexts()Tests if this user can deleteTexts. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aTextwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifTextdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteText
void deleteText(Id textId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aText.- Parameters:
textId- theIdof theTextto remove- Throws:
NotFoundException-textIdnot foundNullArgumentException-textIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageTextAliases
boolean canManageTextAliases()Tests if this user can manageIdaliases forTexts. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifTextaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasText
void aliasText(Id textId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aTextfor the purpose of creating compatibility. The primaryIdof theTextis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another text, it is reassigned to the given textId.- Parameters:
textId- theIdof aTextaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-textIdnot foundNullArgumentException-textIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-