Package org.jahia.services.googledocs

Examples of org.jahia.services.googledocs.GoogleDocsService


            JCRSessionWrapper session = JCRSessionFactory.getInstance().getCurrentUserSession(workspace);
            JCRNodeWrapper node = session.getNode(nodePath);
            if (node.isNodeType("nt:file")) {

                GoogleDocsService docsService = getDocsService(request, response);
                if (docsService == null) {
                    return null;
                }

                DocumentListEntry document = uploadFile(node, docsService, request, response);
View Full Code Here


                throw new GWTJahiaServiceException(
                        JahiaResourceBundle.getJahiaInternalResource("message.googleDocs.synchronize.documentNotFound",
                                getLocale(), "No document currently being edited in Google Docs can be found."));
            }
            try {
                GoogleDocsService googleDocsService =
                        googleDocsServiceFactory.getDocsService(getRequest(), getResponse());
                InputStream content = googleDocsService.downloadFile(uri);
                try {
                    JCRNodeWrapper parent = node.getParent();
                    session.checkout(parent);
                    parent.uploadFile(node.getName(), content, node.getFileContent().getContentType());
                    session.save();
                } finally {
                    IOUtils.closeQuietly(content);
                    String docId = null;
                    if (uri.contains("docId=")) {
                        docId = StringUtils.substringBetween(uri, "docId=", "&");
                    } else if (uri.contains("key=")) {
                        docId = StringUtils.substringBetween(uri, "key=", "&");
                    } else if (uri.contains("id=")) {
                        docId = StringUtils.substringBetween(uri, "id=", "&");
                    }
                    if (docId != null) {
                        try {
                            googleDocsService.delete(docId);
                        } catch (Exception e) {
                            logger.warn("Unable to delete document '" + docId + "' from Google Docs", e);
                        }
                    } else {
                        logger.warn("Unable to retrieve document ID from the URI: " + uri);
View Full Code Here

TOP

Related Classes of org.jahia.services.googledocs.GoogleDocsService

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.