Interface DeviceAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
DeviceBatchAdminSession
This session creates, updates, and deletes Devices . 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
Device , a DeviceForm is requested using
getDeviceFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
DeviceForm 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 DeviceForm is submiited to a create operation, it cannot
be reused with another create operation unless the first operation was
unsuccessful. Each DeviceForm corresponds to an attempted
transaction.
For updates, DeviceForms are requested to the Device
Id that is to be updated using getDeviceFormForUpdate() .
Similarly, the DeviceForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
DeviceForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Devices . To unmap a
Device from the current System , the
DeviceSystemAssignmentSession should be used. These delete operations
attempt to remove the Device 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 TypeMethodDescriptionvoidaliasDevice(Id deviceId, Id aliasId) Adds anIdto aDevicefor the purpose of creating compatibility.booleanTests if this user can createDevices.booleancanCreateDeviceWithRecordTypes(Type[] deviceRecordTypes) Tests if this user can create a singleDeviceusing the desired record types.booleanTests if this user can deleteDevices.booleanTests if this user can manageIdaliases forDevices.booleanTests if this user can updateDevices.createDevice(DeviceForm deviceForm) Creates a newDevice.voiddeleteDevice(Id deviceId) Deletes aDevice.getDeviceFormForCreate(Type[] deviceRecordTypes) Gets the device form for creating new devices.getDeviceFormForUpdate(Id deviceId) Gets the device form for updating an existing device.Gets theSystemassociated with this session.Gets theSystemIdassociated with this session.voidupdateDevice(DeviceForm deviceForm) Updates an existing device.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.
-
canCreateDevices
boolean canCreateDevices()Tests if this user can createDevices. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aDevicewill 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:
falseifDevicecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateDeviceWithRecordTypes
Tests if this user can create a singleDeviceusing the desired record types. WhileControlManager.getDeviceRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificDevice. Providing an empty array tests if aDevicecan be created with no records.- Parameters:
deviceRecordTypes- array of device record types- Returns:
trueifDevicecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-deviceRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getDeviceFormForCreate
DeviceForm getDeviceFormForCreate(Type[] deviceRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the device form for creating new devices. A new form should be requested for each create transaction.- Parameters:
deviceRecordTypes- array of device record types- Returns:
- the device form
- Throws:
NullArgumentException-deviceRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createDevice
Device createDevice(DeviceForm deviceForm) throws OperationFailedException, PermissionDeniedException Creates a newDevice.- Parameters:
deviceForm- the form for thisDevice- Returns:
- the new
Device - Throws:
IllegalStateException-deviceFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-deviceFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-deviceFormdid not originate fromgetDeviceFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateDevices
boolean canUpdateDevices()Tests if this user can updateDevices. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aDevicewill 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:
falseifDevicemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getDeviceFormForUpdate
DeviceForm getDeviceFormForUpdate(Id deviceId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the device form for updating an existing device. A new device form should be requested for each update transaction.- Parameters:
deviceId- theIdof theDevice- Returns:
- the device form
- Throws:
NotFoundException-deviceIdis not foundNullArgumentException-deviceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateDevice
Updates an existing device.- Parameters:
deviceForm- the form containing the elements to be updated- Throws:
IllegalStateException-deviceFormalready used in an update transatcionInvalidArgumentException- the form contains an invalid valueNullArgumentException-deviceFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-deviceFormdid not originate fromgetDeviceFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteDevices
boolean canDeleteDevices()Tests if this user can deleteDevices. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aDevicewill 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:
falseifDevicedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteDevice
void deleteDevice(Id deviceId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aDevice.- Parameters:
deviceId- theIdof theDeviceto remove- Throws:
NotFoundException-deviceIdnot foundNullArgumentException-deviceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageDeviceAliases
boolean canManageDeviceAliases()Tests if this user can manageIdaliases forDevices. 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:
falseifDevicealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasDevice
void aliasDevice(Id deviceId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aDevicefor the purpose of creating compatibility. The primaryIdof theDeviceis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another device, it is reassigned to the given deviceId.- Parameters:
deviceId- theIdof aDevicealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-deviceIdnot foundNullArgumentException-deviceIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-