Interface BuildingAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
BuildingBatchAdminSession
This session creates, updates, and deletes Buildings . The data
for create and update is provided by the consumer via the form.
OsidForms are requested for each create or update and may not be reused.
Create and update operations differ in their usage. To create a
Building , a BuildingForm is requested using
getBuildingFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
BuildingForm 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 BuildingForm is submiited to a create operation, it
cannot be reused with another create operation unless the first operation
was unsuccessful. Each BuildingForm corresponds to an attempted
transaction.
For updates, BuildingForms are requested to the
Building Id that is to be updated using
getBuildingFormForUpdate() . Similarly, the BuildingForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The BuildingForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Buildings . To unmap a
Building from the current Campus , the
BuildingCampusAssignmentSession should be used. These delete operations
attempt to remove the Building 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 TypeMethodDescriptionvoidaliasBuilding(Id buildingId, Id aliasId) Adds anIdto aBuildingfor the purpose of creating compatibility.booleanTests if this user can createBuildings.booleancanCreateBuildingWithRecordTypes(Type[] buildingRecordTypes) Tests if this user can create a singleBuildingusing the desired record interface types.booleanTests if this user can deleteBuildingsA return of true does not guarantee successful authorization.booleanTests if this user can manageIdaliases forBuildings.booleanTests if this user can updateBuildings.createBuilding(BuildingForm buildingForm) Creates a newBuilding.voiddeleteBuilding(Id buildingId) Deletes aBuilding.getBuildingFormForCreate(Type[] buildingRecordTypes) Gets the building form for creating new buildings.getBuildingFormForUpdate(Id buildingId) Gets the building form for updating an existing building.Gets theCampusassociated with this session.Gets theCampusIdassociated with this session.voidupdateBuilding(BuildingForm buildingForm) Updates an existing building.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.
-
canCreateBuildings
boolean canCreateBuildings()Tests if this user can createBuildings. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aBuildingwill 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:
falseifBuildingcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateBuildingWithRecordTypes
Tests if this user can create a singleBuildingusing the desired record interface types. WhileRoomManager.getBuildingRecordTypes()can be used to examine which record interfaces are supported, this method tests which record(s) are required for creating a specificBuilding. Providing an empty array tests if aBuildingcan be created with no records.- Parameters:
buildingRecordTypes- array of building record types- Returns:
trueifBuildingcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-buildingRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getBuildingFormForCreate
BuildingForm getBuildingFormForCreate(Type[] buildingRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the building form for creating new buildings. A new form should be requested for each create transaction.- Parameters:
buildingRecordTypes- array of building record types- Returns:
- the building form
- Throws:
NullArgumentException-buildingRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get from for requested record types- Compliance:
mandatory- This method must be implemented.
-
createBuilding
Building createBuilding(BuildingForm buildingForm) throws OperationFailedException, PermissionDeniedException Creates a newBuilding.- Parameters:
buildingForm- the form for thisBuilding- Returns:
- the new
Building - Throws:
IllegalStateException-buildingFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-buildingFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-buildingFormdid not originate fromgetBuildingFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateBuildings
boolean canUpdateBuildings()Tests if this user can updateBuildings. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aBuildingwill 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:
falseifBuildingmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getBuildingFormForUpdate
BuildingForm getBuildingFormForUpdate(Id buildingId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the building form for updating an existing building. A new building form should be requested for each update transaction.- Parameters:
buildingId- theIdof theBuilding- Returns:
- the building form
- Throws:
NotFoundException-buildingIdis not foundNullArgumentException-buildingIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateBuilding
void updateBuilding(BuildingForm buildingForm) throws OperationFailedException, PermissionDeniedException Updates an existing building.- Parameters:
buildingForm- the form containing the elements to be updated- Throws:
IllegalStateException-buildingFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-buildingFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-buildingFormdid not originate fromgetBuildingFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteBuildings
boolean canDeleteBuildings()Tests if this user can deleteBuildingsA return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aBuildingwill 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:
falseifBuildingdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteBuilding
void deleteBuilding(Id buildingId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aBuilding.- Parameters:
buildingId- theIdof theBuildingto remove- Throws:
NotFoundException-buildingIdnot foundNullArgumentException-buildingIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageBuildingAliases
boolean canManageBuildingAliases()Tests if this user can manageIdaliases forBuildings. 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:
falseifBuildingaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasBuilding
void aliasBuilding(Id buildingId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aBuildingfor the purpose of creating compatibility. The primaryIdof theBuildingis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another building, it is reassigned to the given buildingId.- Parameters:
buildingId- theIdof aBuildingaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-buildingIdnot foundNullArgumentException-buildingIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-