Examples of GWTJahiaServiceException


Examples of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

    public List<String> getGoogleDocsExportFormats(String nodeIdentifier) throws GWTJahiaServiceException {
        try {
            JCRNodeWrapper node = retrieveCurrentSession().getNodeByIdentifier(nodeIdentifier);
            return googleDocsExportFormats.getExportFormats(node.getFileContent().getContentType());
        } catch (RepositoryException e) {
            throw new GWTJahiaServiceException(e.getMessage());
        }
    }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

        try {
            JCRSessionWrapper session = retrieveCurrentSession();
            JCRNodeWrapper node = session.getNodeByIdentifier(nodeIdentifier);
            String uri = GoogleDocsEditor.getDocumentUriBeingEdited(getSession());
            if (uri == null) {
                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);
                    }
                }
            } catch (Exception e) {
                throw new GWTJahiaServiceException(e.getMessage());
            }
        } catch (RepositoryException e) {
            throw new GWTJahiaServiceException(e.getMessage());
        }
    }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

                if (source != null) {
                    gwtSourceNode = navigation.getGWTJahiaNode(source);
                }
            }
        } catch (RepositoryException e) {
            throw new GWTJahiaServiceException(e.getMessage());
        }

        return gwtSourceNode;
    }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

        try {
            if (retrieveCurrentSession().getNode(path).hasPermission("adminCache")) {
                cacheHelper.flush(path, true);
            }
        } catch (RepositoryException e) {
            throw new GWTJahiaServiceException(e.getMessage());
        }
    }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

        try {
            if (retrieveCurrentSession().getRootNode().hasPermission("adminCache")) {
                cacheHelper.flushAll();
            }
        } catch (RepositoryException e) {
            throw new GWTJahiaServiceException(e.getMessage());
        }
    }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

            JCRNodeWrapper nodeWrapper = sessionWrapper.getNodeByIdentifier(siteUUID);
            if (nodeWrapper.hasPermission("adminCache")) {
                cacheHelper.flush(nodeWrapper.getPath(),true);
            }
        } catch (RepositoryException e) {
            throw new GWTJahiaServiceException(e);
        }
    }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

            int size = historyListJahia.size();
            historyListJahia = new ArrayList<GWTJahiaContentHistoryEntry>(historyListJahia.subList(offset, Math.min(size, offset + limit)));
            BasePagingLoadResult<GWTJahiaContentHistoryEntry> pagingLoadResult = new BasePagingLoadResult<GWTJahiaContentHistoryEntry>(historyListJahia, offset, size);
            return pagingLoadResult;
        } catch (RepositoryException e) {
            throw new GWTJahiaServiceException(e.getMessage());
        }
    }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

                    nodeType, null, parent, dependentValues, getUILocale());

            return initializer;
        } catch (RepositoryException e) {
            logger.error("Cannot get node", e);
            throw new GWTJahiaServiceException("Cannot get node");
        }
    }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

            } else {
                return getResponse().encodeURL(this.navigation.getNodeURL(servlet, nodeByIdentifier, versionDate, versionLabel, session.getWorkspace().getName(),
                        session.getLocale()));
            }
        } catch (RepositoryException e) {
            throw new GWTJahiaServiceException(e);
        }
    }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

        } catch (RepositoryException e) {
            logger.error(e.toString(), e);
        }

        if (node == null) {
            throw new GWTJahiaServiceException("Parent node is null");
        }
        if (node.isFile()) {
            throw new GWTJahiaServiceException("Can't list the children of a file");
        }
        final List<GWTJahiaNode> gwtNodeChildren = new ArrayList<GWTJahiaNode>();
        try {
            getMatchingChilds(nodeTypes, mimeTypes, nameFilters, fields, node, gwtNodeChildren, checkSubChild, displayHiddenTypes, hiddenTypes, hiddenRegex);

            return gwtNodeChildren;
        } catch (RepositoryException e) {
            logger.error(e.getMessage(), e);
            throw new GWTJahiaServiceException(e.getMessage());
        }
    }
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.