Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGLanguage


       
        // Check if we are allowed to edit any language
        Iterator langs = getTMLContext().db().getLanguages().values().iterator();
        boolean langFound = false;
        while (langs.hasNext()) {
            WGLanguage lang = (WGLanguage) langs.next();
            if (lang.mayCreateContent()) {
                langFound = true;
                break;
            }
        }
        if (langFound == false) {
View Full Code Here


            // Contextless request. If we have no request language we have no complete path and we must determine a language
            else {
                if (requestLanguage == null) {
                    completePath = false;
                    LanguageBehaviour langBehaviour = LanguageBehaviourTools.retrieve(database);
                    WGLanguage lang = langBehaviour.requestSelectDatabaseLanguage(database, request);
                    if (lang != null) {
                        this.requestLanguage = lang.getName();
                    }
                   
                    // Fallback to the database default language
                    else {
                        this.requestLanguage = database.getDefaultLanguage();
View Full Code Here

            if (!_explicitLanguageChoice) {
                return context;
            }
   
            if (content.isDummy()) {
                WGLanguage lang = _languageChooser.selectDatabaseLanguage(db);
                if (lang != null) {
                    return context.getTMLContextForDocument(db.getDummyContent(lang.getName()));
                }
                else {
                    return errorReturnContext;
                }
            }
View Full Code Here

            return errorReturnContext;
        }
    }

    else if (contextFunction.equals("$language")) {
        WGLanguage language = db.getLanguage(contextExpression);
        if (language != null) {
            return context.getTMLContextForDocument(language);
        }
        else {
            context.setLastError("Could not retrieve language with name '" + contextExpression + "'");
View Full Code Here

        }
    }

    public static WGContent getContentByAnyKey(URLID id, WGDatabase database, WGLanguageChooser languageChooser, boolean isBI) throws WGAPIException {

        WGLanguage langObj;
        // Block with various attempts to search content by this key
        WGContent content = null;

        // Try to retrieve content via content key - Fastest way
        WGContentKey key = id.asContentKey();
View Full Code Here

                if (!content.isVisible() && !isBrowserInterface(request.getSession())) {
                    throw new HttpErrorException(404, "No content of name/id " + contentKey, path.getDatabaseKey());
                }
            }
            else {
                WGLanguage lang = langBehaviour.requestSelectDatabaseLanguage(database, request);
                content = database.getDummyContent(lang.getName());
            }

            // Test browsability of content
            if (!content.isDummy() && getBrowsingSecurity(database) <= BrowsingSecurity.NO_BROWSING) {
                throw new HttpErrorException(java.net.HttpURLConnection.HTTP_FORBIDDEN, "Browsing not allowed in database '" + path.getDatabaseKey() + "'", path.getDatabaseKey());
View Full Code Here

        WGPDispatcher.URLID urlid = new WGPDispatcher.URLID(lastElement, _db);
        if (urlid.getSuffix() == null || _core.getMediaKey(urlid.getSuffix()) == null) {
            return null;
        }
        if (urlid.isCompleteFormat()) {
            WGLanguage lang = _db.getLanguage(urlid.getLanguage());
            if (lang == null) {
                urlid.setCompleteFormat(false);
            }
        }
View Full Code Here

       
        try {
            WGDatabase targetDB = context.db(designdbKey);
            if (targetDB != null && targetDB.isSessionOpen()) {
                LanguageBehaviour langBehaviour = LanguageBehaviourTools.retrieve(targetDB);
                WGLanguage lang = langBehaviour.webtmlSelectDatabaseLanguage(targetDB, context);
                if (lang != null) {
                    targetLanguage = lang.getName();
                }
            }
        }
        catch (WGException e) {
            context.getlog().error("Exception determining target language for layout URL", e);
View Full Code Here

   
        List<WGLanguage> langs = new ArrayList<WGLanguage>();
        Iterator keys = langKeys.iterator();
        while (keys.hasNext()) {
            String key = (String) keys.next();
            WGLanguage lang  = database.getLanguage(key);
            if (lang != null) {
                langs.add(lang);
            }
        }
       
View Full Code Here

    public DateFormat getDateFormat(String pattern) {
       
        // Select language for language dependent date formats
        Locale locale = null;
        WGLanguageChooser chooser = new WebTMLLanguageChooser(db(), this);
        WGLanguage lang = null;
        try {
            lang = chooser.selectDatabaseLanguage(db());
            if (lang != null) {
                locale = lang.getLocale();
            }
        }
        catch (WGAPIException e) {
            getlog().error("Exception selecting language for date format", e);
        }
View Full Code Here

TOP

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

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.