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