public class DefaultRelationManager extends Object implements RelationManager
| Constructor and Description |
|---|
DefaultRelationManager(Content2ContentHibernateRelationDao content2ContentHibernateRelationDao,
User2ContentHibernateRelationDao user2ContentHibernateRelationDao,
User2UserHibernateRelationDao user2UserHibernateRelationDao) |
| Modifier and Type | Method and Description |
|---|---|
RelationEntity |
addRelation(RelatableEntity source,
RelatableEntity target,
RelationDescriptor relationDescriptor)
Create a new relation between 2 entities.
|
PageResponse<RelatableEntity> |
getSources(RelationQuery request,
LimitedRequest pageRequest)
Fetch all related sources for the entity.
|
int |
getSourcesCount(RelationQuery request)
Get total number of related sources for the entity.
|
PageResponse<RelatableEntity> |
getTargets(RelationQuery request,
LimitedRequest pageRequest)
Fetch all related targets for the entity.
|
int |
getTargetsCount(RelationQuery request)
Get total number of related targets for the entity.
|
boolean |
isRelated(RelatableEntity source,
RelatableEntity target,
RelationDescriptor relationDescriptor)
Checks if given entities are related.
|
void |
moveRelationsToContent(RelatableEntity fromRelatableEntity,
RelatableEntity toRelatableEntity,
RelationDescriptor descriptor)
Moves all the relations of the specified type from one entity to another.
|
int |
removeAllRelations(RelatableEntity relatableEntity)
This method removes all relations (across all names and types), where given entity participates.
|
int |
removeAllRelationsFromCurrentAndHistoricalEntities(Iterable<? extends RelatableEntity> readableEntities)
This method removes all relations (across all names and types), where given entity participates.
|
int |
removeAllRelationsFromCurrentAndHistoricalEntities(RelatableEntity relatableEntity)
This method removes all relations (across all names and types), where given entity participates.
|
int |
removeAllRelationsFromEntityWithType(RelationDescriptor relationDescriptor,
RelatableEntity relatableEntity)
This method remove all relations of the given type where the given entity participates
|
void |
removeRelation(RelatableEntity source,
RelatableEntity target,
RelationDescriptor relationDescriptor)
Delete relation.
|
public DefaultRelationManager(@Nonnull Content2ContentHibernateRelationDao content2ContentHibernateRelationDao, @Nonnull User2ContentHibernateRelationDao user2ContentHibernateRelationDao, @Nonnull User2UserHibernateRelationDao user2UserHibernateRelationDao)
public boolean isRelated(RelatableEntity source, RelatableEntity target, RelationDescriptor relationDescriptor)
RelationManagerRelation argument.isRelated in interface RelationManagertrue if entities are related, false otherwise.public RelationEntity addRelation(RelatableEntity source, RelatableEntity target, RelationDescriptor relationDescriptor)
RelationManagerRelation argumentaddRelation in interface RelationManagerpublic void removeRelation(RelatableEntity source, RelatableEntity target, RelationDescriptor relationDescriptor)
RelationManagerRelation argumentremoveRelation in interface RelationManagerpublic int removeAllRelations(RelatableEntity relatableEntity)
RelationManagerremoveAllRelations in interface RelationManagerpublic int removeAllRelationsFromEntityWithType(RelationDescriptor relationDescriptor, RelatableEntity relatableEntity)
RelationManagerremoveAllRelationsFromEntityWithType in interface RelationManagerpublic int removeAllRelationsFromCurrentAndHistoricalEntities(RelatableEntity relatableEntity)
RelationManagerremoveAllRelationsFromCurrentAndHistoricalEntities in interface RelationManagerpublic int removeAllRelationsFromCurrentAndHistoricalEntities(Iterable<? extends RelatableEntity> readableEntities)
RelationManagerremoveAllRelationsFromCurrentAndHistoricalEntities in interface RelationManager@Nonnull public PageResponse<RelatableEntity> getSources(RelationQuery request, LimitedRequest pageRequest)
RelationManagerrequest argumentgetSources in interface RelationManagerPageResponseRelationQuery,
LimitedRequest@Nonnull public PageResponse<RelatableEntity> getTargets(RelationQuery request, LimitedRequest pageRequest)
RelationManagerrequest argumentgetTargets in interface RelationManagerPageResponseRelationQuery,
LimitedRequestpublic int getSourcesCount(RelationQuery request)
RelationManagerrequest argumentgetSourcesCount in interface RelationManagerRelationQuerypublic int getTargetsCount(RelationQuery request)
RelationManagerrequest argumentgetTargetsCount in interface RelationManagerRelationQuerypublic void moveRelationsToContent(RelatableEntity fromRelatableEntity, RelatableEntity toRelatableEntity, RelationDescriptor descriptor)
RelationManagermoveRelationsToContent in interface RelationManagerfromRelatableEntity - the entity from which to remove the relationstoRelatableEntity - the entity to which the relations will be addeddescriptor - the type of relation to moveCopyright © 2003–2019 Atlassian. All rights reserved.