public interface LeaseAdminSession extends OsidSession
This session creates, updates, and deletes Leases.
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
Lease,
a LeaseForm
is requested using
getLeaseFormForCreate()
specifying the desired peers and record
Types
or none if no record Types
are needed.
The returned LeaseForm
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 LeaseForm
is submiited to
a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each LeaseForm
corresponds to an attempted transaction.
For updates, LeaseForms
are requested to the
Lease
Id
that is to be updated using
getLeaseFormForUpdate().
Similarly, the LeaseForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The LeaseForm
can
only be used once for a successful update and cannot be reused.
The delete operations delete Leases.
To unmap a
Lease
from the current Campus,
the
LeaseCampusAssignmentSession
should be used. These delete
operations attempt to remove the Lease
itself thus removing
it from all known Campus
catalogs.
This session includes an Id
aliasing mechanism to
assign an external Id
to an internally assigned Id.
Modifier and Type | Method and Description |
---|---|
void |
aliasLease(Id leaseId,
Id aliasId)
Adds an
Id to a Lease for the purpose of
creating compatibility. |
boolean |
canCreateLeases()
Tests if this user can create
Leases. |
boolean |
canCreateLeaseWithRecordTypes(Type[] leaseRecordTypes)
Tests if this user can create a single
Lease using the
desired record interface types. |
boolean |
canDeleteLeases()
Tests if this user can delete
Leases A return of true
does not guarantee successful authorization. |
boolean |
canManageLeaseAliases()
Tests if this user can manage
Id aliases for
Leases. |
boolean |
canUpdateLeases()
Tests if this user can update
Leases. |
Lease |
createLease(LeaseForm leaseForm)
Creates a new
Lease. |
void |
deleteLease(Id leaseId)
Deletes a
Lease. |
Campus |
getCampus()
Gets the
Campus associated with this session. |
Id |
getCampusId()
Gets the
Campus Id associated with this
session. |
LeaseForm |
getLeaseFormForCreate(Id roomId,
Id resourceId,
Type[] leaseRecordTypes)
Gets the lease form for creating new leases.
|
LeaseForm |
getLeaseFormForUpdate(Id leaseId)
Gets the lease form for updating an existing lease.
|
void |
updateLease(LeaseForm leaseForm)
Updates an existing lease.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getCampusId()
Campus
Id
associated with this
session. Campus Id
associated with this sessionmandatory
- This method must be implemented. Campus getCampus() throws OperationFailedException, PermissionDeniedException
Campus
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateLeases()
Leases.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Lease
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 Lease
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateLeaseWithRecordTypes(Type[] leaseRecordTypes)
Lease
using the
desired record interface types. While
RoomSquattingManager.getLeaseRecordTypes()
can be used to
examine which record interfaces are supported, this method tests which
record(s) are required for creating a specific Lease.
Providing an empty array tests if a Lease
can be
created with no records.leaseRecordTypes
- array of lease record types true
if Lease
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- leaseRecordTypes
is null
mandatory
- This method must be implemented. LeaseForm getLeaseFormForCreate(Id roomId, Id resourceId, Type[] leaseRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
roomId
- a room Id
resourceId
- a tenant resource Id
leaseRecordTypes
- array of lease record typesNotFoundException
- roomId or resourceId
is not foundNullArgumentException
- roomId, resourceId,
or leaseRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get from for requested
record typesmandatory
- This method must be implemented. Lease createLease(LeaseForm leaseForm) throws OperationFailedException, PermissionDeniedException
Lease.
leaseForm
- the form for this Lease
Lease
IllegalStateException
- leaseForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- leaseForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- leaseForm
did not
originate from getLeaseFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateLeases()
Leases.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Lease
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 Lease
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. LeaseForm getLeaseFormForUpdate(Id leaseId) throws NotFoundException, OperationFailedException, PermissionDeniedException
leaseId
- the Id
of the Lease
NotFoundException
- leaseId
is not foundNullArgumentException
- leaseId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateLease(LeaseForm leaseForm) throws OperationFailedException, PermissionDeniedException
leaseForm
- the form containing the elements to be updatedIllegalStateException
- leaseForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- leaseForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- leaseForm
did not
originate from getLeaseFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteLeases()
Leases
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Lease
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 Lease
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteLease(Id leaseId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Lease.
leaseId
- the Id
of the Lease
to
removeNotFoundException
- leaseId
not foundNullArgumentException
- leaseId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageLeaseAliases()
Id
aliases for
Leases.
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 Lease
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasLease(Id leaseId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Lease
for the purpose of
creating compatibility. The primary Id
of the
Lease
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the alias is
a pointer to another lease, it is reassigned to the given lease
Id.
leaseId
- the Id
of a Lease
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- leaseId
not foundNullArgumentException
- leaseId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.