]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fix non-compiling ReadGraphImpl.hasStatement implementation
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 17 Jun 2020 22:17:11 +0000 (01:17 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 17 Jun 2020 22:17:11 +0000 (01:17 +0300)
The commit picked from release/1.35.3-sulca wasn't directly intended for
master branch.

Amendment to 638ce7e010a6292fedc677de18173676db305881

bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java

index 5d4852c0d7822efe1f88ef70a1a7eb6a941cb272..2309af76440b10bc2a3e9d336cf2fc4bdfc14819 100644 (file)
@@ -1850,40 +1850,42 @@ public class ReadGraphImpl implements AsyncReadGraph {
 
                try {
 
-                       SyncReadProcedure<RelationInfo> procedure = new SyncReadProcedure<RelationInfo>();
-                       processor.forRelationInfo(this, relation, procedure);
+                       RelationInfo rinfo = processor.getRelationInfo(this, relation);
                        Collection<Resource> 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);
+
                } 
                
        }