Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGException


                        groupStructEntries = area.getRootEntries();
                    }
                }
   
                if (groupStructEntries == null) {
                    throw new WGException("Root doc name '" + _groupsRootDoc + "' is neither the unique name of a content nor an area name. Please check if the default language " + db.getDefaultLanguage() + " of this database matches the language of group documents.");
                }
   
                // Recurse through group docs
                Iterator structsIt = groupStructEntries.iterator();
                while (structsIt.hasNext()) {
                    recurseGroupDocuments((WGStructEntry) structsIt.next(), groupMembership, newGroupInformation);
                }
            }

            // Collect user struct entries {
            WGStructEntryList structEntries = null;
            WGContent rootContent = db.getContentByName(_userRootDoc);
            if (rootContent != null) {
                structEntries = rootContent.getStructEntry().getChildEntries();
            }

            if (structEntries == null) {
                WGArea area = db.getArea(_userRootDoc);
                if (area != null) {
                    structEntries = area.getRootEntries();
                }
            }

            if (structEntries == null) {
                throw new WGException("Root doc name '" + _userRootDoc + "' is neither the unique name of a content nor an area name. Please check if the default language " + db.getDefaultLanguage() + " of this database matches the language of user documents.");
            }

            // Recurse through user docs
            Iterator structsIt = structEntries.iterator();
            while (structsIt.hasNext()) {
View Full Code Here


            Set newGroupInformation = new HashSet();

            // Get collect script
            WGCSSJSModule mod = db.getCSSJSModule(_scriptCollect, WGScriptModule.CODETYPE_TMLSCRIPT);
            if (mod == null) {
                throw new WGException("Database '" + _dbkey + "' does not contain a TMLScript module of name '" + _scriptCollect + "'");
            }

            if (!mod.getCodeType().equals(WGCSSJSModule.CODETYPE_TMLSCRIPT)) {
                throw new WGException("Script module '" + _scriptCollect + "' in Database '" + _dbkey + "' is not of type TMLScript");
            }

            // Build a TMLScript runtime
            ExpressionEngine engine = ExpressionEngineFactory.getTMLScriptEngine();
            TMLContext context = new TMLContext(db.getDummyContent(db.getDefaultLanguage()), _core, null, null);
            Map objects = new HashMap();
            objects.put("logins", newLoginInformation);
            objects.put("groups", newGroupInformation);

            // Execute script
            ExpressionResult result = engine.evaluateExpression(mod.getCode(), context, ExpressionEngine.TYPE_SCRIPT, objects);
            if (result.isError()) {
                throw new WGException("Error executing collect script", result.getException());
            }

            _loginInformation =  newLoginInformation;
            _groupInformation = newGroupInformation;
View Full Code Here

    }
   
    private WGCSSJSModule retrieveModule(TMLContext context) throws WGException {
        WGDatabase db = context.db(getModuleDatabase());
        if (db == null) {
            throw new WGException("Database " + getModuleDatabase() + " not found");
        }
       
        if (!db.isSessionOpen()) {
            throw new WGException("User has no access to database " + getModuleDatabase());
        }
       
        WGCSSJSModule mod = db.getCSSJSModule(getModuleName(), WGScriptModule.CODETYPE_TMLSCRIPT);
        // Module not available or was deleted. We just return null.
        if (mod == null) {
            return null;
        }
       
        if (!mod.getCodeType().equals(WGCSSJSModule.CODETYPE_TMLSCRIPT)) {
            throw new WGException("Script module '" + getModuleName() + "' in database " + getModuleDatabase() + " is no TMLScript module");
        }
        return mod;
    }
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.WGException

Copyright © 2018 www.massapicom. 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.