Interface RemoteRelationService
-
- All Known Implementing Classes:
RemoteRelationServiceImpl
@ExperimentalApi public interface RemoteRelationService
Relation service, which allows to manage relations between entities. "Relations" are used when it's needed to mark related content. Good examples of relations are Watches (when user marks certain pages as watchable), Likes (user marks content as "Liked") or Favourites (content is marked as favourite by user) (all are "user2content" type of relations).For example, to create a favourite relation between a user and the DEV Space :
relationService.create(RelationInstance.builder(user, new SpaceFavouriteRelation(), space).build)); assertTrue(relationService.isRelated(user, new SpaceFavouriteRelation(), space));
relationService.findTargets(user, new SpaceFavouriteRelation()).fetchMany(new SimplePageRequest(0, 10));
- Since:
- 5.9
- See Also:
RelationInstance
,Relatable
,RelationDescriptor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description <S extends Relatable,T extends Relatable>
com.atlassian.util.concurrent.Promise<Void>create(RelationInstance<S,T> relationInstance)
Deprecated.since 7.0.1.<S extends Relatable,T extends Relatable>
CompletionStage<Void>createCompletionStage(RelationInstance<S,T> relationInstance)
Creates a directed relation between two relatable entities.<S extends Relatable,T extends Relatable>
com.atlassian.util.concurrent.Promise<Void>delete(RelationInstance<S,T> relationInstance)
Deprecated.since 7.0.1.<S extends Relatable,T extends Relatable>
CompletionStage<Void>deleteCompletionStage(RelationInstance<S,T> relationInstance)
Remove a relation if it exists between a source and a target relatable entity<S extends Relatable,T extends Relatable>
com.atlassian.util.concurrent.Promise<Boolean>isRelated(S source, RelationDescriptor<S,T> relationDescriptor, T target)
Deprecated.since 7.0.1.<S extends Relatable,T extends Relatable>
CompletionStage<Boolean>isRelatedCompletionStage(S source, RelationDescriptor<S,T> relationDescriptor, T target)
Determine whether a given source and target are related by the given relation
-
-
-
Method Detail
-
create
@Deprecated <S extends Relatable,T extends Relatable> com.atlassian.util.concurrent.Promise<Void> create(RelationInstance<S,T> relationInstance) throws ServiceException
Deprecated.since 7.0.1. UsecreateCompletionStage(RelationInstance)
instead.Creates a directed relation between two relatable entities.For example, when a user favourites a space a SpaceFavouriteRelation is created from the user to the space:
relationService.create(RelationInstance.builder(user, new SpaceFavouriteRelation(), space).build))
;- Type Parameters:
S
- type of the source entityT
- type of the target entity- Parameters:
relationInstance
- the relation to create- Returns:
- the newly created relationInstance
- Throws:
ServiceException
- if validation fails
-
delete
@Deprecated <S extends Relatable,T extends Relatable> com.atlassian.util.concurrent.Promise<Void> delete(RelationInstance<S,T> relationInstance) throws ServiceException
Deprecated.since 7.0.1. UsedeleteCompletionStage(RelationInstance)
instead.Remove a relation if it exists between a source and a target relatable entity- Type Parameters:
S
- type of the source entityT
- type of the target entity- Parameters:
relationInstance
- relation to be deleted- Throws:
ServiceException
- if validation fails
-
createCompletionStage
<S extends Relatable,T extends Relatable> CompletionStage<Void> createCompletionStage(RelationInstance<S,T> relationInstance) throws ServiceException
Creates a directed relation between two relatable entities.For example, when a user favourites a space a SpaceFavouriteRelation is created from the user to the space:
relationService.create(RelationInstance.builder(user, new SpaceFavouriteRelation(), space).build))
;- Type Parameters:
S
- type of the source entityT
- type of the target entity- Parameters:
relationInstance
- the relation to create- Returns:
- the newly created relationInstance
- Throws:
ServiceException
- if validation fails- Since:
- 7.0.1
-
deleteCompletionStage
<S extends Relatable,T extends Relatable> CompletionStage<Void> deleteCompletionStage(RelationInstance<S,T> relationInstance) throws ServiceException
Remove a relation if it exists between a source and a target relatable entity- Type Parameters:
S
- type of the source entityT
- type of the target entity- Parameters:
relationInstance
- relation to be deleted- Throws:
ServiceException
- if validation fails- Since:
- 7.0.1
-
isRelated
@Deprecated <S extends Relatable,T extends Relatable> com.atlassian.util.concurrent.Promise<Boolean> isRelated(S source, RelationDescriptor<S,T> relationDescriptor, T target)
Deprecated.since 7.0.1. UseisRelatedCompletionStage(Relatable, RelationDescriptor, Relatable)
instead.Determine whether a given source and target are related by the given relation- Type Parameters:
S
- type of the source entityT
- type of the target entity- Returns:
- true if the relation exists between the given source and target
-
isRelatedCompletionStage
<S extends Relatable,T extends Relatable> CompletionStage<Boolean> isRelatedCompletionStage(S source, RelationDescriptor<S,T> relationDescriptor, T target)
Determine whether a given source and target are related by the given relation- Type Parameters:
S
- type of the source entityT
- type of the target entity- Returns:
- true if the relation exists between the given source and target
- Since:
- 7.0.1
-
-