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(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)
RelationManager
Relation
argument.isRelated
in interface RelationManager
true
if entities are related, false
otherwise.public RelationEntity addRelation(RelatableEntity source, RelatableEntity target, RelationDescriptor relationDescriptor)
RelationManager
Relation
argumentaddRelation
in interface RelationManager
public void removeRelation(RelatableEntity source, RelatableEntity target, RelationDescriptor relationDescriptor)
RelationManager
Relation
argumentremoveRelation
in interface RelationManager
public int removeAllRelations(RelatableEntity relatableEntity)
RelationManager
removeAllRelations
in interface RelationManager
public int removeAllRelationsFromEntityWithType(RelationDescriptor relationDescriptor, RelatableEntity relatableEntity)
RelationManager
removeAllRelationsFromEntityWithType
in interface RelationManager
public int removeAllRelationsFromCurrentAndHistoricalEntities(RelatableEntity relatableEntity)
RelationManager
removeAllRelationsFromCurrentAndHistoricalEntities
in interface RelationManager
@Nonnull public PageResponse<RelatableEntity> getSources(RelationQuery request, LimitedRequest pageRequest)
RelationManager
request
argumentgetSources
in interface RelationManager
PageResponse
RelationQuery
,
LimitedRequest
@Nonnull public PageResponse<RelatableEntity> getTargets(RelationQuery request, LimitedRequest pageRequest)
RelationManager
request
argumentgetTargets
in interface RelationManager
PageResponse
RelationQuery
,
LimitedRequest
public int getSourcesCount(RelationQuery request)
RelationManager
request
argumentgetSourcesCount
in interface RelationManager
RelationQuery
public int getTargetsCount(RelationQuery request)
RelationManager
request
argumentgetTargetsCount
in interface RelationManager
RelationQuery
public void moveRelationsToContent(RelatableEntity fromRelatableEntity, RelatableEntity toRelatableEntity, RelationDescriptor descriptor)
RelationManager
moveRelationsToContent
in interface RelationManager
fromRelatableEntity
- the entity from which to remove the relationstoRelatableEntity
- the entity to which the relations will be addeddescriptor
- the type of relation to moveCopyright © 2003–2016 Atlassian. All rights reserved.