Fixes JIRA issus SGF-252 involving multiple, identically names Subregions and SDG's Repository extension improperly handling application domain objects associated by way of the @Region annotation.
This commit is contained in:
@@ -34,9 +34,11 @@ import java.lang.annotation.Target;
|
||||
public @interface Region {
|
||||
|
||||
/**
|
||||
* The name of the {@link com.gemstone.gemfire.cache.Region} the entity shall be stored in.
|
||||
*
|
||||
* @return the name of the region the entity shall be persisted in.
|
||||
* The name, or fully-qualified bean name of the {@link com.gemstone.gemfire.cache.Region} the entity
|
||||
* shall be stored in (e.g. "Users", or "/Local/Admin/Users").
|
||||
* <p/>
|
||||
* @return the name or qualified path of the Region the entity shall be persisted in.
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,9 @@ import com.gemstone.gemfire.cache.Region;
|
||||
|
||||
/**
|
||||
* Simple value object to abstract access to regions by name and mapped type.
|
||||
*
|
||||
* <p/>
|
||||
* @author Oliver Gierke
|
||||
* @author John Blum
|
||||
*/
|
||||
public class Regions implements Iterable<Region<?, ?>> {
|
||||
|
||||
@@ -52,6 +53,7 @@ public class Regions implements Iterable<Region<?, ?>> {
|
||||
|
||||
for (Region<?, ?> region : regions) {
|
||||
regionMap.put(region.getName(), region);
|
||||
regionMap.put(region.getFullPath(), region);
|
||||
}
|
||||
|
||||
this.regions = Collections.unmodifiableMap(regionMap);
|
||||
@@ -68,25 +70,23 @@ public class Regions implements Iterable<Region<?, ?>> {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> Region<?, T> getRegion(Class<T> type) {
|
||||
|
||||
Assert.notNull(type);
|
||||
|
||||
GemfirePersistentEntity<?> entity = context.getPersistentEntity(type);
|
||||
|
||||
return (Region<?, T>) (entity == null ? regions.get(type.getSimpleName()) : regions.get(entity.getRegionName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link Region} with the given name.
|
||||
*
|
||||
* @param name must not be {@literal null}.
|
||||
* @return the {@link Region} with the given name.
|
||||
* Returns the {@link Region} with the given name or path.
|
||||
* <p/>
|
||||
* @param namePath must not be {@literal null}, and either identifies the Region by name or the fully-qualified path.
|
||||
* @return the {@link Region} with the given name or path.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <S, T> Region<S, T> getRegion(String name) {
|
||||
|
||||
Assert.notNull(name);
|
||||
|
||||
return (Region<S, T>) regions.get(name);
|
||||
public <S, T> Region<S, T> getRegion(String namePath) {
|
||||
Assert.notNull(namePath);
|
||||
return (Region<S, T>) regions.get(namePath);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -98,4 +98,5 @@ public class Regions implements Iterable<Region<?, ?>> {
|
||||
public Iterator<Region<?, ?>> iterator() {
|
||||
return regions.values().iterator();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import com.gemstone.gemfire.cache.Region;
|
||||
class QueryString {
|
||||
|
||||
//private static final String REGION_PATTERN = "(?<=\\/)\\w+";
|
||||
private static final String REGION_PATTERN = "\\/\\w+";
|
||||
private static final String REGION_PATTERN = "\\/(\\/?\\w)+";
|
||||
private static final String IN_PARAMETER_PATTERN = "(?<=IN (SET|LIST) \\$)\\d";
|
||||
private static final String IN_PATTERN = "(?<=IN (SET|LIST) )\\$\\d";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user