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.
|
int |
removeAllRelations(RelatableEntity relatableEntity)
This method removes all relations (across all names and types), where 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
@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
Copyright © 2003–2016 Atlassian. All rights reserved.