From e10760b08746837538ad4c2b4c37736aa34c7a47 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Thu, 18 Jun 2020 01:17:11 +0300 Subject: [PATCH] Fix non-compiling ReadGraphImpl.hasStatement implementation The commit picked from release/1.35.3-sulca wasn't directly intended for master branch. Amendment to 638ce7e010a6292fedc677de18173676db305881 --- .../db/impl/graph/ReadGraphImpl.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java index 5d4852c0d..2309af764 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java @@ -1850,40 +1850,42 @@ public class ReadGraphImpl implements AsyncReadGraph { try { - SyncReadProcedure procedure = new SyncReadProcedure(); - processor.forRelationInfo(this, relation, procedure); + RelationInfo rinfo = processor.getRelationInfo(this, relation); Collection predicates = getPredicates(subject); - - if(procedure.result.isFinal) { - + + if (rinfo.isFinal) { + return predicates.contains(relation); - - } else if (procedure.result.isFunctional) { + + } else if (rinfo.isFunctional) { try { - int result = processor.getSingleObject(this, subject, relation); - return result != 0; + return processor.getSingleObject(this, subject, relation) != 0; } catch (ManyObjectsForFunctionalRelationException e) { return true; } catch (DatabaseException e) { throw new ServiceException(e); } - + } else { - for(Resource predicate : getPredicates(subject)) { - if(isSubrelationOf(predicate, relation)) + for (Resource predicate : getPredicates(subject)) { + if (isSubrelationOf(predicate, relation)) return true; } - + } - + return false; } catch (ServiceException e) { throw new ServiceException(e); + } catch (DatabaseException e) { + + throw new ServiceException(INTERNAL_ERROR_STRING, e); + } } -- 2.43.2