Package com.castronu.joomlajavaapi.exception

Examples of com.castronu.joomlajavaapi.exception.GenericErrorException


    }

    public void createMenuCategory(String title,String alias,String path,int categoryId) throws GenericErrorException {
        List<Menu> menuWithThisPath = getMenuWithThisPath(path);
        if (menuWithThisPath.size()!=0) {
            throw new GenericErrorException("There is already a menu with this path " + path);
        }
        int parentId = computeParentId(path);
        Menu menu = MenuBuilder.aMenuCategory(title, alias, path, categoryId, parentId);
        getHibernateTemplate().save(menu);
        LOGGER.info("Menu "+ path + " created");
View Full Code Here


        String parent = file.getParent();
        if (parent==null) {return 1;}
        else {
            List<Menu> menuWithThisPath = getMenuWithThisPath(Converter.getPath(parent));
            if (menuWithThisPath.size()==0) {
                throw new GenericErrorException("No parent category menu found for parent "+parent);
            }
            return menuWithThisPath.get(0).getId();
        }

    }
View Full Code Here

        try {
            getHibernateTemplate().save(JoomlaDslUtils.sanytize(category));
            List<Category> categoryFromPath = getCategoryFromPath(path);
            return categoryFromPath.get(0).getId();
        } catch (NoSuchMethodException e) {
            throw new GenericErrorException("GRAVE" + path, e);
        } catch (InvocationTargetException e) {
            throw new GenericErrorException("GRAVE" + path, e);
        } catch (IllegalAccessException e) {
            throw new GenericErrorException("GRAVE" + path, e);
        }
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public void deleteCategory(String path) throws GenericErrorException {
        List<Category> categoryFromPath = getCategoryFromPath(path);
        if (categoryFromPath.size() == 0) {
            throw new GenericErrorException("No category for the path " + path);
        }
        getHibernateTemplate().delete(categoryFromPath.get(0));
    }
View Full Code Here

       
        File file = new File(path);
        String categoryPath=file.getParent();
        List<Category> categoryFromPath = categoryDao.getCategoryFromPath(categoryPath);
        if (categoryFromPath.size()==0) {
            throw new GenericErrorException("There is no category for the path " + categoryPath);
        }
        else if (categoryFromPath.size()!=1) {
            throw new IllegalStateException("Two category with the samepath! "+categoryPath);
        } else {
            uniqueCategoryId=categoryFromPath.get(0).getId();
        }

        List<Content> articleInCategoryFromPathID = getArticleInCategoryFromCatiDAndTitle(title, categoryFromPath.get(0).getId());
        if (articleInCategoryFromPathID.size()!=0) {
            throw new GenericErrorException("There is already an article "+title+" in the category for the path " + categoryPath);
        }
     

        Content article = aContent(title, alias, content, link, path, uniqueCategoryId,description,keywords);

        System.out.println(article);
        try {
            LOGGER.info("Creating article {} in {}",title,categoryPath);
            getHibernateTemplate().save(JoomlaDslUtils.sanytize(article));
        } catch (NoSuchMethodException e) {
            throw new GenericErrorException("GRAVE" + categoryPath+"/"+title,e);
        } catch (InvocationTargetException e) {
            throw new GenericErrorException("GRAVE" + categoryPath+"/"+title,e);
        } catch (IllegalAccessException e) {
            throw new GenericErrorException("GRAVE" + categoryPath+"/"+title,e);
        }
    }
View Full Code Here

    public void deleteArticle(String title, String categoryPath) throws GenericErrorException {
        //TO TEST...
        List<Category> categoryFromPath = categoryDao.getCategoryFromPath(categoryPath);
        if (categoryFromPath.size()==0) {
            throw new GenericErrorException("There is no category for the path " + categoryPath);
        }
        List<Content> articleInCategoryFromPathID = getArticleInCategoryFromCatiDAndTitle(title, categoryFromPath.get(0).getId());

        if (articleInCategoryFromPathID.size()==0) {
            throw new GenericErrorException("There is no article "+title+" in the category for the path " + categoryPath +" to delete");
        }
        LOGGER.info("Deleteing article {} in {}",title,categoryPath);
            getHibernateTemplate().delete(articleInCategoryFromPathID.get(0));
    }
View Full Code Here

TOP

Related Classes of com.castronu.joomlajavaapi.exception.GenericErrorException

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.