]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.common/src/org/simantics/db/common/primitiverequest/IsExternalEntity.java
Added preference for Import dependencies in generic model import/export
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / primitiverequest / IsExternalEntity.java
diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/primitiverequest/IsExternalEntity.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/primitiverequest/IsExternalEntity.java
new file mode 100644 (file)
index 0000000..3ac3a5f
--- /dev/null
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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:
+ *     Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.db.common.primitiverequest;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.ResourceRead;
+import org.simantics.db.exception.ServiceException;
+import org.simantics.layer0.Layer0;
+
+/**
+ * @author Tuukka Lehtonen
+ * @since 1.31.0
+ */
+public final class IsExternalEntity extends ResourceRead<Boolean> {
+
+    public IsExternalEntity(Resource resource) {
+        super(resource);
+    }
+
+    @Override
+    public Boolean perform(ReadGraph graph) throws ServiceException {
+        return graph.isInstanceOf(resource, Layer0.getInstance(graph).ExternalEntity);
+    }
+
+}