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, RELATION_PARAM_NAME, sessionFactory, SOURCE_PARAM_NAME, TARGET_PARAM_NAME -
Constructor Summary
ConstructorsConstructorDescriptionUser2ContentHibernateRelationDao(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory, SchemaInformationService schemaInformationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected RelationEntity<ConfluenceUser, ContentEntityObject> constructRelationEntity(RelationEntity<ConfluenceUser, ContentEntityObject> relationEntity, ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?, ?> relationDescriptor) getAllRelationIdsForContentInSpace(@NonNull String spaceKey, @NonNull Collection<ConfluenceEntityObject> exclusions, int start, int limit) This method returns ids of all content relation entities in space.@Nullable User2ContentRelationEntitygetRelationEntity(ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?, ?> relationDescriptor) Get relation for given content, type and name.intgetRelationsCount(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.intgetSourcesCount(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.intgetTargetsCount(RelationQuery<ConfluenceUser> request) Count of all related targets for the entity.protected User2ContentRelationEntitynewRelationEntity(ConfluenceUser source, ContentEntityObject target) intremoveAllRelations(RelatableEntity relatableEntity) This method removes all relations (across all names and types), where given entity participates.intremoveAllRelations(Iterable<? extends RelatableEntity> relatableEntities) This method removes all relations (across all names and types), where given entity participates.intremoveAllRelationsFromCurrentAndHistoricalEntities(RelatableEntity relatableEntity) This method removes all relations (across all names and types), where given entity participates.intremoveAllRelationsFromCurrentAndHistoricalEntities(Iterable<? extends RelatableEntity> relatableEntities) This method removes all relations (across all names and types), where given entity participates.intremoveAllRelationsFromEntityWithName(String relationName, RelatableEntity relatableEntity) This method remove all relations with the given name, where the given entity participatesintupdateDraftPageLastModTime(ContentEntityObject content, Date lastModificationDate, Date lastModificationDateForDraft) This method update the last modification time for the content given in the parameter If a "touched" relation is newer than the draft last modification date, it will be updatedintupdateTargetTypeForContents(List<ContentEntityObject> contents, RelatableEntityTypeEnum targetType) This method update the target type for contentsMethods inherited from class com.atlassian.confluence.internal.relations.dao.hibernate.HibernateRelationDao
createRelationEntity, getRelationEntities, removeRelationEntity
-
Constructor Details
-
User2ContentHibernateRelationDao
public User2ContentHibernateRelationDao(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory, SchemaInformationService schemaInformationService)
-
-
Method Details
-
getRelationsCount
public int getRelationsCount(ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?, ?> relationDescriptor) Description copied from interface:RelationDaoGet 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 User2ContentRelationEntity getRelationEntity(ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?, ?> relationDescriptor) Description copied from interface:RelationDaoGet relation for given content, type and name.- Parameters:
source-target-relationDescriptor- specifies relation metadata, such as type and name- Returns:
RelationEntityornullif no relations found
-
getSources
public @NonNull List<ConfluenceUser> getSources(RelationQuery<ContentEntityObject> request, int start, int limit) Description copied from interface:RelationDaoFetch all related sources for the entity. Fetching parameters (relation name, filtering etc.) is provided byrequestargument- Parameters:
request-start-limit-- Returns:
- list of
RelatableEntity - See Also:
-
getTargets
public @NonNull List<ContentEntityObject> getTargets(RelationQuery<ConfluenceUser> request, int start, int limit) Description copied from interface:RelationDaoFetch all related targets for the entity. Fetching parameters (relation name, filtering etc.) is provided byrequestargument- Parameters:
request-start-limit-- Returns:
- list of
RelatableEntity - See Also:
-
getSourcesCount
Description copied from interface:RelationDaoCount of all related sources for the entity. Fetching parameters (relation name, filtering etc.) is provided byrequestargument- Parameters:
request-- Returns:
- total number of all sources
-
getTargetsCount
Description copied from interface:RelationDaoCount of all related targets for the entity. Fetching parameters (relation name, filtering etc.) is provided byrequestargument- Parameters:
request-- Returns:
- total number of all targets
-
removeAllRelations
Description copied from interface:RelationDaoThis method removes all relations (across all names and types), where given entity participates.- Parameters:
relatableEntity-- Returns:
- number of relations which were removed.
-
updateDraftPageLastModTime
public int updateDraftPageLastModTime(ContentEntityObject content, Date lastModificationDate, Date lastModificationDateForDraft) This method update the last modification time for the content given in the parameter If a "touched" relation is newer than the draft last modification date, it will be updated- Parameters:
content- content to be updatedlastModificationDate- last modification date value to be updatedlastModificationDateForDraft- last modification date value for draft- Returns:
- updated row count
-
updateTargetTypeForContents
public int updateTargetTypeForContents(List<ContentEntityObject> contents, RelatableEntityTypeEnum targetType) This method update the target type for contents- Parameters:
contents- List of content whose targettype needs to be updatedtargetType- Target type to be updated- Returns:
- updated row count
-
removeAllRelations
Description copied from interface:RelationDaoThis 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:RelationDaoThis 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:RelationDaoThis 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:RelationDaoThis 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 User2ContentRelationEntity newRelationEntity(ConfluenceUser source, ContentEntityObject target) - Specified by:
newRelationEntityin classHibernateRelationDao<ConfluenceUser,ContentEntityObject>
-
constructRelationEntity
protected RelationEntity<ConfluenceUser,ContentEntityObject> constructRelationEntity(RelationEntity<ConfluenceUser, ContentEntityObject> relationEntity, ConfluenceUser source, ContentEntityObject target, RelationDescriptor<?, ?> relationDescriptor) - Overrides:
constructRelationEntityin classHibernateRelationDao<ConfluenceUser,ContentEntityObject>
-