Interface LeaseAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
LeaseBatchAdminSession
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasLease(Id leaseId, Id aliasId) Adds anIdto aLeasefor the purpose of creating compatibility.booleanTests if this user can createLeases.booleancanCreateLeaseWithRecordTypes(Type[] leaseRecordTypes) Tests if this user can create a singleLeaseusing the desired record interface types.booleanTests if this user can deleteLeasesA return of true does not guarantee successful authorization.booleanTests if this user can manageIdaliases forLeases.booleanTests if this user can updateLeases.createLease(LeaseForm leaseForm) Creates a newLease.voiddeleteLease(Id leaseId) Deletes aLease.Gets theCampusassociated with this session.Gets theCampusIdassociated with this session.getLeaseFormForCreate(Id roomId, Id resourceId, Type[] leaseRecordTypes) Gets the lease form for creating new leases.getLeaseFormForUpdate(Id leaseId) Gets the lease form for updating an existing lease.voidupdateLease(LeaseForm leaseForm) Updates an existing lease.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
-
getCampusId
Id getCampusId()Gets theCampusIdassociated with this session.- Returns:
- the
Campus Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getCampus
Gets theCampusassociated with this session.- Returns:
- the campus
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateLeases
boolean canCreateLeases()Tests if this user can createLeases. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aLeasewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifLeasecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateLeaseWithRecordTypes
Tests if this user can create a singleLeaseusing the desired record interface types. WhileRoomSquattingManager.getLeaseRecordTypes()can be used to examine which record interfaces are supported, this method tests which record(s) are required for creating a specificLease. Providing an empty array tests if aLeasecan be created with no records.- Parameters:
leaseRecordTypes- array of lease record types- Returns:
trueifLeasecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-leaseRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getLeaseFormForCreate
LeaseForm getLeaseFormForCreate(Id roomId, Id resourceId, Type[] leaseRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the lease form for creating new leases. A new form should be requested for each create transaction.- Parameters:
roomId- a roomIdresourceId- a tenant resourceIdleaseRecordTypes- array of lease record types- Returns:
- the lease form
- Throws:
NotFoundException-roomId or resourceIdis not foundNullArgumentException-roomId, resourceId, orleaseRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get from for requested record types- Compliance:
mandatory- This method must be implemented.
-
createLease
Creates a newLease.- Parameters:
leaseForm- the form for thisLease- Returns:
- the new
Lease - Throws:
IllegalStateException-leaseFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-leaseFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-leaseFormdid not originate fromgetLeaseFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateLeases
boolean canUpdateLeases()Tests if this user can updateLeases. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aLeasewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifLeasemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getLeaseFormForUpdate
LeaseForm getLeaseFormForUpdate(Id leaseId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the lease form for updating an existing lease. A new lease form should be requested for each update transaction.- Parameters:
leaseId- theIdof theLease- Returns:
- the lease form
- Throws:
NotFoundException-leaseIdis not foundNullArgumentException-leaseIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateLease
Updates an existing lease.- Parameters:
leaseForm- the form containing the elements to be updated- Throws:
IllegalStateException-leaseFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-leaseFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-leaseFormdid not originate fromgetLeaseFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteLeases
boolean canDeleteLeases()Tests if this user can deleteLeasesA return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aLeasewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifLeasedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteLease
void deleteLease(Id leaseId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aLease.- Parameters:
leaseId- theIdof theLeaseto remove- Throws:
NotFoundException-leaseIdnot foundNullArgumentException-leaseIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageLeaseAliases
boolean canManageLeaseAliases()Tests if this user can manageIdaliases forLeases. 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:
falseifLeasealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasLease
void aliasLease(Id leaseId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aLeasefor the purpose of creating compatibility. The primaryIdof theLeaseis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another lease, it is reassigned to the given leaseId.- Parameters:
leaseId- theIdof aLeasealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-leaseIdnot foundNullArgumentException-leaseIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-