Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGDocument


        }
    }

    public void databaseUpdate(WGDatabaseEvent event) {
        try {
            WGDocument doc = event.getEditedDocument();
            if (doc != null) {
                if (doc instanceof WGFileContainer) {
                    WGFileContainer con = (WGFileContainer) doc;
                    if (con.getName().equals("system")) {
                        checkForUpdates(event.getDatabase());
View Full Code Here


            return _form.getEnteredOrParsedValues(fieldname);
        }
       
        // retrieve fieldvalue from source
        if (source.equals("content")) {
            WGDocument doc = _context.getdocument();
            return FormBase.getFieldValue(doc, _context, _form.getforminfo(), fieldname, meta, defaultvalue, useRelation);           
        } else if (source.equals("profile")) {
            TMLUserProfile profile = _context.getprofile();
            return FormBase.getFieldValue(profile,  _context, _form.getforminfo(), fieldname, meta, defaultvalue);
        } else if (source.equals("portlet")) {
View Full Code Here

        context.setLastError(null);
       
        try {
       
            // Retrieve and build neccessary objects and flags
            WGDocument mainDocument = context.getmaincontext().getdocument();
            WGContent mainContent = null;
            if (context.getmaincontext().getdocument() instanceof WGContent) {
                mainContent = context.getmaincontext().content();
            }
            else {
                mainContent = mainDocument.getDatabase().getDummyContent(null);
            }
           
            // Navigation role
            String navRole = context.getrole();
            if (getRole() != null) {
View Full Code Here

            // So we have an update and a deletion at the same time.
            // We cannot determine by log which was before the other.
            // Therefor we look if the document exists.
            // If so we use the update log, else the deletion log.
            // The nonused log is therefor removed from the log list
            WGDocument doc = null;
            WGDocumentKey documentKey = new WGDocumentKey(maxUpdateLog.getDocumentKey());
            if (documentKey.isRealDocumentKey()) {
                try {
                    doc = _db.getDocumentByKey(documentKey);
                    if (doc != null && !doc.isDeleted()) {
                        WGFactory.getLogger().info("Resolving log conflict about document " + maxUpdateLog.getDocumentKey() + ": Relevant log type determined as update");
                        wgLogs.remove(maxDeletionLog);                
                    }
                    else {
                        WGFactory.getLogger().info("Resolving log conflict about document " + maxUpdateLog.getDocumentKey() + ": Relevant log type determined as deletion");
View Full Code Here

            else {
                this.addWarning("Unsupported mode: " + this.getMode(), true);
            }    
        }
        else {
            WGDocument doc = this.getTMLContext().getdocument();
            if (doc.hasItem(name)) {
                values = this.getTMLContext().itemlist(name);   
            } else {
                values = new ArrayList();
                values.add(defaultvalue);               
            }
View Full Code Here

        String containerKey = path.getContainerKey();
        List containerKeyElems = WGUtils.deserializeCollection(containerKey, "/");
        String containerKeyLastElement = (String) containerKeyElems.get(containerKeyElems.size() - 1);

        // Fetch the file container
        WGDocument fileContainer = database.getFileContainer(containerKeyLastElement);
        if (fileContainer == null) {

            // Container addressed by some kind of content key?
            WGContent content = getContentByAnyKey(containerKeyLastElement, database, request);

            // Container addressed by Title path?
            if (content == null) {
                TitlePathManager tpm = (TitlePathManager) database.getAttribute(WGACore.DBATTRIB_TITLEPATHMANAGER);
                if (tpm != null && tpm.isGenerateTitlePathURLs()) {
                    TitlePathManager.TitlePath url = tpm.parseTitlePathURL(containerKeyElems);
                    if (url != null) {
                        path.setTitlePathURL(url);
                        content = path.getContentByTitlePath(request);
                    }
                }
            }

            if (content == null || !content.mayBePublished(isBrowserInterface(request.getSession()) || isAuthoringMode(database.getDbReference(), request.getSession()), WGContent.DISPLAYTYPE_NONE)) {
                sendNoFileContainerNotification(path, request, response, database);
                return;
            }

            fileContainer = content;
        }

        if (info != null && fileContainer != null && fileContainer instanceof WGContent) {
            info.setContent((WGContent) fileContainer);
        }

        String fileName = path.getFileName();
        if (fileName == null || fileName.equals("")) {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No file name in file URL: " + path.getCompleteURL());
            return;
        }

        ExternalFileServingConfig externalFileServingConfig = _core.getExternalFileServingConfig();

        if (externalFileServingConfig.isEnabled() && database.getBooleanAttribute(WGACore.DBATTRIB_EXTERNAL_FILE_SERVING_ENABLED, false)) {

            // check if file is anonymous accessible
            boolean isAnonymousAccessible = database.isAnonymousAccessible();

            if (isAnonymousAccessible) {
                // perform further document level checks
                if (fileContainer != null && fileContainer instanceof WGContent) {
                    // check status
                    if (!((WGContent) fileContainer).getStatus().equals(WGContent.STATUS_RELEASE)) {
                        isAnonymousAccessible = false;
                    }
                    // check readers
                    if (isAnonymousAccessible) {
                        isAnonymousAccessible = ((WGContent) fileContainer).getReaders().size() == 0;
                    }
                }
            }

            if (isAnonymousAccessible && fileContainer.getFileSize(fileName) >= externalFileServingConfig.getThreshold()) {
                // file is anonymous accessible and above external serving
                // threshold
                dispatchFileExternalImpl(externalFileServingConfig, path, request, response, database, fileContainer);
            }
            else {
View Full Code Here

                                database.openSession();
                                // perform synchronized up to date check
                                if (!isExternalCacheUpToDate(cachedFile, fileContainer, filename)) {

                                    File temp = new File(cachedFile.getParent(), UIDGenerator.generateUID() + ".tmp");
                                    WGDocument container = database.getDocumentByDocumentKey(fileContainer.getDocumentKey());
                                    InputStream in = null;
                                    OutputStream out = null;
                                    try {
                                        in = container.getFileData(filename);
                                        out = new FileOutputStream(temp);
                                        WGUtils.inToOut(in, out, 1024);
                                    }
                                    finally {
                                        if (in != null) {
View Full Code Here

            if (thisForm != null && thisForm.hasfield(fieldname)) {
                return thisForm.getEnteredOrParsedValues(fieldname);
            }
            // retrieve fieldvalue from source
            if (source.equals("content")) {
                WGDocument doc = tmlContext.getdocument();
                return FormBase.getFieldValue(doc, tmlContext, formInfo, fieldname, meta, defaultvalue, useRelation);           
            }
           
            else if (source.equals("profile")) {
                TMLUserProfile profile = tmlContext.getprofile();
View Full Code Here

    public WGContent findContentByTitlePath(TitlePath titlePathURL, WGDatabase database, WGLanguageChooser chooser, String mode) throws WGAPIException,
            UnsupportedEncodingException, RemainingPathElementException {
       
      
        // Find trigger document
        WGDocument triggerDoc = titlePathURL.getTrigger().getDocument(database);
        if (triggerDoc == null) {
            return null;
        }
   
        // No further path. Return trigger document (if it can be used)
View Full Code Here

    private WGContent findSharePathContent(TitlePath titlePathURL, WGLanguageChooser chooser, String mode, WGDocument triggerDoc) throws UnsupportedEncodingException,
            WGAPIException, RemainingPathElementException {
       
        WGContent pathContent = null;
        Iterator pathTitles = titlePathURL.getTitles().iterator();
        WGDocument parent = null;
       
       
        while (pathTitles.hasNext()) {
           
            PathTitle pathTitle = parseSharePathTitle((String) pathTitles.next());
View Full Code Here

TOP

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

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.