package org.simantics.document.server.request;
import org.simantics.db.ReadGraph;
+import org.simantics.db.common.request.UnaryRead;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.layer0.variable.Variable;
import org.simantics.db.layer0.variable.Variables;
-import org.simantics.db.request.Read;
import org.simantics.document.server.handler.AbstractEventHandler;
import org.simantics.structural.stubs.StructuralResource2;
-public class HandleEventRequest implements Read<AbstractEventHandler> {
-
- final String id;
+public class HandleEventRequest extends UnaryRead<String, AbstractEventHandler> {
public HandleEventRequest(String id) {
- this.id = id;
+ super(id);
}
@Override
StructuralResource2.getInstance(graph);
- Variable variable = Variables.getPossibleVariable(graph, id);
+ Variable variable = Variables.getPossibleVariable(graph, parameter);
if(variable == null) return null;
// System.err.println("EVENT " + variable.getURI(graph));
if(handler instanceof AbstractEventHandler)
return (AbstractEventHandler) handler;
else
- throw new DatabaseException("Handler for " + id + " is not instance of AbstractEventHandler (it is instance of " + (handler != null ? handler.getClass() : null) + ")");
+ throw new DatabaseException("Handler for " + parameter + " is not instance of AbstractEventHandler (it is instance of " + (handler != null ? handler.getClass() : null) + ")");
}
}
\ No newline at end of file