Examples of WGStructEntry


Examples of de.innovationgate.webgate.api.WGStructEntry

                setResultOutput(false);
                return;
            }
        } else {
            // use current context as parent for content creation
            WGStructEntry structEntry = getTMLContext().getcontent().getStructEntry();
            if (structEntry != null) {
                // check access
                if ((structEntry.mayEditChildren() == null) && contentTypeAllowed(structEntry)) {
                    TagResult result = new TagResult(getMessage(), structEntry);
                    result.setContentType(getContenttype());
                    setResult(result.toHTML());
                } else {
                    setResultOutput(false);
View Full Code Here

Examples of de.innovationgate.webgate.api.WGStructEntry

     * @throws WGAPIException
     */
    private List<WGContentKey> recurseExpressionQuery(ExpressionEngine engine, WGStructEntryList entryList, String language, String expr, boolean deep, int maxDocs, String role) throws WGAPIException {

        Iterator childEntries = entryList.iterator();
        WGStructEntry childEntry;
        WGContent childContent;
        List<WGContentKey> results = new ArrayList<WGContentKey>();
        while (childEntries.hasNext()) {
            childEntry = (WGStructEntry) childEntries.next();
            childContent = childEntry.getReleasedContent(language);
            if (childContent != null) {
               
                if (role == null || childContent.isVisibleFor(role)) {
                    ExpressionResult result = engine.evaluateExpression(expr, getTMLContextForDocument(childContent), ExpressionEngine.TYPE_EXPRESSION, null);
                    if (result.isTrue()) {
                        results.add(childContent.getContentKey());
                        if (maxDocs != 0 && results.size() >= maxDocs) {
                            break;
                        }
                    }
                   
                    if (result.isError()) {
                        addWarning("Error executing expression: " + result.getException().getClass().getName() + " - " + result.getException().getMessage());
                    }
                }
            }

            if (deep) {
                results.addAll(recurseExpressionQuery(engine, childEntry.getChildEntries(), language, expr, deep, maxDocs, role));
                if (maxDocs != 0 && results.size() >= maxDocs) {
                    break;
                }
            }
        }
View Full Code Here

Examples of de.innovationgate.webgate.api.WGStructEntry

        // Relation points to a deleted document
        catch (ObjectNotFoundException e) {
        }
       
        // If the relation is "broken" or empty we try to resolve it by using struct and language information
        WGStructEntry entry = _parent.getDb().getStructEntryByKey(relation.getTargetstructentry());
        if (entry == null) {
            return null;
        }
        WGContent content = entry.getReleasedContent(relation.getTargetlanguage());
        if (content != null) {
            return content.getCore();
        }
        else {
            return null;
View Full Code Here

Examples of de.innovationgate.webgate.api.WGStructEntry

            context.setLastError(
                    "Cannot process expression '" + getExpression() + "' on a non-content context: " + context.getdocument().getDocumentKey());
            return errorReturnContext;
        }
       
        WGStructEntry struct = content.getStructEntry();
        WGDatabase db = context.getdocument().getDatabase();
   
        if (contextExpression.equals("parent")) {
   
            if (content.isDummy()) {
                context.setLastError("Cannot retrieve parent of dummy content");
                return errorReturnContext;
            }
   
            if (struct.isRoot()) {
                context.setLastError("Cannot get parent of root document");
                return errorReturnContext;
            }
            else {
                WGContent parentContent = navigator.getParentContent(content);
View Full Code Here

Examples of de.innovationgate.webgate.api.WGStructEntry

        if (!con.hasCompleteRelationships()) {
            context.setLastError("Current content does not belong to a page hierarchy");
            return errorReturnContext;
        }
       
        WGStructEntry struct = con.getStructEntry();
        while (struct != null && struct.getLevel() > level) {
            struct = struct.getParentEntry();
        }
       
        if (struct != null) {
            WGContent targetCon = _languageChooser.selectContentForPage(struct, isBI);
            if (targetCon != null) {
                return context.getTMLContextForDocument(targetCon);
            }
            else {
                context.setLastError("Page on level " + level + " has no appropriate content document");
                return errorReturnContext;
            }
        }
        else {
            context.setLastError("Failed to go to page level " + level);
            return errorReturnContext;
        }
       
    }
    else if (contextFunction.equals("np")) {
        String namePart = UniqueNamePartFormatter.INSTANCE.format(contextExpression);
        String uname = context.content().getUniqueName();
        if (WGUtils.isEmpty(uname)) {
            uname = context.content().getStructEntry().getUniqueName();
        }
       
        String fullname;
        if (!WGUtils.isEmpty(uname)) {
            fullname = uname + "." + namePart;
        }
        else {
            fullname = namePart;
        }
       
        WGContent content = _languageChooser.selectContentForName(context.content().getDatabase(), fullname, context.isbrowserinterface());
        if (content != null) {
            return context.getTMLContextForDocument(navigator.chooseRelevantContent(content, mainContent));
        }
   
        context.setLastError("Could not retrieve content for hdb unique name " + fullname);
        return errorReturnContext;
       
    }

    // From here special functions for BI

    else if (contextFunction.equals("$struct")) {
        WGStructEntry entry = db.getStructEntryByKey(contextExpression);
        if (entry != null) {
            return context.getTMLContextForDocument(entry);
        }
        else {
            context.setLastError("Could not retrieve struct entry with key '" + contextExpression + "'");
View Full Code Here

Examples of de.innovationgate.webgate.api.WGStructEntry

            return true;
        }
       
        // Hierarchy check per base WGAPI
        if (_db.isPageReadersEnabled()) {
            WGStructEntry entry = _db.getStructEntryByKey(content.getStructentry().getKey());
            if (!entry.mayReadContent()) {
                return false;
            }
        }

        // Local check
View Full Code Here

Examples of de.innovationgate.webgate.api.WGStructEntry

                throw new HttpErrorException(java.net.HttpURLConnection.HTTP_FORBIDDEN, "This design is not allowed for direct access: " + tmlLib.getName() + " (" + tmlLib.getMediaKey() + ")", path
                        .getDatabaseKey());
            }
        }
        else {
            WGStructEntry entry = content.getStructEntry();
            if (entry == null) {
                throw new HttpErrorException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Content " + content.getContentKey().toString() + " has no struct entry", path.getDatabaseKey());
            }
            tmlLib = entry.getOuterLayout(mediaKey);
        }

        if (tmlLib == null || tmlLib.isDummy()) {
            if (path.getLayoutKey() != null) {
                throw new HttpErrorException(404, "No WebTML layout '" + path.getLayoutKey() + "' for media key '" + mediaKey + "' available in app '" + database.getDbReference() + "'", path.getDatabaseKey());
View Full Code Here

Examples of de.innovationgate.webgate.api.WGStructEntry

        id.setCompleteFormat(false);
        String completeId = id.getCompleteId();

        // Try to use key as struct key only. If found, will try to find a
        // content for this struct from the languages list
        WGStructEntry entry = null;
        Object structKey = database.parseStructKey(completeId);
        if (structKey != null) {
            entry = database.getStructEntryByKey(structKey);
            if (entry != null) {
                content = languageChooser.selectContentForPage(entry, isBI);
View Full Code Here

Examples of de.innovationgate.webgate.api.WGStructEntry

            else if (event.getEditedDocument() instanceof WGArea) {
                updateRootNames();
            }
            else if (_shortcutArea != null) {
                if (event.getEditedDocument() instanceof WGStructEntry) {
                    WGStructEntry entry = (WGStructEntry) event.getEditedDocument();
                    if (entry.isRoot() && entry.getArea().getName().equals(_shortcutArea)) {
                        updateRootNames();
                    }
                }
                else if (event.getEditedDocument() instanceof WGContent) {
                    WGContent content = (WGContent) event.getEditedDocument();
                    WGStructEntry entry = content.getStructEntry();
                    if (entry.isRoot() && entry.getArea().getName().equals(_shortcutArea)) {
                        updateRootNames();
                    }
                }
            }
        }
View Full Code Here

Examples of de.innovationgate.webgate.api.WGStructEntry

            return;
        }

        Iterator rootStructs = area.getRootEntries().iterator();
        while (rootStructs.hasNext()) {
            WGStructEntry root = (WGStructEntry) rootStructs.next();
            Iterator contents = root.getContentSet(false).getReleasedContent().values().iterator();
            while (contents.hasNext()) {
                WGContent content = (WGContent) contents.next();
                newNames.put(normalizeURLTitle(content.getTitle()) + "/" + content.getLanguage().getName(), new TitlePathRoot(content.getDocumentKeyObj()));
                newNames.put(normalizeURLTitle(content.getTitle()), new TitlePathRoot(content.getDocumentKeyObj()));
            }
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.