public interface ResourceRelationshipAdminSession extends OsidSession
This session creates, updates, and deletes
ResourceRelationships.
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
ResourceRelationship,
a ResourceRelationshipForm
is
requested using geResourceRelationshipFormForCreate()
specifying the nodes
and desired record Types
or none if no record Types
are needed. The returned
ResourceRelationshipForm
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 ResourceRelationshipForm
is submiited to a create operation, it cannot be reused with
another create operation unless the first operation was unsuccessful. Each
ResourceRelationshipForm
corresponds to an attempted
transaction.
For updates, ResourceRelationshipForms
are requested to
the ResourceRelationship
Id
that is to be
updated using getResourceRelationshipFormForUpdate().
Similarly, the ResourceRelationshipForm
has metadata about
the data that can be updated and it can perform validation before
submitting the update. The ResourceRelationshipForm
can
only be used once for a successful update and cannot be reused.
The delete operations delete ResourceRelationships.
To
unmap s ResourceRelationship
from the current Bin,
the ResourceRelationshipBinAssignmentSession
should
be used. These delete operations attempt to remove the
ResourceRelationship
itself thus removing it from all known
Bin
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 |
aliasResourceRelationship(Id resourceRelationshipId,
Id aliasId)
Adds an
Id to a ResourceRelationship for
the purpose of creating compatibility. |
boolean |
canCreateResourceRelationships()
Tests if this user can create
ResourceRelationships. |
boolean |
canCreateResourceRelationshipWithRecordTypes(Type[] resourceRelationshipRecordTypes)
Tests if this user can create a single
ResourceRelationship
using the desired record types. |
boolean |
canDeleteResourceRelationships()
Tests if this user can delete
ResourceRelationships. |
boolean |
canManageResourceRelationshipAliases()
Tests if this user can manage
Id aliases for
ResourceRelationships. |
boolean |
canUpdateResourceRelationships()
Tests if this user can update
ResourceRelationships. |
ResourceRelationship |
createResourceRelationship(ResourceRelationshipForm resourceRelationshipForm)
Creates a new
ResourceRelationship. |
void |
deleteResourceRelationship(Id resourceRelationshipId)
Deletes the
ResourceRelationship identified by the
given Id. |
Bin |
getBin()
Gets the
Bin associated with this session. |
Id |
getBinId()
Gets the
Bin Id associated with this
session. |
ResourceRelationshipForm |
getResourceRelationshipFormForCreate(Id sourceResourceId,
Id destinationResourceId,
Type[] resourceRelationshipRecordTypes)
Gets the relationship form for creating new relationships.
|
ResourceRelationshipForm |
getResourceRelationshipFormForUpdate(Id resourceRelationshipId)
Gets the relationship form for updating an existing relationship.
|
void |
updateResourceRelationship(ResourceRelationshipForm resourceRelationshipForm)
Updates an existing relationship.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getBinId()
Bin
Id
associated with this
session. Bin Id
associated with this sessionmandatory
- This method must be implemented. Bin getBin() throws OperationFailedException, PermissionDeniedException
Bin
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateResourceRelationships()
ResourceRelationships.
A
return of true does not guarantee successful authorization. A return
of false indicates that it is known creating a
ResourceRelationship
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 ResourceRelationship
creation is not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateResourceRelationshipWithRecordTypes(Type[] resourceRelationshipRecordTypes)
ResourceRelationship
using the desired record types. While
ResourceManager.getResourceRelationshipRecordTypes()
can be
used to examine which records are supported, this method tests which
record(s) are required for creating a specific
ResourceRelationship.
Providing an empty array tests if a
ResourceRelationship
can be created with no records.resourceRelationshipRecordTypes
- array of resource relationship
types true
if ResourceRelationship
creation using the specified record Types
is
supported, false
otherwiseNullArgumentException
-
resourceRelationshipRecordTypes
is null
mandatory
- This method must be implemented. ResourceRelationshipForm getResourceRelationshipFormForCreate(Id sourceResourceId, Id destinationResourceId, Type[] resourceRelationshipRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
sourceResourceId
- the Id
of the source
Resource
destinationResourceId
- the Id
of the destination
Resource
resourceRelationshipRecordTypes
- array of resource relationship
typesNotFoundException
- sourceResourceId
or
destinationResourceId
is not foundNullArgumentException
- resourceId
or
peerResourceId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form with
requested record typesmandatory
- This method must be implemented. ResourceRelationship createResourceRelationship(ResourceRelationshipForm resourceRelationshipForm) throws OperationFailedException, PermissionDeniedException
ResourceRelationship.
resourceRelationshipForm
- the form for this
ResourceRelationship
ResourceRelationship
IllegalStateException
- resourceRelationshipForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- resourceId,
peerResourceId
or resourceRelationshipForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- resourceRelationshipForm
did not originate from
getResourceRelationshipFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateResourceRelationships()
ResourceRelationships.
A
return of true does not guarantee successful authorization. A return
of false indicates that it is known updating a
ResourceRelationship
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 relationship modification is not
authorized, true
otherwisemandatory
- This method must be implemented. ResourceRelationshipForm getResourceRelationshipFormForUpdate(Id resourceRelationshipId) throws NotFoundException, OperationFailedException
resourceRelationshipId
- the Id
of the
ResourceRelationship
NotFoundException
- resourceRelationshipId
not foundNullArgumentException
- resourceRelationshipId
or aliasId
is null
OperationFailedException
- unable to complete requestmandatory
- This method must be implemented. void updateResourceRelationship(ResourceRelationshipForm resourceRelationshipForm) throws OperationFailedException, PermissionDeniedException
resourceRelationshipForm
- the form containing the elements to
be updatedIllegalStateException
- resourceRelationshipForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- resourceRelationshipForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- resourceRelationshipForm
did not originate from
getResourceRelationshipFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteResourceRelationships()
ResourceRelationships.
A
return of true does not guarantee successful authorization. A return
of false indicates that it is known deleting a
ResourceRelationship
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 ResourceRelationship
deletion is not authorized, true
otherwisemandatory
- This method must be implemented. void deleteResourceRelationship(Id resourceRelationshipId) throws NotFoundException, OperationFailedException, PermissionDeniedException
ResourceRelationship
identified by the
given Id.
resourceRelationshipId
- the Id
of the
ResourceRelationship
to deleteNotFoundException
- a ResourceRelationship
was not found identified by the given Id
NullArgumentException
- resourceRelationshipId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageResourceRelationshipAliases()
Id
aliases for
ResourceRelationships.
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 ResourceRelationship
aliasing is not authorized, true
otherwisemandatory
- This method must be implemented. void aliasResourceRelationship(Id resourceRelationshipId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a ResourceRelationship
for
the purpose of creating compatibility. The primary Id
of the ResourceRelationship
is determined by the
provider. The new Id
performs as an alias to the
primary Id
. If the alias is a pointer to another
resource relationshp, it is reassigned to the given resource
relationship Id.
resourceRelationshipId
- the Id
of a
ResourceRelationship
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- resourceRelationshipId
not foundNullArgumentException
- resourceRelationshipId
or aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.