public interface UtilityAdminSession extends OsidSession
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasUtility(Id utilityId,
Id aliasId)
Adds an
Id to a Utility for the purpose
of creating compatibility. |
boolean |
canCreateUtilities()
Tests if this user can create
Utilities. |
boolean |
canCreateUtilityWithRecordTypes(Type[] utilityRecordTypes)
Tests if this user can create a single
Utility using
the desired record interface types. |
boolean |
canDeleteUtilities()
Tests if this user can delete
Utilities. |
boolean |
canManageUtilityAliases()
Tests if this user can manage
Id aliases for utilities. |
boolean |
canUpdateUtilities()
Tests if this user can update
Utilities. |
Utility |
createUtility(UtilityForm utilityForm)
Creates a new
Utility. |
void |
deleteUtility(Id utilityId)
Deletes a
Utility. |
UtilityForm |
getUtilityFormForCreate(Type[] utilityRecordTypes)
Gets the utility form for creating new utilities.
|
UtilityForm |
getUtilityFormForUpdate(Id utilityId)
Gets the utility form for updating an existing utility.
|
void |
updateUtility(UtilityForm utilityForm)
Updates an existing utility.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
boolean canCreateUtilities()
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. false
if Utility
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateUtilityWithRecordTypes(Type[] utilityRecordTypes)
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.utilityRecordTypes
- array of utility record types true
if Utility
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- utilityRecordTypes
is null
mandatory
- This method must be implemented. UtilityForm getUtilityFormForCreate(Type[] utilityRecordTypes) throws OperationFailedException, PermissionDeniedException
utilityRecordTypes
- array of utility record typesNullArgumentException
- utilityRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Utility createUtility(UtilityForm utilityForm) throws OperationFailedException, PermissionDeniedException
Utility.
utilityForm
- the form for this Utility
Utility
IllegalStateException
- utilityForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- utilityForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- utilityForm
did
not originate from getUtilityFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateUtilities()
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. false
if Utility
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. UtilityForm getUtilityFormForUpdate(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
utilityId
- the Id
of the Utility
NotFoundException
- utilityId
is not
foundNullArgumentException
- utilityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateUtility(UtilityForm utilityForm) throws OperationFailedException, PermissionDeniedException
utilityForm
- the form containing the elements to be updatedIllegalStateException
- utilityForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- utilityForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- utilityForm
did
not originate from getUtilityFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteUtilities()
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. false
if Utility
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteUtility(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Utility.
utilityId
- the Id
of the Utility
to removeNotFoundException
- utilityId
not foundNullArgumentException
- utilityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageUtilityAliases()
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. false
if Utility
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasUtility(Id utilityId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
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.
utilityId
- the Id
of a Utility
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- utilityId
not foundNullArgumentException
- utilityId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.