Interface LogAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
LogBatchAdminSession
This session creates, updates, and deletes Logs . 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
Log , a LogForm is requested using getLogFormForCreate()
specifying the desired record Types or none if no record
Types are needed. The returned LogForm 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 LogForm is submiited to
a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each LogForm
corresponds to an attempted transaction.
For updates, LogForms are requested to the Log
Id that is to be updated using getLogFormForUpdate() . Similarly,
the LogForm has metadata about the data that can be updated and it
can perform validation before submitting the update. The LogForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Logs .
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds anIdto aLogfor the purpose of creating compatibility.booleanTests if this user can createLogs.booleancanCreateLogWithRecordTypes(Type[] logRecordTypes) Tests if this user can create a singleLogusing the desired record types.booleanTests if this user can deleteLogs.booleanTests if this user can manageIdaliases forLogs.booleanTests if this user can updateLogs.Creates a newLog.voidDeletes aLog.getLogFormForCreate(Type[] logRecordTypes) Gets the log form for creating new logs.getLogFormForUpdate(Id logId) Gets the log form for updating an existing log.voidUpdates an existing log.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
-
canCreateLogs
boolean canCreateLogs()Tests if this user can createLogs. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aLogwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifLogcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateLogWithRecordTypes
Tests if this user can create a singleLogusing the desired record types. WhileLoggingManager.getLogRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificLog. Providing an empty array tests if aLogcan be created with no records.- Parameters:
logRecordTypes- array of log record types- Returns:
trueifLogcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-logRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getLogFormForCreate
LogForm getLogFormForCreate(Type[] logRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the log form for creating new logs. A new form should be requested for each create transaction.- Parameters:
logRecordTypes- array of log record types- Returns:
- the log form
- Throws:
NullArgumentException-logRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form with requested record types- Compliance:
mandatory- This method must be implemented.
-
createLog
Creates a newLog.- Parameters:
logForm- the form for thisLog- Returns:
- the new
Log - Throws:
IllegalStateException-logFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-logFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-logFormdid not originate fromgetLogFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateLogs
boolean canUpdateLogs()Tests if this user can updateLogs. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aLogwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifLogmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getLogFormForUpdate
LogForm getLogFormForUpdate(Id logId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the log form for updating an existing log. A new log form should be requested for each update transaction.- Parameters:
logId- theIdof theLog- Returns:
- the log form
- Throws:
NotFoundException-logIdis not foundNullArgumentException-logIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateLog
Updates an existing log.- Parameters:
logForm- the form containing the elements to be updated- Throws:
IllegalStateException-logFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-logIdorlogFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-logFormdid not originate fromgetLogFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteLogs
boolean canDeleteLogs()Tests if this user can deleteLogs. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aLogwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifLogdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteLog
void deleteLog(Id logId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aLog.- Parameters:
logId- theIdof theLogto remove- Throws:
NotFoundException-logIdnot foundNullArgumentException-logIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageLogAliases
boolean canManageLogAliases()Tests if this user can manageIdaliases forLogs. 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:
falseifLogaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasLog
void aliasLog(Id logId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aLogfor the purpose of creating compatibility. The primaryIdof theLogis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another log, it is reassigned to the given logId.- Parameters:
logId- theIdof aLogaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-logIdnot foundNullArgumentException-logIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-