Package org.jahia.ajax.gwt.client.service

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


                    JCRNodeWrapper child = (JCRNodeWrapper) iterator.next();
                    clearAllLocks(child.getPath(),processChildNodes,currentUserSession);
                }
            } else {
                logger.error("Error when clearing all locks on node " + node.getPath());
                throw new GWTJahiaServiceException("Error when clearing all locks on node " + path + " with user " + currentUserSession.getUser().getUserKey());
            }
        } catch (RepositoryException e) {
            logger.error("Repository error when clearing all locks on node " + path,e);
            throw new GWTJahiaServiceException("Error when clearing all locks on node " + path + " with user " + currentUserSession.getUser().getUserKey());
        }
    }
View Full Code Here


        }
        try {
            currentUserSession.save();
        } catch (RepositoryException e) {
            logger.error("error", e);
            throw new GWTJahiaServiceException("Could not save session");
        }
        if (missedPaths.size() > 0) {
            StringBuilder errors =
                    new StringBuilder("The following files could not be ").append(toLock ? "locked:" : "unlocked:");
            for (String missedPath : missedPaths) {
                errors.append("\n").append(missedPath);
            }
            throw new GWTJahiaServiceException(errors.toString());
        }
    }
View Full Code Here

            JCRNodeWrapper parent = currentUserSession.getNode(location);
            switch (operation) {
                case 2:
                    JCRNodeWrapper node = (JCRNodeWrapper) parent.getNode(newName);
                    if (node == null) {
                        throw new GWTJahiaServiceException(
                                "Could'nt add a new version, file " + location + "/" + newName + "not found ");
                    }
                    versioning.addNewVersionFile(node, tmpName);
                    break;
                case 1:
                    newName = findAvailableName(parent, newName);
                case 0:
                    if (parent.hasNode(newName)) {
                        throw new GWTJahiaServiceException("file exists");
                    }
                default:
                    GWTFileManagerUploadServlet.Item item = GWTFileManagerUploadServlet.getItem(tmpName);
                    InputStream is = null;
                    try {
View Full Code Here

        try {
            ServicesRegistry.getInstance().getJahiaTemplateManagerService().deployTemplates(templatesPath, sitePath, currentUserSession.getUser().getUsername());
            cacheHelper.flush(sitePath,true);
        } catch (RepositoryException e) {
            logger.error(e.getMessage(), e);
            throw new GWTJahiaServiceException(e.getMessage());
        }
    }
View Full Code Here

            StringBuilder errors = new StringBuilder(JahiaResourceBundle.getJahiaInternalResource(
                    "label.error.nodes.not.deleted", currentUserSession.getLocale()));
            for (String err : missedPaths) {
                errors.append("\n").append(err);
            }
            throw new GWTJahiaServiceException(errors.toString());
        }
    }
View Full Code Here

        JCRNodeWrapper objectNode;
        try {
            objectNode = currentUserSession.getNode(path);
        } catch (RepositoryException e) {
            logger.error(e.toString(), e);
            throw new GWTJahiaServiceException(new StringBuilder(path).append(" could not be accessed :\n").append(e.toString()).toString());
        }
        Map<String, GWTJahiaNodeProperty> props = new HashMap<String, GWTJahiaNodeProperty>();
        String propName = "null";
        try {
            PropertyIterator it = objectNode.getProperties();
View Full Code Here

            JCRNodeWrapper objectNode;
            try {
                objectNode = currentUserSession.getNodeByUUID(aNode.getUUID());
            } catch (RepositoryException e) {
                logger.error(e.toString(), e);
                throw new GWTJahiaServiceException(new StringBuilder(aNode.getDisplayName()).append(" could not be accessed :\n").append(e.toString()).toString());
            }
            try {
                List<String> types = aNode.getNodeTypes();
                if (removedTypes != null) {
                    for (ExtendedNodeType mixin : objectNode.getMixinNodeTypes()) {
                        if (removedTypes.contains(mixin.getName())) {
                            List<ExtendedItemDefinition> items = mixin.getItems();
                            for (ExtendedItemDefinition item : items) {
                                if (item.isNode()) {
                                    if (objectNode.hasNode(item.getName())) {
                                        currentUserSession.checkout(objectNode);
                                        objectNode.getNode(item.getName()).remove();
                                    }
                                } else {
                                    if (objectNode.hasProperty(item.getName())) {
                                        currentUserSession.checkout(objectNode);
                                        objectNode.getProperty(item.getName()).remove();
                                    }
                                }
                            }
                            objectNode.removeMixin(mixin.getName());
                        }
                    }
                }
                for (String type : types) {
                    if (!objectNode.isNodeType(type)) {
                        currentUserSession.checkout(objectNode);
                        objectNode.addMixin(type);
                    }
                }
                setProperties(objectNode, newProps);
                objectNode.saveSession();
            } catch (RepositoryException e) {
                throw new GWTJahiaServiceException("Could not save node " + objectNode.getName() + ", " + e.getMessage());
            }
        }
    }
View Full Code Here

     * @throws GWTJahiaServiceException
     */
    public GWTJahiaNode saveSearch(String searchString, String name, JCRSiteNode site, JCRSessionWrapper currentUserSession) throws GWTJahiaServiceException {
        try {
            if (name == null) {
                throw new GWTJahiaServiceException("Could not store query with null name");
            }
            Query q = createQuery(searchString, currentUserSession);
            JCRNodeWrapper user;
            try {
                user = jcrService.getUserFolder(currentUserSession.getUser());
            } catch (Exception e) {
                logger.error("no user folder for site " + site.getSiteKey() + " and user " + currentUserSession.getUser().getUsername());
                throw new GWTJahiaServiceException("No user folder to store query");
            }

            JCRNodeWrapper queryStore;
            if (!user.hasNode("savedSearch")) {
                currentUserSession.checkout(user);
                queryStore = user.createCollection("savedSearch");
            } else {
                queryStore = currentUserSession.getNode(user.getPath() + "/savedSearch");
                currentUserSession.checkout(queryStore);
            }
            String path = queryStore.getPath() + "/" + name;
            if (contentManager.checkExistence(path, currentUserSession)) {
                throw new ExistingFileException("The node " + path + " alreadey exists.");
            }
            q.storeAsNode(path);
            user.getSession().save();
            return navigation.getGWTJahiaNode(currentUserSession.getNode(path));
        } catch (RepositoryException e) {
            logger.error(e.getMessage(), e);
            throw new GWTJahiaServiceException("Could not store query");
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new GWTJahiaServiceException("Could not store query");
        }
    }
View Full Code Here

     * @throws GWTJahiaServiceException
     */
    public GWTJahiaNode saveSearch(GWTJahiaSearchQuery search, String path, String name, JCRSessionWrapper session) throws GWTJahiaServiceException {
        try {
            if (name == null) {
                throw new GWTJahiaServiceException("Could not store query with null name");
            }

            JCRNodeWrapper parent = null;
            if (path == null) {
                try {
                    parent = jcrService.getUserFolder(session.getUser());
                } catch (Exception e) {
                    logger.error("there is no defined user floder.",e);
                }
            } else {
                parent = session.getNode(path);
            }

            final String saveSearchPath = parent.getPath() + "/" + contentManager.findAvailableName(parent, name);
            parent.checkout();
            logger.debug("Save search path: " + saveSearchPath);
            Query q = createQuery(search, session);

            q.storeAsNode(saveSearchPath);

            session.save();

            return navigation.getGWTJahiaNode(session.getNode(saveSearchPath));
        } catch (RepositoryException e) {
            logger.error(e.getMessage(), e);
            throw new GWTJahiaServiceException("Could not store query");
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new GWTJahiaServiceException("Could not store query");
        }
    }
View Full Code Here

TOP

Related Classes of org.jahia.ajax.gwt.client.service.GWTJahiaServiceException

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.