OSID Logo
OSID Specifications
metering package
Version 3.0.0
Release Candidate Preview
Interfaceosid.metering.UtilityAdminSession
Implementsosid.OsidSession
Description

This session creates, updates, and deletes Utilities. 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 UtilityForm, a UtilityForm is requested using getUtilityFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned UtilityForm 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 UtilityForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each UtilityForm corresponds to an attempted transaction.

For updates, UtilityForms are requested to the Utility Id that is to be updated using getUtilityFormForUpdate(). Similarly, the UtilityForm has metadata about the data that can be updated and it can perform validation before submitting the update. The UtilityForm can only be used once for a successful update and cannot be reused.

The delete operations delete Utilities.

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

MethodcanCreateUtilities
Description

Tests if this user can create Utilities. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Utility will result in a PERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.

Returnboolean false if Utility creation is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodcanCreateUtilityWithRecordTypes
Description

Tests if this user can create a single Utility using the desired record interface types. While MeteringManager.getUtilityRecordTypes() can be used to examine which record interfaces are supported, this method tests which record(s) are required for creating a specific Utility. Providing an empty array tests if a Utility can be created with no records.

Parametersosid.type.Type[]utilityRecordTypesarray of utility record types
Returnboolean true if Utility creation using the specified record Types is supported, false otherwise
ErrorsNULL_ARGUMENT utilityRecordTypes is null
CompliancemandatoryThis method must be implemented.
MethodgetUtilityFormForCreate
Description

Gets the utility form for creating new utilities. A new form should be requested for each create transaction.

Parametersosid.type.Type[]utilityRecordTypesarray of utility record types
Returnosid.metering.UtilityFormthe utility form
ErrorsNULL_ARGUMENT utilityRecordTypes is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTEDunable to get form for requested record types
CompliancemandatoryThis method must be implemented.
MethodcreateUtility
Description

Creates a new Utility.

Parametersosid.metering.UtilityFormutilityFormthe form for this Utility
Returnosid.metering.Utilitythe new Utility
ErrorsILLEGAL_STATE utilityForm already used in a create transaction
INVALID_ARGUMENTone or more of the form elements is invalid
NULL_ARGUMENT utilityForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED utilityForm did not originate from getUtilityFormForCreate()
CompliancemandatoryThis method must be implemented.
MethodcanUpdateUtilities
Description

Tests if this user can update Utilities. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Utility will result in a PERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.

Returnboolean false if Utility modification is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodgetUtilityFormForUpdate
Description

Gets the utility form for updating an existing utility. A new utility form should be requested for each update transaction.

Parametersosid.id.IdutilityIdthe Id of the Utility
Returnosid.metering.UtilityFormthe utility form
ErrorsNOT_FOUND utilityId is not found
NULL_ARGUMENT utilityId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodupdateUtility
Description

Updates an existing utility.

Parametersosid.metering.UtilityFormutilityFormthe form containing the elements to be updated
ErrorsILLEGAL_STATE utilityForm already used in an update transaction
INVALID_ARGUMENTthe form contains an invalid value
NULL_ARGUMENT utilityForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED utilityForm did not originate from getUtilityFormForUpdate()
CompliancemandatoryThis method must be implemented.
MethodcanDeleteUtilities
Description

Tests if this user can delete Utilities. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Utility will result in a PERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.

Returnboolean false if Utility deletion is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethoddeleteUtility
Description

Deletes a Utility.

Parametersosid.id.IdutilityIdthe Id of the Utility to remove
ErrorsNOT_FOUND utilityId not found
NULL_ARGUMENT utilityId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanManageUtilityAliases
Description

Tests if this user can manage Id aliases for utilities. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.

Returnboolean false if Utility aliasing is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodaliasUtility
Description

Adds an Id to a Utility for the purpose of creating compatibility. The primary Id of the Utility is determined by the provider. The new Id performs as an alias to the primary Id. If the alias is a pointer to another event, it is reassigned to the given event Id.

Parametersosid.id.IdutilityIdthe Id of a Utility
osid.id.IdaliasIdthe alias Id
ErrorsALREADY_EXISTS aliasId is already assigned
NOT_FOUND utilityId not found
NULL_ARGUMENT utilityId or aliasId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.