You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
package core.operation;
|
|
|
|
|
|
import core.operation.utils.Utils;
|
|
import core.user.User;
|
|
import error.GExcptFormat;
|
|
import gdms.Mode;
|
|
|
|
import java.util.Map;
|
|
|
|
public abstract class Operation {
|
|
|
|
private Map<String, Object> options;
|
|
private User subject;
|
|
Operation(){
|
|
super();
|
|
}
|
|
|
|
public abstract Map<String, Object> execute(User subject) throws Exception;
|
|
public void setSubject(User subject) {
|
|
this.subject = subject;
|
|
}
|
|
public User getSubject() {
|
|
return subject;
|
|
}
|
|
public Map<String, Object> getOptions() {
|
|
return options;
|
|
}
|
|
public void setOptions(String options) throws GExcptFormat {
|
|
this.options = Utils.string2MapOptions(options);
|
|
}
|
|
public void addOptions(String key, Object value){
|
|
if ( Mode.strict == 1){
|
|
if(!this.options.containsKey(key)) {
|
|
try {
|
|
throw new Exception("options repeat");
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
this.options.put(key,value);
|
|
}
|
|
public void setOptions(Map<String, Object> options) {
|
|
this.options = options;
|
|
}
|
|
}
|