Package org.jahia.services.content

Examples of org.jahia.services.content.JCRSessionWrapper.checkout()


            } else {
                node = jcrSessionWrapper.getNodeByUUID(categoryBean.getId());
            }
            if (node != null) {
                if (!node.getParent().isCheckedOut()) {
                    jcrSessionWrapper.checkout(node.getParent());
                }
                node.remove();
                jcrSessionWrapper.save();
            }
        } catch (RepositoryException e) {
View Full Code Here


        try {
            JCRSessionWrapper jcrSessionWrapper = sessionFactory
                    .getCurrentUserSession();
            JCRNodeWrapper parentNodeWrapper = getParentNode(parentCategory,
                    jcrSessionWrapper);
            jcrSessionWrapper.checkout(parentNodeWrapper);
            final JCRNodeWrapper wrapper = parentNodeWrapper.addNode(key,
                    Constants.JAHIANT_CATEGORY);
            jcrSessionWrapper.save();
            newCategory = new Category(createCategoryBeanFromNode(wrapper));
        } catch (ItemExistsException e) {
View Full Code Here

            String title) throws JahiaException {
        try {
            JCRSessionWrapper session = sessionFactory.getCurrentUserSession(null, locale);
            Node categoryNode = session.getNodeByIdentifier(category
                    .getJahiaCategory().getId());
            session.checkout(categoryNode);
            categoryNode.setProperty(Constants.JCR_TITLE, title);
            session.save();
        } catch (RepositoryException e) {
            logger.error(e.getMessage(), e);
        }
View Full Code Here

            throws JahiaException {
        try {
            JCRSessionWrapper session = sessionFactory.getCurrentUserSession(null, locale);
            Node categoryNode = session.getNodeByIdentifier(category
                    .getJahiaCategory().getId());
            session.checkout(categoryNode);
            categoryNode.getProperty(Constants.JCR_TITLE).remove();
            session.save();
        } catch (PathNotFoundException e) {
            logger.debug(e.getMessage(), e);           
        } catch (RepositoryException e) {
View Full Code Here

                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;
View Full Code Here

    protected void doPut(HttpServletRequest req, HttpServletResponse resp, RenderContext renderContext,
                         URLResolver urlResolver) throws RepositoryException, IOException {
        JCRSessionWrapper session = jcrSessionFactory.getCurrentUserSession(urlResolver.getWorkspace(), urlResolver.getLocale());
        JCRNodeWrapper node = session.getNode(urlResolver.getPath());
        session.checkout(node);
        @SuppressWarnings("unchecked")
        Map<String, String[]> parameters = req.getParameterMap();
        if (parameters.containsKey(REMOVE_MIXIN)) {
            String[] mixinTypes = (String[]) parameters.get(REMOVE_MIXIN);
            for (String mixinType : mixinTypes) {
View Full Code Here

                                    target = s + name;
                                    try {
                                        session.getNode(target);
                                    } catch (RepositoryException e) {
                                        JCRNodeWrapper node = session.getNode(s);
                                        session.checkout(node);
                                        node.addNode(name, "jnt:folder");
                                        session.save();
                                    }
                                } else {
                                    target = sessionNode.getPath() + "/files";
View Full Code Here

                                        session.save();
                                    }
                                } else {
                                    target = sessionNode.getPath() + "/files";
                                    if (!sessionNode.hasNode("files")) {
                                        session.checkout(sessionNode);
                                        sessionNode.addNode("files", "jnt:folder");
                                        session.save();
                                    }
                                }
                            } else {
View Full Code Here

                                }

                                JCRNodeWrapper fileNode = targetDirectory.hasNode(name) ?
                                        targetDirectory.getNode(name) : null;
                                if (fileNode != null && isVersionActivated) {
                                    session.checkout(fileNode);
                                }
                                // checkout parent directory
                                session.getWorkspace().getVersionManager().checkout(targetDirectory.getPath());
                                final JCRNodeWrapper wrapper = targetDirectory
                                        .uploadFile(name,
View Full Code Here

        JCRSessionWrapper session = JCRSessionFactory.getInstance()
                .getCurrentUserSession(Constants.EDIT_WORKSPACE,
                        LanguageCodeConverters.languageCodeToLocale(site.getDefaultLanguage()));
        JCRNodeWrapper node = session.getNode("/sites/"+TESTSITE_NAME+ "/contents/feeds");

        session.checkout(node);

        JCRNodeWrapper sdaFeedNode = node.addNode(nodeName, "jnt:feed");

        sdaFeedNode.setProperty("url", feedURL);
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.