Interface DeviceBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, DeviceAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Devices in bulk. 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
getDeviceFormsForCreate() specifying the desired record Types or
none if no record Types are needed. Each of the returned
DeviceForms 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 a 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.
The DeviceForms returned from
getDeviceFormsForCreate() may be linked to the originating request
through the peer Ids of the DeviceForm . In the case where
there may be duplicates, any DeviceForm of the same peer
Ids may be used for a create operation.
Once a batch of DeviceForm are submitted for create, a
CreateDevice is returned for each DeviceForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createDevices() , errors specific to
an individual DeviceForm are indicated in the corresponding
CreateDevice . CreateDevices may be linked to the originating
DeviceForm through the DeviceForm Id .
For updates, DeviceForms are requested to the Device
Id that is to be updated using getDeviceFormsForUpdate()
where the reference Id in the DeviceForm may be used to
link the request. 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.
Once a batch of DeviceForms are submitted for update, an
UpdateDevice is returned for each DeviceForm , although
the ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateDevices() , errors specific to
an individual DeviceForm are indicated in the corresponding
UpdateDevice . UpdateDevices may be linked to the originating
DeviceForm through the DeviceForm Id .
The delete operations delete Devices in bulk. 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. Bulk delete operations return the results
in DeleteDevices .
-
Method Summary
Modifier and TypeMethodDescriptionaliasDevices(AliasRequestList aliasRequests) Adds anIdto aDevicefor the purpose of creating compatibility.createDevices(DeviceBatchFormList deviceForms) Creates a new set ofDevices.Deletes allDevicesin thisSystem.deleteDevices(IdList deviceIds) Deletes devices for the givenIds.getDeviceFormsForCreate(long n, Type[] deviceRecordTypes) Gets the device forms for creating a bunch of new devices.getDeviceFormsForUpdate(IdList deviceIds) Gets the device forms for updating an existing set of devices.updateDevices(DeviceBatchFormList deviceForms) Updates existing devices.Methods inherited from interface DeviceAdminSession
aliasDevice, canCreateDevices, canCreateDeviceWithRecordTypes, canDeleteDevices, canManageDeviceAliases, canUpdateDevices, createDevice, deleteDevice, getDeviceFormForCreate, getDeviceFormForUpdate, getSystem, getSystemId, updateDeviceModifier 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
-
getDeviceFormsForCreate
DeviceBatchFormList getDeviceFormsForCreate(long n, Type[] deviceRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the device forms for creating a bunch of new devices.- Parameters:
n- the number of forms to retrievedeviceRecordTypes- array of device record types to be included in each create operation or an empty list if none- Returns:
- the device forms
- Throws:
NullArgumentException-deviceRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createDevices
CreateResponseList createDevices(DeviceBatchFormList deviceForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofDevices. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateDevice.- Parameters:
deviceForms- the device forms- Returns:
- the create responses
- Throws:
NullArgumentException-deviceFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getDeviceFormsForUpdate
DeviceBatchFormList getDeviceFormsForUpdate(IdList deviceIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the device forms for updating an existing set of devices. A new device form should be requested for each update transaction.- Parameters:
deviceIds- theIdsof theDevice- Returns:
- the device form
- Throws:
NotFoundException- adeviceIdis not foundNullArgumentException-deviceIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateDevices
UpdateResponseList updateDevices(DeviceBatchFormList deviceForms) throws OperationFailedException, PermissionDeniedException Updates existing devices. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateDevice.- Parameters:
deviceForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-deviceFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllDevices
Deletes allDevicesin thisSystem.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteDevices
DeleteResponseList deleteDevices(IdList deviceIds) throws OperationFailedException, PermissionDeniedException Deletes devices for the givenIds.- Parameters:
deviceIds- theIdsof the devices to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-deviceIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasDevices
AliasResponseList aliasDevices(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aDevicefor the purpose of creating compatibility. The primaryIdof theDeviceis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another device, it is reassigned to the given deviceId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-