Interface SettingAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
SettingBatchAdminSession
This session creates, updates, and deletes Settings . 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
Setting , a SettingForm is requested using
getSettingFormForCreate() specifying the desired controller and record
Types or none if no record Types are needed. The returned
SettingForm 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 SettingForm is submiited to a create operation,
it cannot be reused with another create operation unless the first
operation was unsuccessful. Each SettingForm corresponds to an
attempted transaction.
For updates, SettingForms are requested to the Setting
Id that is to be updated using getSettingFormForUpdate() .
Similarly, the SettingForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
SettingForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Settings . To unmap a
Setting from the current System , the
SettingSystemAssignmentSession should be used. These delete operations
attempt to remove the Setting itself thus removing it from all
known System catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasSetting(Id settingId, Id aliasId) Adds anIdto aSettingfor the purpose of creating compatibility.booleanTests if this user can create settings.booleancanCreateSettingWithRecordTypes(Type[] settingRecordTypes) Tests if this user can create a singleSettingusing the desired record types.booleanTests if this user can delete settings.booleanTests if this user can manageIdaliases forSettings.booleanTests if this user can update settings.createSetting(SettingForm settingForm) Creates a newSetting.voiddeleteSetting(Id settingId) Deletes aSetting.getSettingFormForCreate(Id controllerId, Type[] settingRecordTypes) Gets the setting form for creating new settings.getSettingFormForUpdate(Id settingId) Gets the setting form for updating an existing setting.Gets theSystemassociated with this session.Gets theSystemIdassociated with this session.voidupdateSetting(SettingForm settingForm) Updates an existing setting.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
-
getSystemId
Id getSystemId()Gets theSystemIdassociated with this session.- Returns:
- the
System Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getSystem
Gets theSystemassociated with this session.- Returns:
- the system
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateSettings
boolean canCreateSettings()Tests if this user can create settings. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aSettingwill 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:
falseifSettingcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateSettingWithRecordTypes
Tests if this user can create a singleSettingusing the desired record types. WhileControlManager.getSettingRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificSetting. Providing an empty array tests if aSettingcan be created with no records.- Parameters:
settingRecordTypes- array of setting record types- Returns:
trueifSettingcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-settingRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getSettingFormForCreate
SettingForm getSettingFormForCreate(Id controllerId, Type[] settingRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the setting form for creating new settings. A new form should be requested for each create transaction.- Parameters:
controllerId- theIdfor the controllersettingRecordTypes- array of setting record types- Returns:
- the setting form
- Throws:
NotFoundException-controllerIdis not foundNullArgumentException-controllerIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createSetting
Setting createSetting(SettingForm settingForm) throws NotFoundException, OperationFailedException, PermissionDeniedException Creates a newSetting.- Parameters:
settingForm- the form for thisSetting- Returns:
- the new
Setting - Throws:
IllegalStateException-settingFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNotFoundException-resourceIdorinputIdis not foundNullArgumentException-settingFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-settingFormdid not originate fromgetSettingFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateSettings
boolean canUpdateSettings()Tests if this user can update settings. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aSettingwill 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:
falseifSettingmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getSettingFormForUpdate
SettingForm getSettingFormForUpdate(Id settingId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the setting form for updating an existing setting. A new setting form should be requested for each update transaction.- Parameters:
settingId- theIdof theSetting- Returns:
- the setting form
- Throws:
NotFoundException-settingIdis not foundNullArgumentException-settingIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateSetting
void updateSetting(SettingForm settingForm) throws OperationFailedException, PermissionDeniedException Updates an existing setting.- Parameters:
settingForm- the form containing the elements to be updated- Throws:
IllegalStateException-settingFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-settingFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-settingFormdid not originate fromgetSettingFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteSettings
boolean canDeleteSettings()Tests if this user can delete settings. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aSettingwill 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:
falseifSettingdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteSetting
void deleteSetting(Id settingId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aSetting.- Parameters:
settingId- theIdof theSettingto remove- Throws:
NotFoundException-settingIdnot foundNullArgumentException-settingIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageSettingAliases
boolean canManageSettingAliases()Tests if this user can manageIdaliases forSettings. 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:
falseifSettingaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasSetting
void aliasSetting(Id settingId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aSettingfor the purpose of creating compatibility. The primaryIdof theSettingis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another setting, it is reassigned to the given settingId.- Parameters:
settingId- theIdof aSettingaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-settingIdnot foundNullArgumentException-settingIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-