public interface LocationAdminSession extends OsidSession
This session creates, updates, and deletes Locations.
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
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasLocation(Id locationId,
Id aliasId)
Adds an
Id to a Location for the purpose
of creating compatibility. |
boolean |
canCreateLocations()
Tests if this user can create
Locations. |
boolean |
canCreateLocationWithRecordTypes(Type[] locationRecordTypes)
Tests if this user can create a single
Location using
the desired record types. |
boolean |
canDeleteLocations()
Tests if this user can delete
Locations. |
boolean |
canManageLocationAliases()
Tests if this user can manage
Id aliases for
Locations. |
boolean |
canUpdateLocations()
Tests if this user can update
Locations. |
Location |
createLocation(LocationForm locationForm)
Creates a new
Location. |
void |
deleteLocation(Id locationId)
Deletes a
Location. |
LocationForm |
getLocationFormForCreate(Type[] locationRecordTypes)
Gets the location form for creating new locations.
|
LocationForm |
getLocationFormForUpdate(Id locationId)
Gets the location form for updating an existing location.
|
Map |
getMap()
Gets the
Map associated with this session. |
Id |
getMapId()
Gets the
Map Id associated with this
session. |
void |
updateLocation(LocationForm locationForm)
Updates an existing location.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getMapId()
Map
Id
associated with this
session. Map Id
associated with this sessionmandatory
- This method must be implemented. Map getMap() throws OperationFailedException, PermissionDeniedException
Map
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateLocations()
Locations.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Location
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer create operations to
an unauthorized user. false
if Location
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateLocationWithRecordTypes(Type[] locationRecordTypes)
Location
using
the desired record types. While
MappingManager.getLocationRecordTypes()
can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Location.
Providing an
empty array tests if a Location
can be created with no
records.locationRecordTypes
- array of location record types true
if Location
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- locationRecordTypes
is null
mandatory
- This method must be implemented. LocationForm getLocationFormForCreate(Type[] locationRecordTypes) throws OperationFailedException, PermissionDeniedException
locationRecordTypes
- array of location record typesNullArgumentException
- locationRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get a form with given
record typesmandatory
- This method must be implemented. Location createLocation(LocationForm locationForm) throws OperationFailedException, PermissionDeniedException
Location.
locationForm
- the form for this Location
Location
IllegalStateException
- locationForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- locationForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- locationForm
did
not originate from getLocationFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateLocations()
Locations.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Location
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer update operations to
an unauthorized user. false
if Location
modification
is not authorized, true
otherwisemandatory
- This method must be implemented. LocationForm getLocationFormForUpdate(Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException
locationId
- the Id
of the Location
NotFoundException
- locationId
is not
foundNullArgumentException
- locationId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateLocation(LocationForm locationForm) throws OperationFailedException, PermissionDeniedException
locationForm
- the form containing the elements to be updatedIllegalStateException
- locationForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- locationId
or
locationForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- locationForm
did
not originate from getLocationFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteLocations()
Locations.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting a Location
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer delete operations to
an unauthorized user. false
if Location
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. void deleteLocation(Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Location.
locationId
- the Id
of the Location
to removeNotFoundException
- locationId
not foundNullArgumentException
- locationId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageLocationAliases()
Id
aliases for
Locations.
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 Location
aliasing is
not authorized, true
otherwisemandatory
- This method must be implemented. void aliasLocation(Id locationId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Location
for the purpose
of creating compatibility. The primary Id
of the
Location
is determined by the provider. The new Id
performs as an alias to the primary Id
. If the
alias is a pointer to another location, it is reassigned to the given
location Id.
locationId
- the Id
of a Location
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- locationId
not foundNullArgumentException
- locationId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.