Class PrivilegedCollectionInitializer
java.lang.Object
ch.tocco.nice2.persist.core.api.hibernate.interceptor.AbstractCollectionInitializer
ch.tocco.nice2.persist.security.impl.hibernate.interceptor.PrivilegedCollectionInitializer
- All Implemented Interfaces:
CollectionInitializer
CollectionInitializer
that optimizes the query
for the contributed entities (e.g. Email_archive).
Entities are loaded privileged and are then checked using a ListGuard
.
Even though this executes more queries it is a lot faster, because the single query
would create many large joins due to the ACL rules for the contributed entities.
-
Field Summary
Fields inherited from class ch.tocco.nice2.persist.core.api.hibernate.interceptor.AbstractCollectionInitializer
dataModel, persistService
-
Constructor Summary
ConstructorDescriptionPrivilegedCollectionInitializer
(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()
void
setSupportedModels
(List<String> supportedModels) boolean
Methods inherited from class ch.tocco.nice2.persist.core.api.hibernate.interceptor.AbstractCollectionInitializer
createQueryBuilder, doCountCollectionElements, doGetCollectionElements, modifyDefaultQuery
-
Constructor Details
-
PrivilegedCollectionInitializer
public PrivilegedCollectionInitializer(PersistenceService persistService, DataModel dataModel, SecurityManager securityManager)
-
-
Method Details
-
supports
- Returns:
- true if this
CollectionInitializer
supports resolving this 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
-
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
-
priority
- Returns:
- the priority in case multiple
CollectionInitializer
can resolve a relation
-
setSupportedModels
-