@ExperimentalApi
public interface RemoteRelationService
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));
and to find the favourite spaces of a user :
relationService.findTargets(user, new SpaceFavouriteRelation()).fetchMany(new SimplePageRequest(0, 10));
RelationInstance
,
Relatable
,
RelationDescriptor
Modifier and Type | Interface and Description |
---|---|
static interface |
RemoteRelationService.RelatableFinder<R extends Relatable>
Finder, which is used to perform basic relation operations, such as fetching source or target entities of
particular relation, get total number of related entities etc.
|
static interface |
RemoteRelationService.RemoteParameterRelationFinder<S extends Relatable,T extends Relatable> |
static interface |
RemoteRelationService.RemoteRelationFetcher<S extends Relatable,T extends Relatable> |
static interface |
RemoteRelationService.RemoteRelationFinder<S extends Relatable,T extends Relatable> |
Modifier and Type | Method and Description |
---|---|
<S extends Relatable,T extends Relatable> |
create(RelationInstance<S,T> relationInstance)
Creates a directed relation between two relatable entities.
|
<S extends Relatable,T extends Relatable> |
delete(RelationInstance<S,T> relationInstance)
Remove a relation if it exists between a source and a target relatable entity
|
<S extends Relatable,T extends Relatable> |
find(Expansion... expansions) |
<S extends Relatable,T extends Relatable> |
findSources(T target,
RelationDescriptor<S,T> relationDescriptor)
Find relation instances to the given target entity that have a relation with the relation name from the source type
|
<S extends Relatable,T extends Relatable> |
findTargets(S source,
RelationDescriptor<S,T> relationDescriptor)
Find relation instances of the given target type that have a relation with the relation name from the source entity.
|
<S extends Relatable,T extends Relatable> |
isRelated(S source,
RelationDescriptor<S,T> relationDescriptor,
T target)
Determine whether a given source and target are related by the given relation
|
<S extends Relatable,T extends Relatable> com.atlassian.util.concurrent.Promise<Void> create(RelationInstance<S,T> relationInstance) throws ServiceException
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))
;
S
- type of the source entityT
- type of the target entityrelationInstance
- the relation to createServiceException
- if validation fails<S extends Relatable,T extends Relatable> com.atlassian.util.concurrent.Promise<Void> delete(RelationInstance<S,T> relationInstance) throws ServiceException
S
- type of the source entityT
- type of the target entityrelationInstance
- relation to be deletedServiceException
- if validation fails<S extends Relatable,T extends Relatable> com.atlassian.util.concurrent.Promise<Boolean> isRelated(S source, RelationDescriptor<S,T> relationDescriptor, T target)
S
- type of the source entityT
- type of the target entity<S extends Relatable,T extends Relatable> RemoteRelationService.RelatableFinder<S> findSources(T target, RelationDescriptor<S,T> relationDescriptor)
S
- type of the source entityT
- type of the target entitytarget
- target entity instancerelationDescriptor
- relation descriptor<S extends Relatable,T extends Relatable> RemoteRelationService.RelatableFinder<S> findTargets(S source, RelationDescriptor<S,T> relationDescriptor)
S
- type of the source entityT
- type of the target entitysource
- source entity instancerelationDescriptor
- relation descriptor<S extends Relatable,T extends Relatable> RemoteRelationService.RemoteRelationFinder<S,T> find(Expansion... expansions)
Copyright © 2003–2017 Atlassian. All rights reserved.