Interface RelationshipAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
RelationshipBatchAdminSession
This session creates, updates, and deletes Relationships . 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
Relationship , a RelationshipForm is requested using
getRelationshipFormForCreate() specifying the desired peers and record
Types or none if no record Types are needed. The returned
RelationshipForm 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 RelationshipForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each RelationshipForm
corresponds to an attempted transaction.
For updates, RelationshipForms are requested to the
Relationship Id that is to be updated using
getRelationshipFormForUpdate() . Similarly, the RelationshipForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The RelationshipForm can
only be used once for a successful update and cannot be reused.
The delete operations delete Relationships . To unmap a
Relationship from the current Family , the
RelationshipFamilyAssignmentSession should be used. These delete
operations attempt to remove the Relationship itself thus removing
it from all known Family catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasRelationship(Id relationshipId, Id aliasId) Adds anIdto aRelationshipfor the purpose of creating compatibility.booleanTests if this user can createRelationshipsA return of true does not guarantee successful authorization.booleancanCreateRelationshipWithRecordTypes(Type[] relationshipRecordTypes) Tests if this user can create a singleRelationshipusing the desired record types.booleanTests if this user can deleteRelationships.booleanTests if this user can manageIdaliases forRelationships.booleanTests if this user can updateRelationships.createRelationship(RelationshipForm relationshipForm) Creates a newRelationship.voiddeleteRelationship(Id relationshipId) Deletes aRelationship.Gets theFamilyassociated with this session.Gets theFamiltIdassociated with this session.getRelationshipFormForCreate(Id sourceId, Id destinationId, Type[] relationshipRecordTypes) Gets the relationship form for creating new relationships.getRelationshipFormForUpdate(Id relationshipId) Gets the relationship form for updating an existing relationship.voidupdateRelationship(RelationshipForm relationshipForm) 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
-
getFamilyId
Id getFamilyId()Gets theFamiltIdassociated with this session.- Returns:
- the
Family Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getFamily
Gets theFamilyassociated with this session.- Returns:
- the family
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateRelationships
boolean canCreateRelationships()Tests if this user can createRelationshipsA return of true does not guarantee successful authorization. A return of false indicates that it is known creating aRelationshipwill 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:
falseifRelationshipcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateRelationshipWithRecordTypes
Tests if this user can create a singleRelationshipusing the desired record types. WhileRelationshipManager.getRelationshipRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificRelationship. Providing an empty array tests if aRelationshipcan be created with no records.- Parameters:
relationshipRecordTypes- array of relationship record types- Returns:
trueifRelationshipcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-relationshipRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getRelationshipFormForCreate
RelationshipForm getRelationshipFormForCreate(Id sourceId, Id destinationId, Type[] relationshipRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the relationship form for creating new relationships. A new form should be requested for each create transaction.- Parameters:
sourceId-Idof a peerdestinationId-Idof the related peerrelationshipRecordTypes- array of relationship record types- Returns:
- the relationship form
- Throws:
NotFoundException-sourceIdordestinationIdis not foundNullArgumentException-sourceIdordestinationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested recod types- Compliance:
mandatory- This method must be implemented.
-
createRelationship
Relationship createRelationship(RelationshipForm relationshipForm) throws OperationFailedException, PermissionDeniedException Creates a newRelationship.- Parameters:
relationshipForm- the form for thisRelationship- Returns:
- the new
Relationship - Throws:
IllegalStateException-relationshipFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-relationshipFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-relationshipFormdid not originate fromgetRelationshipFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateRelationships
boolean canUpdateRelationships()Tests if this user can updateRelationships. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aRelationshipwill 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:
falseifRelationshipmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getRelationshipFormForUpdate
RelationshipForm getRelationshipFormForUpdate(Id relationshipId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the relationship form for updating an existing relationship. A new relationship form should be requested for each update transaction.- Parameters:
relationshipId- theIdof theRelationship- Returns:
- the relationship form
- Throws:
NotFoundException-relationshipIdis not foundNullArgumentException-relationshipIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateRelationship
void updateRelationship(RelationshipForm relationshipForm) throws OperationFailedException, PermissionDeniedException Updates an existing relationship.- Parameters:
relationshipForm- the form containing the elements to be updated- Throws:
IllegalStateException-relationshipFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-relationshipFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-relationshipFormdid not originate fromgetRelationshipFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteRelationships
boolean canDeleteRelationships()Tests if this user can deleteRelationships. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aRelationshipwill 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:
falseifRelationshipdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteRelationship
void deleteRelationship(Id relationshipId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aRelationship.- Parameters:
relationshipId- theIdof theRelationshipto remove- Throws:
NotFoundException-relationshipIdnot foundNullArgumentException-relationshipIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageRelationshipAliases
boolean canManageRelationshipAliases()Tests if this user can manageIdaliases forRelationships. 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:
falseifRelationshipaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasRelationship
void aliasRelationship(Id relationshipId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aRelationshipfor the purpose of creating compatibility. The primaryIdof theRelationshipis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another relationship, it is reassigned to the given relationshipId.- Parameters:
relationshipId- theIdof aRelationshipaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-relationshipnot foundNullArgumentException-relationshipIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-