Examples of TMLContext


Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

           
            Arguments varargs = _scopedVarargs.parse(args);
           
            String str = (String) varargs.get("value");
           
            TMLContext context = fetchInitialContext(cx);
            if (varargs.has("scope")) {
                String scope = (String) varargs.get("scope");
                return context.getScopedString(str, scope);
            }
            else {
                if (!context.iswebenvironment()) {
                    return str;
                }
                return context.gettag().getScopedString(str);
            }
           
        }
        catch (Exception e) {
            throw new WrappedException(e);
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

        if (arg1 instanceof Wrapper) {
            arg1 = ((Wrapper) arg1).unwrap();
        }
       
        if (arg1 instanceof String) {
            TMLContext con = fetchInitialContext(Context.getCurrentContext());
            WGAPlugin plugin = con.getwgacore().getPluginSet().getPluginByUniqueName((String) arg1);
            if (plugin == null || !plugin.isActive() || !plugin.isValid()) {
                return null;
            }
            WGDatabase db = con.db(plugin.buildDatabaseKey());
            if (db != null) {
                return new Plugin(db);
            }
            else {
                return null;
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

       
    }
   
    public static Lucene lucene(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj) {
       
        TMLContext tmlCx;
        if (args.length == 0) {
            tmlCx = fetchInitialContext(cx);
        }
        else if (args.length == 1) {
           
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

        _master.setParentScope(m);
    }
   
    public static URLBuilder urlBuilder(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj) throws JavaScriptException, FormattingException, WGAPIException, MalformedURLException, UnsupportedEncodingException {
       
        TMLContext tmlContext = fetchInitialContext(cx);
       
        URL wgaUrl = new URL((String) tmlContext.meta("request", "absolutewgaurl"));
        String baseURL;
        if (args.length >= 1) {
            baseURL = String.valueOf(args[0]);
        }
        else {
            baseURL = (String) tmlContext.meta("request", "url");
        }
       
        URL url = new URL(wgaUrl, baseURL);
        return new URLBuilder(tmlContext, url);
       
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

       
    }
   
    public static void redirectTo(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj) throws JavaScriptException, FormattingException, WGAPIException, IOException {
   
        TMLContext tmlContext = fetchInitialContext(cx);
        if (args.length < 1) {
            throw new EvaluatorException("Method WGA.redirectTo() needs a string parameter");
        }
       
        Object arg = args[0];
        if (arg instanceof Wrapper) {
            arg = ((Wrapper) arg).unwrap();
        }
       
        String url = String.valueOf(arg);
        tmlContext.redirectto(url);
   
    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

       
        Arguments parsedArgs = _buildOptionsVarargs.parse(args);
       
        Iterable<WGContent> contents = (Iterable<WGContent>) parsedArgs.get("contents");
        String titleExpr = (String) parsedArgs.get("title");
        TMLContext context = fetchInitialContext(cx);
        RhinoExpressionEngineImpl runtime = fetchRuntime(cx);
       
        List<String> options = new ArrayList<String>();
        if (parsedArgs.has("emptyTitle")) {
            options.add(String.valueOf(parsedArgs.get("emptyTitle")) + "|" + TMLForm.RELATION_NULLPLACE_HOLDER);
        }
       
        for (WGContent content : contents) {
            String title = content.getTitle();
            if (titleExpr != null) {
                TMLContext conContext = context.context(content);
                ExpressionResult result = runtime.evaluateExpression(titleExpr, conContext, ExpressionEngine.TYPE_EXPRESSION, null);
                if (!result.isError()) {
                    title = String.valueOf(result.getResult());
                }
            }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

        try {
            RhinoExpressionEngineImpl runtime = WGAGlobal.fetchRuntime(cx);
            VarArgParser.Arguments parsedArgs = _runMasterFunctionVarargs.parse(args);
           
            Function function = (Function) parsedArgs.get("function");
            TMLContext context = (TMLContext) parsedArgs.get("context");
            if (context == null) {
                context = WGAGlobal.fetchInitialContext(Context.getCurrentContext());
            }
           
            Object returnValue = runtime.runAsMaster(function, context, parsedArgs.getOverflowArgs().toArray());
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

            return module;
        }
    }
   
    private TMLContext retrieveContext(WGContent content, Map<String,Object> params) throws WGAPIException, TMLException {
         TMLContext context = new TMLContext(content, _core, null, null);
         TMLContext threadMainContext = TMLContext.getThreadMainContext();
         if (threadMainContext != null) {
             context.importEnvironmentData(threadMainContext);
         }             
         context.setvar("params", params);
         return context;     
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

       
        if (ref instanceof Wrapper) {
            ref = ((Wrapper) ref).unwrap();
        }
       
        TMLContext tmlContext = WGAGlobal.fetchInitialContext(Context.getCurrentContext());
        if (ref == null) {
            _designContext = tmlContext.getDesignContext();
            _currentAction = WGAGlobal.currentAction(Context.getCurrentContext(), null);
            _isCurrentScriptDesign = true;
        }
        else if (ref instanceof WGDatabase) {
            _designContext = tmlContext.getDesignContext().createContextDelegate((WGDatabase) ref, null);
        }
        else if (ref instanceof String) {
            WGDatabase designDB = tmlContext.db((String) ref);
            if (designDB != null && designDB.isSessionOpen()) {
                _designContext = tmlContext.getDesignContext().createContextDelegate((WGDatabase) designDB, null);
            }
        }
        else if (ref instanceof NativeObject) {
            _currentObject  = (NativeObject) ref;
            _currentAction = WGAGlobal.currentAction(Context.getCurrentContext(), _currentObject);
            if (_currentAction == null) {
                throw new IllegalArgumentException("Cannot determine design of parameter object");
            }

            String dbKey = _currentAction.getModuleDatabase();
            WGDatabase designDB = tmlContext.db(dbKey);       
            if (designDB != null && designDB.isSessionOpen()) {
                _designContext = tmlContext.getDesignContext().createContextDelegate((WGDatabase) designDB, null);
            }
        }
        else {
            throw new IllegalArgumentException("Invalid parameter object type " + ref.getClass().getName());           
        }
View Full Code Here

Examples of de.innovationgate.wgpublisher.webtml.utils.TMLContext

        Design design = unwrapThisObj(thisObj);
       
        Arguments arguments = _getGlobalArgs.parse(args);
       
        TMLContext context = WGAGlobal.fetchInitialContext(cx);
        TMLScriptGlobal global =  context.getwgacore().getTmlscriptGlobalRegistry().getGlobal((String) arguments.get("global"), design._designContext.getDesignDB());
        if (global != null) {
            return TMLScriptRootScope.provideGlobal(global, thisObj);
        }
        else {
            return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.