use of org.infinispan.hibernate.cache.v53.impl.DomainDataRegionImpl in project infinispan by infinispan.
the class TestSessionAccessImpl method collectionAccess.
@Override
public Object collectionAccess(InfinispanBaseRegion region, AccessType accessType) {
DomainDataRegionImpl impl = (DomainDataRegionImpl) region;
NavigableRole role = impl.config().getCollectionCaching().stream().filter(c -> c.getAccessType() == accessType).map(DomainDataCachingConfig::getNavigableRole).findFirst().orElseThrow(() -> new IllegalArgumentException());
return impl.getCollectionDataAccess(role);
}
use of org.infinispan.hibernate.cache.v53.impl.DomainDataRegionImpl in project infinispan by infinispan.
the class TestSessionAccessImpl method entityAccess.
@Override
public Object entityAccess(InfinispanBaseRegion region, AccessType accessType) {
DomainDataRegionImpl impl = (DomainDataRegionImpl) region;
NavigableRole role = impl.config().getEntityCaching().stream().filter(c -> c.getAccessType() == accessType).map(DomainDataCachingConfig::getNavigableRole).findFirst().orElseThrow(() -> new IllegalArgumentException());
return impl.getEntityDataAccess(role);
}
use of org.infinispan.hibernate.cache.v53.impl.DomainDataRegionImpl in project infinispan by infinispan.
the class InfinispanRegionFactory method buildDomainDataRegion.
@Override
public DomainDataRegion buildDomainDataRegion(DomainDataRegionConfig regionConfig, DomainDataRegionBuildingContext buildingContext) {
log.debugf("Building domain data region [%s] entities=%s collections=%s naturalIds=%s", regionConfig.getRegionName(), regionConfig.getEntityCaching(), regionConfig.getCollectionCaching(), regionConfig.getNaturalIdCaching());
// TODO: data type is probably deprecated, but we need it for backwards-compatible configuration
DataType dataType;
int entities = regionConfig.getEntityCaching().size();
int collections = regionConfig.getCollectionCaching().size();
int naturalIds = regionConfig.getNaturalIdCaching().size();
if (entities > 0 && collections == 0 && naturalIds == 0) {
dataType = regionConfig.getEntityCaching().stream().allMatch(c -> !c.isMutable()) ? DataType.IMMUTABLE_ENTITY : DataType.ENTITY;
} else if (entities == 0 && collections > 0 && naturalIds == 0) {
dataType = DataType.COLLECTION;
} else if (entities == 0 && collections == 0 && naturalIds > 0) {
dataType = DataType.NATURAL_ID;
} else {
// some mix, let's use entity
dataType = DataType.ENTITY;
}
AdvancedCache cache = getCache(qualify(regionConfig.getRegionName()), regionConfig.getRegionName(), dataType, Collections.emptyList());
DomainDataRegionImpl region = new DomainDataRegionImpl(cache, regionConfig, this, getCacheKeysFactory());
startRegion(region);
return region;
}
Aggregations