Removed postfilter because polymorphism support has been added in query
This commit is contained in:
parent
7409a8d278
commit
68c742eb09
|
@ -25,7 +25,6 @@ import org.gcube.informationsystem.resourceregistry.queries.json.base.relations.
|
|||
import org.gcube.informationsystem.resourceregistry.queries.json.base.relations.JsonQueryIsRelatedTo;
|
||||
import org.gcube.informationsystem.resourceregistry.requests.RequestUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.requests.ServerRequestInfo;
|
||||
import org.gcube.informationsystem.resourceregistry.types.CachedType;
|
||||
import org.gcube.informationsystem.resourceregistry.types.TypesCache;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.OrientDBUtility;
|
||||
import org.gcube.informationsystem.utils.TypeUtility;
|
||||
|
@ -159,25 +158,22 @@ public class JsonQuery {
|
|||
JsonNode jsonNodeResult = null;
|
||||
ElementManagement<?,?> erManagement = ElementManagementUtility.getERManagement(securityContext, oDatabaseDocument,
|
||||
element);
|
||||
erManagement.setAsEntryPoint();
|
||||
jsonNodeResult = erManagement.serializeAsJsonNode();
|
||||
arrayNode.add(jsonNodeResult);
|
||||
if(limit > 0 && ++count >= limit) {
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO remove this post filter using INSTANCEOF
|
||||
// To support polymorphism we do not include = "TypeName" in query. So we need post processing filtering of results
|
||||
/*
|
||||
|
||||
// To support polymorphism we do not include @class = "TypeName" in query. So we need post processing filtering of results
|
||||
|
||||
String requestedType = entryPoint.getType();
|
||||
String gotType = erManagement.getTypeName();
|
||||
|
||||
if(requestedType.compareTo(gotType)==0) {
|
||||
erManagement.setAsEntryPoint();
|
||||
jsonNodeResult = erManagement.serializeAsJsonNode();
|
||||
arrayNode.add(jsonNodeResult);
|
||||
if(limit > 0 && ++count >= limit) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
CachedType<?> cachedType = TypesCache.getInstance().getCachedType(gotType);
|
||||
if(cachedType.getSuperTypes().contains(requestedType)) {
|
||||
|
||||
if(requestedType.compareTo(gotType)==0 || cachedType.getSuperTypes().contains(requestedType)) {
|
||||
erManagement.setAsEntryPoint();
|
||||
jsonNodeResult = erManagement.serializeAsJsonNode();
|
||||
arrayNode.add(jsonNodeResult);
|
||||
|
@ -187,6 +183,9 @@ public class JsonQuery {
|
|||
continue;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
} catch(ResourceRegistryException e) {
|
||||
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
|
||||
|
|
Loading…
Reference in New Issue