Class User2ContentHibernateRelationDao
- java.lang.Object
-
- com.atlassian.confluence.internal.relations.dao.hibernate.HibernateRelationDao<ConfluenceUser,ContentEntityObject>
-
- com.atlassian.confluence.internal.relations.dao.hibernate.User2ContentHibernateRelationDao
-
- All Implemented Interfaces:
RelationDao<ConfluenceUser,ContentEntityObject>
public class User2ContentHibernateRelationDao extends HibernateRelationDao<ConfluenceUser,ContentEntityObject>
- Since:
- 5.9
-
-
Field Summary
-
Fields inherited from class com.atlassian.confluence.internal.relations.dao.hibernate.HibernateRelationDao
BATCHING_CHUNK_SIZE, hibernate, RELATION_PARAM_NAME, sessionFactory, SOURCE_PARAM_NAME, TARGET_PARAM_NAME
-
-
Constructor Summary
Constructors Constructor Description User2ContentHibernateRelationDao(org.hibernate.SessionFactory sessionFactory, SchemaInformationService schemaInformationService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RelationEntity<ConfluenceUser,ContentEntityObject>
constructRelationEntity(RelationEntity<ConfluenceUser,ContentEntityObject> relationEntity, ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?,?> relationDescriptor)
List<Long>
getAllRelationIdsForContentInSpace(@NonNull String spaceKey, @NonNull Collection<ConfluenceEntityObject> exclusions, int start, int limit)
This method returns ids of all content relation entities in space.@Nullable User2ContentRelationEntity
getRelationEntity(ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?,?> relationDescriptor)
Get relation for given content, type and name.int
getRelationsCount(ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?,?> relationDescriptor)
Get total number of relations for given content, type and name.@NonNull List<ConfluenceUser>
getSources(RelationQuery<ContentEntityObject> request, int start, int limit)
Fetch all related sources for the entity.int
getSourcesCount(RelationQuery<ContentEntityObject> request)
Count of all related sources for the entity.@NonNull List<ContentEntityObject>
getTargets(RelationQuery<ConfluenceUser> request, int start, int limit)
Fetch all related targets for the entity.int
getTargetsCount(RelationQuery<ConfluenceUser> request)
Count of all related targets for the entity.protected User2ContentRelationEntity
newRelationEntity(ConfluenceUser source, ContentEntityObject target)
int
removeAllRelations(RelatableEntity relatableEntity)
This method removes all relations (across all names and types), where given entity participates.int
removeAllRelations(Iterable<? extends RelatableEntity> relatableEntities)
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
removeAllRelationsFromCurrentAndHistoricalEntities(Iterable<? extends RelatableEntity> relatableEntities)
This method removes all relations (across all names and types), where given entity participates.int
removeAllRelationsFromEntityWithName(String relationName, RelatableEntity relatableEntity)
This method remove all relations with the given name, where the given entity participates-
Methods inherited from class com.atlassian.confluence.internal.relations.dao.hibernate.HibernateRelationDao
createRelationEntity, getRelationEntities, removeRelationEntity
-
-
-
-
Constructor Detail
-
User2ContentHibernateRelationDao
public User2ContentHibernateRelationDao(org.hibernate.SessionFactory sessionFactory, SchemaInformationService schemaInformationService)
-
-
Method Detail
-
getRelationsCount
public int getRelationsCount(ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?,?> relationDescriptor)
Description copied from interface:RelationDao
Get total number of relations for given content, type and name.relationDescriptor
- specifies relation metadata, such as type and name- Returns:
- total number of relations for given entities, relation type and name.
- See Also:
RelationDescriptor
-
getRelationEntity
public @Nullable User2ContentRelationEntity getRelationEntity(ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?,?> relationDescriptor)
Description copied from interface:RelationDao
Get relation for given content, type and name.relationDescriptor
- specifies relation metadata, such as type and name- Returns:
RelationEntity
ornull
if no relations found
-
getSources
public @NonNull List<ConfluenceUser> getSources(RelationQuery<ContentEntityObject> request, int start, int limit)
Description copied from interface:RelationDao
Fetch all related sources for the entity. Fetching parameters (relation name, filtering etc.) is provided byrequest
argument- Returns:
- list of
RelatableEntity
- See Also:
RelationQuery
-
getTargets
public @NonNull List<ContentEntityObject> getTargets(RelationQuery<ConfluenceUser> request, int start, int limit)
Description copied from interface:RelationDao
Fetch all related targets for the entity. Fetching parameters (relation name, filtering etc.) is provided byrequest
argument- Returns:
- list of
RelatableEntity
- See Also:
RelationQuery
-
getSourcesCount
public int getSourcesCount(RelationQuery<ContentEntityObject> request)
Description copied from interface:RelationDao
Count of all related sources for the entity. Fetching parameters (relation name, filtering etc.) is provided byrequest
argument- Returns:
- total number of all sources
-
getTargetsCount
public int getTargetsCount(RelationQuery<ConfluenceUser> request)
Description copied from interface:RelationDao
Count of all related targets for the entity. Fetching parameters (relation name, filtering etc.) is provided byrequest
argument- Returns:
- total number of all targets
-
removeAllRelations
public int removeAllRelations(RelatableEntity relatableEntity)
Description copied from interface:RelationDao
This method removes all relations (across all names and types), where given entity participates.- Returns:
- number of relations which were removed.
-
removeAllRelations
public int removeAllRelations(Iterable<? extends RelatableEntity> relatableEntities)
Description copied from interface:RelationDao
This method removes all relations (across all names and types), where given entity participates.- Returns:
- number of relations which were removed.
-
removeAllRelationsFromEntityWithName
public int removeAllRelationsFromEntityWithName(String relationName, RelatableEntity relatableEntity)
Description copied from interface:RelationDao
This method remove all relations with the given name, where the given entity participates- Returns:
- number of relations which were removed
-
removeAllRelationsFromCurrentAndHistoricalEntities
public int removeAllRelationsFromCurrentAndHistoricalEntities(RelatableEntity relatableEntity)
Description copied from interface:RelationDao
This method removes all relations (across all names and types), where given entity participates. It also removes all relations from the historical versions of the given entity if the entity is the most current version of content- Returns:
- number of relations which were removed.
-
removeAllRelationsFromCurrentAndHistoricalEntities
public int removeAllRelationsFromCurrentAndHistoricalEntities(Iterable<? extends RelatableEntity> relatableEntities)
Description copied from interface:RelationDao
This method removes all relations (across all names and types), where given entity participates. It also removes all relations from the historical versions of the given entity if the entity is the most current version of content- Returns:
- number of relations which were removed
-
getAllRelationIdsForContentInSpace
public List<Long> getAllRelationIdsForContentInSpace(@NonNull String spaceKey, @NonNull Collection<ConfluenceEntityObject> exclusions, int start, int limit)
This method returns ids of all content relation entities in space. It is used in export operations- Parameters:
spaceKey
- spaceexclusions
- list of exclusionsstart
- startlimit
- limit- Returns:
- list of all content relation entities in space
-
newRelationEntity
protected User2ContentRelationEntity newRelationEntity(ConfluenceUser source, ContentEntityObject target)
- Specified by:
newRelationEntity
in classHibernateRelationDao<ConfluenceUser,ContentEntityObject>
-
constructRelationEntity
protected RelationEntity<ConfluenceUser,ContentEntityObject> constructRelationEntity(RelationEntity<ConfluenceUser,ContentEntityObject> relationEntity, ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?,?> relationDescriptor)
- Overrides:
constructRelationEntity
in classHibernateRelationDao<ConfluenceUser,ContentEntityObject>
-
-