-package org.simantics.db.layer0.util;\r
-\r
-import org.simantics.db.RequestProcessor;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.AdaptValue;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.exception.OperationNotAllowedException;\r
-import org.simantics.db.request.WriteResult;\r
-import org.simantics.scl.runtime.function.Function;\r
-\r
-public class Operations {\r
-\r
- public static boolean isAllowed(RequestProcessor rp, Resource operation) throws DatabaseException {\r
- return true;\r
- }\r
- \r
- public static <T> T exec(RequestProcessor rp, \r
- Resource operation, Object ... parameters) throws DatabaseException, OperationNotAllowedException {\r
- if(!isAllowed(rp, operation))\r
- throw new OperationNotAllowedException();\r
- Object op = rp.syncRequest(new AdaptValue(operation));\r
- if(parameters.length > 0)\r
- op = ((Function)op).applyArray(parameters);\r
- return rp.syncRequest((WriteResult<T>)op);\r
- }\r
- \r
-}\r
+package org.simantics.db.layer0.util;
+
+import org.simantics.db.RequestProcessor;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.AdaptValue;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.exception.OperationNotAllowedException;
+import org.simantics.db.request.WriteResult;
+import org.simantics.scl.runtime.function.Function;
+
+public class Operations {
+
+ public static boolean isAllowed(RequestProcessor rp, Resource operation) throws DatabaseException {
+ return true;
+ }
+
+ public static <T> T exec(RequestProcessor rp,
+ Resource operation, Object ... parameters) throws DatabaseException, OperationNotAllowedException {
+ if(!isAllowed(rp, operation))
+ throw new OperationNotAllowedException();
+ Object op = rp.syncRequest(new AdaptValue(operation));
+ if(parameters.length > 0)
+ op = ((Function)op).applyArray(parameters);
+ return rp.syncRequest((WriteResult<T>)op);
+ }
+
+}