Package ch.tocco.nice2.dms.impl.security
Class NodeChildrenCollectionInitializer
java.lang.Object
ch.tocco.nice2.persist.core.api.hibernate.interceptor.AbstractCollectionInitializer
ch.tocco.nice2.dms.impl.security.NodeChildrenCollectionInitializer
- All Implemented Interfaces:
CollectionInitializer
A custom
CollectionInitializer
that initializes the sub resources of a folder.
It resolves the primary keys of the relation in privileged mode first and sets the result as
the upper bound of the unprivileged query using the QueryHints.QUERY_BY_KEYS
hint.
This hint allows the PermissionMatrixEvaluationService
to optimize a subquery which results
in much better performance.- See Also:
-
Field Summary
Fields inherited from class ch.tocco.nice2.persist.core.api.hibernate.interceptor.AbstractCollectionInitializer
dataModel, persistService
-
Constructor Summary
ConstructorDescriptionNodeChildrenCollectionInitializer
(PersistenceService persistService, DataModel dataModel, SecurityManager securityManager) -
Method Summary
Modifier and TypeMethodDescriptionlong
countCollectionElements
(jakarta.persistence.metamodel.EntityType<?> entityType, jakarta.persistence.metamodel.Attribute<?, ?> collection, Serializable id) List
<?> getCollectionElements
(jakarta.persistence.metamodel.EntityType<?> entityType, jakarta.persistence.metamodel.Attribute<?, ?> collection, Serializable id, Pagination pagination, @Nullable Ordering ordering) priority()
boolean
Methods inherited from class ch.tocco.nice2.persist.core.api.hibernate.interceptor.AbstractCollectionInitializer
createQueryBuilder, doCountCollectionElements, doGetCollectionElements, modifyDefaultQuery
-
Constructor Details
-
NodeChildrenCollectionInitializer
public NodeChildrenCollectionInitializer(PersistenceService persistService, DataModel dataModel, SecurityManager securityManager)
-
-
Method Details
-
getCollectionElements
public List<?> getCollectionElements(jakarta.persistence.metamodel.EntityType<?> entityType, jakarta.persistence.metamodel.Attribute<?, ?> collection, Serializable id, Pagination pagination, @Nullable @Nullable Ordering ordering) - Specified by:
getCollectionElements
in interfaceCollectionInitializer
- Overrides:
getCollectionElements
in classAbstractCollectionInitializer
- Returns:
- the collection elements of a specific relation
-
countCollectionElements
public long countCollectionElements(jakarta.persistence.metamodel.EntityType<?> entityType, jakarta.persistence.metamodel.Attribute<?, ?> collection, Serializable id) - Specified by:
countCollectionElements
in interfaceCollectionInitializer
- Overrides:
countCollectionElements
in classAbstractCollectionInitializer
- Returns:
- the number of persisted collection elements
-
supports
- Returns:
- true if this
CollectionInitializer
supports resolving this relation
-
priority
- Returns:
- the priority in case multiple
CollectionInitializer
can resolve a relation
-