]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural2/src/org/simantics/structural2/queries/ConnectionPointMapOfResource.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / queries / ConnectionPointMapOfResource.java
index 2924b3dac14dea30174526ab7d141c30fac457a6..3b2e42ae77f184f9e77bd141a9eef634eb495a9f 100644 (file)
@@ -1,72 +1,72 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.structural2.queries;\r
-\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.Map;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;\r
-import org.simantics.db.common.request.TransientResourceRead;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.request.PropertyInfo;\r
-import org.simantics.db.request.RequestFlags;\r
-import org.simantics.db.service.QueryControl;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-public class ConnectionPointMapOfResource extends TransientResourceRead<Map<String, Resource>> {\r
-\r
-    private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionPointMapOfResource.class);\r
-\r
-       public ConnectionPointMapOfResource(ReadGraph graph, Resource resource) throws DatabaseException {\r
-           super(graph, resource);\r
-       }\r
-       \r
-       public ConnectionPointMapOfResource(ReadGraph graph, QueryControl qc, Resource resource) throws DatabaseException {\r
-               super(graph, qc, resource);\r
-       }\r
-\r
-       @Override\r
-       public Map<String,Resource> perform(ReadGraph graph, Resource resource) throws DatabaseException {\r
-           \r
-               Collection<Resource> predicates = graph.getPredicates(resource);\r
-               \r
-               THashMap<String,Resource> result = null;\r
-               \r
-               for(Resource predicate : predicates) {\r
-                       \r
-                       PropertyInfo info = graph.syncRequest(new PossibleConnectionPointInfo(predicate), TransientCacheAsyncListener.<PropertyInfo>instance());\r
-                       if(info != null) {\r
-                               if (result == null) result = new THashMap<String,Resource>(predicates.size());\r
-                               if (result.put(info.name, predicate) != null)\r
-                                   LOGGER.error("The database contains siblings with the same name " + info.name + " (resource=$" + resource.getResourceId() + ").");\r
-                       }                               \r
-                       \r
-               }\r
-\r
-               if(result != null) return result;\r
-               \r
-               else return Collections.emptyMap();\r
-                       \r
-       }\r
-       \r
-       @Override\r
-       public int getType() {\r
-               return RequestFlags.INVALIDATE;\r
-       }\r
-       \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.structural2.queries;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
+import org.simantics.db.common.request.TransientResourceRead;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.request.PropertyInfo;
+import org.simantics.db.request.RequestFlags;
+import org.simantics.db.service.QueryControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import gnu.trove.map.hash.THashMap;
+
+public class ConnectionPointMapOfResource extends TransientResourceRead<Map<String, Resource>> {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionPointMapOfResource.class);
+
+       public ConnectionPointMapOfResource(ReadGraph graph, Resource resource) throws DatabaseException {
+           super(graph, resource);
+       }
+       
+       public ConnectionPointMapOfResource(ReadGraph graph, QueryControl qc, Resource resource) throws DatabaseException {
+               super(graph, qc, resource);
+       }
+
+       @Override
+       public Map<String,Resource> perform(ReadGraph graph, Resource resource) throws DatabaseException {
+           
+               Collection<Resource> predicates = graph.getPredicates(resource);
+               
+               THashMap<String,Resource> result = null;
+               
+               for(Resource predicate : predicates) {
+                       
+                       PropertyInfo info = graph.syncRequest(new PossibleConnectionPointInfo(predicate), TransientCacheAsyncListener.<PropertyInfo>instance());
+                       if(info != null) {
+                               if (result == null) result = new THashMap<String,Resource>(predicates.size());
+                               if (result.put(info.name, predicate) != null)
+                                   LOGGER.error("The database contains siblings with the same name " + info.name + " (resource=$" + resource.getResourceId() + ").");
+                       }                               
+                       
+               }
+
+               if(result != null) return result;
+               
+               else return Collections.emptyMap();
+                       
+       }
+       
+       @Override
+       public int getType() {
+               return RequestFlags.INVALIDATE;
+       }
+       
+}