Package org.jahia.services.categories

Examples of org.jahia.services.categories.Category


            JCRNodeWrapper parentNodeWrapper = getParentNode(parentCategory,
                    jcrSessionWrapper);
            for (NodeIterator iterator = parentNodeWrapper.getNodes(); iterator.hasNext();) {
                JCRNodeWrapper rootCategoryNode = (JCRNodeWrapper) iterator.nextNode();
                if (rootCategoryNode.isNodeType(Constants.JAHIANT_CATEGORY)) {
                    rootCategories.add(new Category(
                            createCategoryBeanFromNode(rootCategoryNode)));
                }
            }
        } catch (RepositoryException e) {
            logger.error(e.getMessage(), e);
View Full Code Here


    }

    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
        try {
            if (localName.equals("category")) {
                Category c;
                String key = attributes.getValue(ImportExportBaseService.JAHIA_URI, "key");
                if (cats.isEmpty()) {
                    cats.push(rootCategory);
                    return;
                } else {
                    String parentPath;
                    Category parent = cats.peek();
                    if (parent == null) {
                        try {
                            parentPath = cs.getCategoriesRoot().getPath();
                        } catch (RepositoryException e) {
                            throw new SAXException(e);
                        }
                    } else {
                        parentPath = parent.getCategoryPath();
                    }

                    Category cat = cs.getCategoryByPath(parentPath + "/"  + key);

                    if (cat == null) {
                        c = Category.createCategory(key,parent);
                    } else {
                        c = cat;
                    }
                }
                for (int i = 0; i < attributes.getLength(); i++) {
                    String k = (String) attributes.getLocalName(i);
                    if (k.startsWith("title_")) {
                        c.setTitle(LanguageCodeConverters.languageCodeToLocale(k.substring(6)), attributes.getValue(i));
                    }
                }
                String acl = attributes.getValue(ImportExportBaseService.JAHIA_URI, "acl");
                if (acl != null) {
//                    TODO: commented while shifting from DB to JCR, needs to be finished
//                    fillAcl(c.getACL(), acl);
                }
                cats.push(c);
            }
            if (localName.equals("property")) {
                String key = attributes.getValue(ImportExportBaseService.JAHIA_URI, "key");
                String value = attributes.getValue(ImportExportBaseService.JAHIA_URI, "value");
                if (!cats.empty()) {
                    Category c = cats.peek();
                    if (key != null && value != null) {
                        if (key.startsWith("homepage")) {
                            uuidProps.add(new String[] {c.getKey(),key,value});
                        }
                        c.setProperty(key, value);
                    }
                }
            }
        } catch (JahiaException e) {
            throw new SAXException(e);
View Full Code Here

            return;
        }
        for (Iterator<String[]> iterator = p.iterator(); iterator.hasNext();) {
            try {
                String[] s = (String[]) iterator.next();
                Category c = Category.getCategory(s[0]);
            } catch (JahiaException e) {
                logger.error("Cannot set property for category ",e);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jahia.services.categories.Category

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.