Interface LocationAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
LocationBatchAdminSession
This session creates, updates, and deletes Locations . 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
Location , a LocationForm is requested using
getLocationFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
LocationForm 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 LocationForm is submiited to a create operation, it
cannot be reused with another create operation unless the first operation
was unsuccessful. Each LocationForm corresponds to an attempted
transaction.
For updates, LocationForms are requested to the
Location Id that is to be updated using
getLocationFormForUpdate() . Similarly, the LocationForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The LocationForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Locations . To unmap a
Location from the current Map , the
LocationMapAssignmentSession should be used. These delete operations
attempt to remove the Location itself thus removing it from all
known Map catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasLocation(Id locationId, Id aliasId) Adds anIdto aLocationfor the purpose of creating compatibility.booleanTests if this user can createLocations.booleancanCreateLocationWithRecordTypes(Type[] locationRecordTypes) Tests if this user can create a singleLocationusing the desired record types.booleanTests if this user can deleteLocations.booleanTests if this user can manageIdaliases forLocations.booleanTests if this user can updateLocations.createLocation(LocationForm locationForm) Creates a newLocation.voiddeleteLocation(Id locationId) Deletes aLocation.getLocationFormForCreate(Type[] locationRecordTypes) Gets the location form for creating new locations.getLocationFormForUpdate(Id locationId) Gets the location form for updating an existing location.getMap()Gets theMapassociated with this session.getMapId()Gets theMapIdassociated with this session.voidupdateLocation(LocationForm locationForm) Updates an existing location.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
-
getMapId
Id getMapId()Gets theMapIdassociated with this session.- Returns:
- the
Map Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getMap
Gets theMapassociated with this session.- Returns:
- the map
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateLocations
boolean canCreateLocations()Tests if this user can createLocations. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aLocationwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifLocationcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateLocationWithRecordTypes
Tests if this user can create a singleLocationusing the desired record types. WhileMappingManager.getLocationRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificLocation. Providing an empty array tests if aLocationcan be created with no records.- Parameters:
locationRecordTypes- array of location record types- Returns:
trueifLocationcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-locationRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getLocationFormForCreate
LocationForm getLocationFormForCreate(Type[] locationRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the location form for creating new locations. A new form should be requested for each create transaction.- Parameters:
locationRecordTypes- array of location record types- Returns:
- the location form
- Throws:
NullArgumentException-locationRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get a form with given record types- Compliance:
mandatory- This method must be implemented.
-
createLocation
Location createLocation(LocationForm locationForm) throws OperationFailedException, PermissionDeniedException Creates a newLocation.- Parameters:
locationForm- the form for thisLocation- Returns:
- the new
Location - Throws:
IllegalStateException-locationFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-locationFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-locationFormdid not originate fromgetLocationFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateLocations
boolean canUpdateLocations()Tests if this user can updateLocations. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aLocationwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifLocationmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getLocationFormForUpdate
LocationForm getLocationFormForUpdate(Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the location form for updating an existing location. A new location form should be requested for each update transaction.- Parameters:
locationId- theIdof theLocation- Returns:
- the location form
- Throws:
NotFoundException-locationIdis not foundNullArgumentException-locationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateLocation
void updateLocation(LocationForm locationForm) throws OperationFailedException, PermissionDeniedException Updates an existing location.- Parameters:
locationForm- the form containing the elements to be updated- Throws:
IllegalStateException-locationFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-locationIdorlocationFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-locationFormdid not originate fromgetLocationFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteLocations
boolean canDeleteLocations()Tests if this user can deleteLocations. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aLocationwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifLocationdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteLocation
void deleteLocation(Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aLocation.- Parameters:
locationId- theIdof theLocationto remove- Throws:
NotFoundException-locationIdnot foundNullArgumentException-locationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageLocationAliases
boolean canManageLocationAliases()Tests if this user can manageIdaliases forLocations. 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:
falseifLocationaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasLocation
void aliasLocation(Id locationId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aLocationfor the purpose of creating compatibility. The primaryIdof theLocationis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another location, it is reassigned to the given locationId.- Parameters:
locationId- theIdof aLocationaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-locationIdnot foundNullArgumentException-locationIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-