]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 package org.simantics.scl.commands;\r
2 \r
3 import org.simantics.db.RequestProcessor;\r
4 import org.simantics.db.Resource;\r
5 import org.simantics.db.exception.DatabaseException;\r
6 import org.simantics.db.procedure.Procedure;\r
7 \r
8 /**\r
9  * Command object represents a UI-operation that makes changes to the database. \r
10  * \r
11  * @author Hannu Niemistö\r
12  */\r
13 public interface Command {\r
14     /**\r
15      * Checks that parameter values satisfy conditions needed for execution of the command.\r
16      * It is not necessary to give all the parameters that are given to commit-method. In that\r
17      * case this function makes just a partial checking of the given parameters.\r
18      */\r
19     boolean check(RequestProcessor processor, Resource model, Object ... parameters) throws DatabaseException;\r
20     \r
21     /**\r
22      * Tries to execute the command.\r
23      */\r
24     Object execute(RequestProcessor processor, Resource model, Object ... parameters) throws DatabaseException;\r
25     \r
26     /**\r
27      * Tries to execute the command asynchronously.\r
28      */\r
29     void asyncExecute(RequestProcessor processor, Resource model, Object[] parameters,\r
30             Procedure<Object> procedure);\r
31 }\r