X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Futil%2FOperations.java;h=25a1bcf102d3a0176c733410b34a25e0cecfe199;hp=21911f412cfd9ef7d3fe2992f9f924a5e8f4a416;hb=HEAD;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Operations.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Operations.java index 21911f412..25a1bcf10 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Operations.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Operations.java @@ -1,27 +1,27 @@ -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 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)op); - } - -} +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 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)op); + } + +}