]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/Command.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.commands / src / org / simantics / scl / commands / Command.java
diff --git a/bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/Command.java b/bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/Command.java
new file mode 100644 (file)
index 0000000..4ea05bc
--- /dev/null
@@ -0,0 +1,31 @@
+package org.simantics.scl.commands;\r
+\r
+import org.simantics.db.RequestProcessor;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.procedure.Procedure;\r
+\r
+/**\r
+ * Command object represents a UI-operation that makes changes to the database. \r
+ * \r
+ * @author Hannu Niemistö\r
+ */\r
+public interface Command {\r
+    /**\r
+     * Checks that parameter values satisfy conditions needed for execution of the command.\r
+     * It is not necessary to give all the parameters that are given to commit-method. In that\r
+     * case this function makes just a partial checking of the given parameters.\r
+     */\r
+    boolean check(RequestProcessor processor, Resource model, Object ... parameters) throws DatabaseException;\r
+    \r
+    /**\r
+     * Tries to execute the command.\r
+     */\r
+    Object execute(RequestProcessor processor, Resource model, Object ... parameters) throws DatabaseException;\r
+    \r
+    /**\r
+     * Tries to execute the command asynchronously.\r
+     */\r
+    void asyncExecute(RequestProcessor processor, Resource model, Object[] parameters,\r
+            Procedure<Object> procedure);\r
+}\r