Class Content2ContentHibernateRelationDao
java.lang.Object
com.atlassian.confluence.internal.relations.dao.hibernate.HibernateRelationDao<ContentEntityObject,ContentEntityObject>
com.atlassian.confluence.internal.relations.dao.hibernate.Content2ContentHibernateRelationDao
- All Implemented Interfaces:
RelationDao<ContentEntityObject,
ContentEntityObject>
public class Content2ContentHibernateRelationDao
extends HibernateRelationDao<ContentEntityObject,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
ConstructorsConstructorDescriptionContent2ContentHibernateRelationDao
(org.hibernate.SessionFactory sessionFactory, SchemaInformationService schemaInformationService) -
Method Summary
Modifier and TypeMethodDescriptiongetAllRelationIdsForContentInSpace
(@NonNull String spaceKey, @NonNull Collection<ConfluenceEntityObject> exclusions, int start, int limit) This method returns ids of all content relation entities in space.@Nullable Content2ContentRelationEntity
getRelationEntity
(ContentEntityObject source, ContentEntityObject target, RelationDescriptor<?, ?> relationDescriptor) Get relation for given content, type and name.int
getRelationsCount
(ContentEntityObject source, ContentEntityObject target, RelationDescriptor<?, ?> relationDescriptor) Get total number of relations for given content, type and name.@NonNull List
<ContentEntityObject> 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<ContentEntityObject> request, int start, int limit) Fetch all related targets for the entity.int
getTargetsCount
(RelationQuery<ContentEntityObject> request) Count of all related targets for the entity.protected Content2ContentRelationEntity
newRelationEntity
(ContentEntityObject 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 participatesMethods inherited from class com.atlassian.confluence.internal.relations.dao.hibernate.HibernateRelationDao
constructRelationEntity, createRelationEntity, getRelationEntities, removeRelationEntity
-
Constructor Details
-
Content2ContentHibernateRelationDao
public Content2ContentHibernateRelationDao(org.hibernate.SessionFactory sessionFactory, SchemaInformationService schemaInformationService)
-
-
Method Details
-
getRelationsCount
public int getRelationsCount(ContentEntityObject source, ContentEntityObject target, RelationDescriptor<?, ?> relationDescriptor) Description copied from interface:RelationDao
Get total number of relations for given content, type and name.- Parameters:
source
-target
-relationDescriptor
- specifies relation metadata, such as type and name- Returns:
- total number of relations for given entities, relation type and name.
- See Also:
-
getRelationEntity
public @Nullable Content2ContentRelationEntity getRelationEntity(ContentEntityObject source, ContentEntityObject target, RelationDescriptor<?, ?> relationDescriptor) Description copied from interface:RelationDao
Get relation for given content, type and name.- Parameters:
source
-target
-relationDescriptor
- specifies relation metadata, such as type and name- Returns:
RelationEntity
ornull
if no relations found
-
getSources
public @NonNull List<ContentEntityObject> 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- Parameters:
request
-start
-limit
-- Returns:
- list of
RelatableEntity
- See Also:
-
getTargets
public @NonNull List<ContentEntityObject> getTargets(RelationQuery<ContentEntityObject> 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- Parameters:
request
-start
-limit
-- Returns:
- list of
RelatableEntity
- See Also:
-
getSourcesCount
Description copied from interface:RelationDao
Count of all related sources for the entity. Fetching parameters (relation name, filtering etc.) is provided byrequest
argument- Parameters:
request
-- Returns:
- total number of all sources
-
getTargetsCount
Description copied from interface:RelationDao
Count of all related targets for the entity. Fetching parameters (relation name, filtering etc.) is provided byrequest
argument- Parameters:
request
-- Returns:
- total number of all targets
-
removeAllRelations
Description copied from interface:RelationDao
This method removes all relations (across all names and types), where given entity participates.- Parameters:
relatableEntity
-- Returns:
- number of relations which were removed.
-
removeAllRelations
Description copied from interface:RelationDao
This method removes all relations (across all names and types), where given entity participates.- Parameters:
relatableEntities
-- 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- Parameters:
relationName
-relatableEntity
-- Returns:
- number of relations which were removed
-
removeAllRelationsFromCurrentAndHistoricalEntities
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- Parameters:
relatableEntity
-- 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- Parameters:
relatableEntities
-- 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 Content2ContentRelationEntity newRelationEntity(ContentEntityObject source, ContentEntityObject target) - Specified by:
newRelationEntity
in classHibernateRelationDao<ContentEntityObject,
ContentEntityObject>
-