Package org.apache.roller

Examples of org.apache.roller.RollerException


                Element elem = (Element)iter.next();
                importOpmlElement( website, elem, newFolder );
            }
           
        } catch (Exception ex) {
            throw new RollerException(ex);
        }
    }
View Full Code Here


    //----------------------------------------------------------------
    public void moveFolderContents(FolderData src, FolderData dest)
            throws RollerException {
       
        if (dest.descendentOf(src)) {
            throw new RollerException(
                    "ERROR cannot move parent folder into it's own child");
        }
       
        try {
            // Add to destination folder
            LinkedList deleteList = new LinkedList();
            Iterator srcBookmarks = src.getBookmarks().iterator();
            while (srcBookmarks.hasNext()) {
                BookmarkData bd = (BookmarkData)srcBookmarks.next();
                deleteList.add(bd);
               
                BookmarkData movedBd = new BookmarkData();
                movedBd.setData(bd);
                movedBd.setId(null);
               
                dest.addBookmark(movedBd);
                this.strategy.store(movedBd);
            }
           
            // Remove from source folder
            Iterator deleteIter = deleteList.iterator();
            while (deleteIter.hasNext()) {
                BookmarkData bd = (BookmarkData)deleteIter.next();
                src.removeBookmark(bd);
                // TODO: this won't conflict with the bookmark we store above right?
                this.strategy.remove(bd);
            }
           
        } catch (Exception ex) {
            throw new RollerException(ex);
        }
    }
View Full Code Here

            throws RollerException {
        final Iterator folders;
        final String[] pathArray = Utilities.stringToStringArray(path, "/");
       
        if (folder == null && (null == path || "".equals(path.trim()))) {
            throw new RollerException("Bad arguments.");
        }
       
        if (path.trim().equals("/")) {
            return getRootFolder(website);
        } else if (folder == null || path.trim().startsWith("/")) {
View Full Code Here

                BookmarkData bookmark = (BookmarkData) bookmarkIter.next();
                bookmarks.add(bookmark);
            }
            return bookmarks;
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here

        }
    }
   
    public FolderData getRootFolder(WebsiteData website) throws RollerException {
        if (website == null)
            throw new RollerException("website is null");
        try {
            Session session = ((HibernatePersistenceStrategy) strategy).getSession();
            Criteria criteria = session.createCriteria(FolderAssoc.class);
            criteria.createAlias("folder", "f");
            criteria.add(Expression.eq("f.website", website));
            criteria.add(Expression.isNull("ancestorFolder"));
            criteria.add(Expression.eq("relation", FolderAssoc.PARENT));
            List results = criteria.list();
            if (results.size() > 1) {
                // Should not have more than one root
                throw new RollerException(
                        "More than one root folder found for website "
                        + website.getId());
            } else if (results.size() == 1) {
                // Return root
                return ((FolderAssoc) results.get(0)).getFolder();
            }
            return null;
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here

        }
    }
   
    public List getAllFolders(WebsiteData website) throws RollerException {
        if (website == null)
            throw new RollerException("Website is null");
       
        try {
            Session session = ((HibernatePersistenceStrategy) strategy).getSession();
            Criteria criteria = session.createCriteria(FolderData.class);
            criteria.add(Expression.eq("website", website));
            return criteria.list();
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
       
    }
View Full Code Here

                criteria.add(Expression.eq("f.name", folder.getName()));
                criteria.add(Expression.eq("ancestorFolder", parent));
                criteria.add(Expression.eq("relation", Assoc.PARENT));
                sameNames = criteria.list();
            } catch (HibernateException e) {
                throw new RollerException(e);
            }
            // If we got some matches
            if (sameNames.size() > 0) {
                // if we're saving a new folder, any matches are dups
                if (isNewFolder) return true;
View Full Code Here

            Criteria criteria = session.createCriteria(FolderAssoc.class);
            criteria.add(Expression.eq("folder", folder));
            criteria.add(Expression.eq("relation", Assoc.PARENT));
            List parents = criteria.list();
            if (parents.size() > 1) {
                throw new RollerException("ERROR: more than one parent");
            } else if (parents.size() == 1) {
                return (Assoc) parents.get(0);
            } else {
                return null;
            }
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here

            Criteria criteria = session.createCriteria(FolderAssoc.class);
            criteria.add(Expression.eq("ancestorFolder", folder));
            criteria.add(Expression.eq("relation", Assoc.PARENT));
            return criteria.list();
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here

            Session session = ((HibernatePersistenceStrategy)strategy).getSession();
            Criteria criteria = session.createCriteria(FolderAssoc.class);
            criteria.add(Expression.eq("ancestorFolder", folder));
            return criteria.list();
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.roller.RollerException

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.