Interface RelationshipBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession, RelationshipAdminSession
This session creates, updates, and deletes Relationships in
bulk. 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
getRelationshipFormsForCreate() specifying the desired relationship peers
and record Types or none if no record Types are needed.
Each of the returned RelationshipForms 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 a 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.
The RelationshipForms returned from
getRelationshipFormsForCreate() may be linked to the originating request
through the peer Ids of the RelationshipForm . In the case
where there may be duplicates, any RelationshipForm of the same
peer Ids may be used for a create operation.
Once a batch of RelationshipForms are submitted for create, a
CreateResponse is returned for each RelationshipForm ,
although the ordering is not defined. Only errors that pertain to the
entire create operation are returned from createRelationships() ,
errors specific to an individual RelationshipForm are indicated in
the corresponding CreateResponse . CreateResponses may be
linked to the originating RelationshipForm through the
RelationshipForm Id .
For updates, RelationshipForms are requested to the
Relationship Id that is to be updated using
getRelationshipFormsForUpdate() where the reference Id in the
RelationshipForm may be used to link the request. 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.
Once a batch of RelationshipForms are submitted for update, an
UpdateResponse is returned for each RelationshipForm ,
although the ordering is not defined. Only errors that pertain to the
entire update operation are returned from updateRelationships() ,
errors specific to an individual RelationshipForm are indicated in
the corresponding UpdateResponse . UpdateResponses may be
linked to the originating RelationshipForm through the
RelationshipForm Id .
The delete operations delete Relationships in bulk. 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. Bulk delete operations return
the results in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasRelationships(AliasRequestList aliasRequests) Adds anIdto aRelationshipfor the purpose of creating compatibility.createRelationships(RelationshipBatchFormList relationshipForms) Creates a new set ofRelationships.Deletes allRelationshipsin thisFamily.Deletes relationships ineffective before the given date.deleteRelationships(IdList relationshipIds) Deletes relationships for the givenIds.deleteRelationshipsForDestinationId(Id destinationId) Deletes relationships for the given destination node.deleteRelationshipsForSourceId(Id sourceId) Deletes relationships for the given source.getRelationshipFormsForCreate(RelationshipPeerList peers, Type[] relationshipRecordTypes) Gets the relationship forms for creating a bunch of new relationships.getRelationshipFormsForUpdate(IdList relationshipIds) Gets the relationship forms for updating an existing set of relationships.updateRelationships(RelationshipBatchFormList relationshipForms) Updates existing relationships.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.Methods inherited from interface RelationshipAdminSession
aliasRelationship, canCreateRelationships, canCreateRelationshipWithRecordTypes, canDeleteRelationships, canManageRelationshipAliases, canUpdateRelationships, createRelationship, deleteRelationship, getFamily, getFamilyId, getRelationshipFormForCreate, getRelationshipFormForUpdate, updateRelationshipModifier 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.
-
Method Details
-
getRelationshipFormsForCreate
RelationshipBatchFormList getRelationshipFormsForCreate(RelationshipPeerList peers, Type[] relationshipRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the relationship forms for creating a bunch of new relationships. A form is returned for each set of relationship peers.- Parameters:
peers- a list of relationship peersrelationshipRecordTypes- array of relationship record types to be included in each create operation or an empty list if none- Returns:
- the relationship forms
- Throws:
NotFoundException- a node is not foundNullArgumentException-peersorrelationshipRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createRelationships
CreateResponseList createRelationships(RelationshipBatchFormList relationshipForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofRelationships. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
relationshipForms- the relationship forms- Returns:
- the create responses
- Throws:
NullArgumentException-relationshipFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getRelationshipFormsForUpdate
RelationshipBatchFormList getRelationshipFormsForUpdate(IdList relationshipIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the relationship forms for updating an existing set of relationships. A new relationship form should be requested for each update transaction.- Parameters:
relationshipIds- theIdsof theRelationship- Returns:
- the relationship form
- Throws:
NotFoundException- arelationshipIdis not foundNullArgumentException-relationshipIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateRelationships
UpdateResponseList updateRelationships(RelationshipBatchFormList relationshipForms) throws OperationFailedException, PermissionDeniedException Updates existing relationships. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
relationshipForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-relationshipFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllRelationships
DeleteResponseList deleteAllRelationships() throws OperationFailedException, PermissionDeniedExceptionDeletes allRelationshipsin thisFamily.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteRelationships
DeleteResponseList deleteRelationships(IdList relationshipIds) throws OperationFailedException, PermissionDeniedException Deletes relationships for the givenIds.- Parameters:
relationshipIds- theIdsof the relationships to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-relationshipIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteRelationshipsForSourceId
DeleteResponseList deleteRelationshipsForSourceId(Id sourceId) throws OperationFailedException, PermissionDeniedException Deletes relationships for the given source.- Parameters:
sourceId- theIdof a peer- Returns:
- the delete responses
- Throws:
NullArgumentException-sourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteRelationshipsForDestinationId
DeleteResponseList deleteRelationshipsForDestinationId(Id destinationId) throws OperationFailedException, PermissionDeniedException Deletes relationships for the given destination node.- Parameters:
destinationId- theIdof a peer- Returns:
- the delete responses
- Throws:
NullArgumentException-destinationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteIneffectiveRelationshipsByDate
DeleteResponseList deleteIneffectiveRelationshipsByDate(DateTime date) throws OperationFailedException, PermissionDeniedException Deletes relationships ineffective before the given date.- Parameters:
date- a date- Returns:
- the delete responses
- Throws:
NullArgumentException-dateisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasRelationships
AliasResponseList aliasRelationships(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aRelationshipfor the purpose of creating compatibility. The primaryIdof theRelationshipis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another relationship, it is reassigned to the given relationshipId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-