Interface ResourceRelationshipAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ResourceRelationshipBatchAdminSession
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasResourceRelationship(Id resourceRelationshipId, Id aliasId) Adds anIdto aResourceRelationshipfor the purpose of creating compatibility.booleanTests if this user can createResourceRelationships.booleancanCreateResourceRelationshipWithRecordTypes(Type[] resourceRelationshipRecordTypes) Tests if this user can create a singleResourceRelationshipusing the desired record types.booleanTests if this user can deleteResourceRelationships.booleanTests if this user can manageIdaliases forResourceRelationships.booleanTests if this user can updateResourceRelationships.createResourceRelationship(ResourceRelationshipForm resourceRelationshipForm) Creates a newResourceRelationship.voiddeleteResourceRelationship(Id resourceRelationshipId) Deletes theResourceRelationshipidentified by the givenId.getBin()Gets theBinassociated with this session.getBinId()Gets theBinIdassociated with this session.getResourceRelationshipFormForCreate(Id sourceResourceId, Id destinationResourceId, Type[] resourceRelationshipRecordTypes) Gets the relationship form for creating new relationships.getResourceRelationshipFormForUpdate(Id resourceRelationshipId) Gets the relationship form for updating an existing relationship.voidupdateResourceRelationship(ResourceRelationshipForm resourceRelationshipForm) Updates an existing relationship.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
-
getBinId
Id getBinId()Gets theBinIdassociated with this session.- Returns:
- the
Bin Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getBin
Gets theBinassociated with this session.- Returns:
- the bin
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateResourceRelationships
boolean canCreateResourceRelationships()Tests if this user can createResourceRelationships. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aResourceRelationshipwill 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:
falseifResourceRelationshipcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateResourceRelationshipWithRecordTypes
Tests if this user can create a singleResourceRelationshipusing the desired record types. WhileResourceManager.getResourceRelationshipRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificResourceRelationship. Providing an empty array tests if aResourceRelationshipcan be created with no records.- Parameters:
resourceRelationshipRecordTypes- array of resource relationship types- Returns:
trueifResourceRelationshipcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-resourceRelationshipRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getResourceRelationshipFormForCreate
ResourceRelationshipForm getResourceRelationshipFormForCreate(Id sourceResourceId, Id destinationResourceId, Type[] resourceRelationshipRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the relationship form for creating new relationships. A new form should be requested for each create transaction.- Parameters:
sourceResourceId- theIdof the sourceResourcedestinationResourceId- theIdof the destinationResourceresourceRelationshipRecordTypes- array of resource relationship types- Returns:
- the relationship form
- Throws:
NotFoundException-sourceResourceIdordestinationResourceIdis not foundNullArgumentException-resourceIdorpeerResourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form with requested record types- Compliance:
mandatory- This method must be implemented.
-
createResourceRelationship
ResourceRelationship createResourceRelationship(ResourceRelationshipForm resourceRelationshipForm) throws OperationFailedException, PermissionDeniedException Creates a newResourceRelationship.- Parameters:
resourceRelationshipForm- the form for thisResourceRelationship- Returns:
- the new
ResourceRelationship - Throws:
IllegalStateException-resourceRelationshipFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-resourceId, peerResourceIdorresourceRelationshipFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-resourceRelationshipFormdid not originate fromgetResourceRelationshipFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateResourceRelationships
boolean canUpdateResourceRelationships()Tests if this user can updateResourceRelationships. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aResourceRelationshipwill 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:
falseif relationship modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getResourceRelationshipFormForUpdate
ResourceRelationshipForm getResourceRelationshipFormForUpdate(Id resourceRelationshipId) throws NotFoundException, OperationFailedException Gets the relationship form for updating an existing relationship. A new relationship form should be requested for each update transaction.- Parameters:
resourceRelationshipId- theIdof theResourceRelationship- Returns:
- the relationship form
- Throws:
NotFoundException-resourceRelationshipIdnot foundNullArgumentException-resourceRelationshipIdoraliasIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
updateResourceRelationship
void updateResourceRelationship(ResourceRelationshipForm resourceRelationshipForm) throws OperationFailedException, PermissionDeniedException Updates an existing relationship.- Parameters:
resourceRelationshipForm- the form containing the elements to be updated- Throws:
IllegalStateException-resourceRelationshipFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-resourceRelationshipFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-resourceRelationshipFormdid not originate fromgetResourceRelationshipFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteResourceRelationships
boolean canDeleteResourceRelationships()Tests if this user can deleteResourceRelationships. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aResourceRelationshipwill 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:
falseifResourceRelationshipdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteResourceRelationship
void deleteResourceRelationship(Id resourceRelationshipId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes theResourceRelationshipidentified by the givenId.- Parameters:
resourceRelationshipId- theIdof theResourceRelationshipto delete- Throws:
NotFoundException- aResourceRelationshipwas not found identified by the givenIdNullArgumentException-resourceRelationshipIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageResourceRelationshipAliases
boolean canManageResourceRelationshipAliases()Tests if this user can manageIdaliases forResourceRelationships. 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:
falseifResourceRelationshipaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasResourceRelationship
void aliasResourceRelationship(Id resourceRelationshipId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aResourceRelationshipfor the purpose of creating compatibility. The primaryIdof theResourceRelationshipis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another resource relationshp, it is reassigned to the given resource relationshipId.- Parameters:
resourceRelationshipId- theIdof aResourceRelationshipaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-resourceRelationshipIdnot foundNullArgumentException-resourceRelationshipIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-