Interface RelationDao<S extends RelatableEntity,T extends RelatableEntity>
- All Known Implementing Classes:
Content2ContentHibernateRelationDao
,HibernateRelationDao
,User2ContentHibernateRelationDao
,User2UserHibernateRelationDao
public interface RelationDao<S extends RelatableEntity,T extends RelatableEntity>
Relation dao interface.
- Since:
- 5.9
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncreateRelationEntity
(S source, T target, RelationDescriptor<?, ?> relationDescriptor) Create new relation.@Nullable RelationEntity<S,
T> getRelationEntity
(S source, T target, RelationDescriptor<?, ?> relationDescriptor) Get relation for given content, type and name.int
getRelationsCount
(S source, T target, RelationDescriptor<?, ?> relationDescriptor) Get total number of relations for given content, type and name.getSources
(RelationQuery<T> request, int start, int limit) Fetch all related sources for the entity.int
getSourcesCount
(RelationQuery<T> request) Count of all related sources for the entity.getTargets
(RelationQuery<S> request, int start, int limit) Fetch all related targets for the entity.int
getTargetsCount
(RelationQuery<S> request) Count of all related targets for the entity.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 participatesvoid
removeRelationEntity
(RelationEntity<S, T> relationEntity) Remove relation
-
Method Details
-
getRelationsCount
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:
-
createRelationEntity
RelationEntity<S,T> createRelationEntity(S source, T target, RelationDescriptor<?, ?> relationDescriptor) Create new relation. and saves it to the database- Parameters:
source
-target
-relationDescriptor
- specifies relation metadata, such as type and name- See Also:
-
removeRelationEntity
Remove relation- Parameters:
relationEntity
-- See Also:
-
getRelationEntity
@Nullable RelationEntity<S,T> getRelationEntity(S source, T target, RelationDescriptor<?, ?> relationDescriptor) 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
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
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
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
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
This method removes all relations (across all names and types), where given entity participates.- Parameters:
relatableEntity
-- Returns:
- number of relations which were removed.
-
removeAllRelations
This method removes all relations (across all names and types), where given entity participates.- Parameters:
relatableEntities
-- Returns:
- number of relations which were removed.
- Since:
- 6.12.0
-
removeAllRelationsFromEntityWithName
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
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
int removeAllRelationsFromCurrentAndHistoricalEntities(Iterable<? extends RelatableEntity> relatableEntities) 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
- Since:
- 6.12.0
-