Package org.apache.roller

Examples of org.apache.roller.RollerException


   
    public WeblogEntryData getWeblogEntryByAnchor(WebsiteData website, String anchor)
            throws RollerException {
       
        if (website == null)
            throw new RollerException("Website is null");
       
        if (anchor == null)
            throw new RollerException("Anchor is null");
       
        // mapping key is combo of weblog + anchor
        String mappingKey = website.getHandle()+":"+anchor;
       
        // check cache first
        // NOTE: if we ever allow changing anchors then this needs updating
        if(this.entryAnchorToIdMap.containsKey(mappingKey)) {
           
            WeblogEntryData entry = this.getWeblogEntry((String) this.entryAnchorToIdMap.get(mappingKey));
            if(entry != null) {
                log.debug("entryAnchorToIdMap CACHE HIT - "+mappingKey);
                return entry;
            } else {
                // mapping hit with lookup miss?  mapping must be old, remove it
                this.entryAnchorToIdMap.remove(mappingKey);
            }
        }
       
        // cache failed, do lookup
        try {
            Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
            Criteria criteria = session.createCriteria(WeblogEntryData.class);
            criteria.add(Expression.conjunction()
            .add(Expression.eq("website",website))
            .add(Expression.eq("anchor",anchor)));
            criteria.addOrder(Order.desc("pubTime"));
            criteria.setMaxResults(1);
           
            List list = criteria.list();
           
            WeblogEntryData entry = null;
            if(list.size() != 0) {
                entry = (WeblogEntryData) criteria.uniqueResult();
            }
           
            // add mapping to cache
            if(entry != null) {
                log.debug("entryAnchorToIdMap CACHE MISS - "+mappingKey);
                this.entryAnchorToIdMap.put(mappingKey, entry.getId());
            }
           
            return entry;
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here


                return ((WeblogEntryData)list.get(0)).getPubTime();
            } else {
                return null;
            }
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here

                WeblogEntryData entry = (WeblogEntryData)entryIter.next();
                entries.add(entry);
            }
            return entries;
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here

                    count++;
                }
            }
            return name;
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here

                criteria.add(Expression.eq("c.name", cat.getName()));
                criteria.add(Expression.eq("ancestorCategory", parent));
                criteria.add(Expression.eq("relation", Assoc.PARENT));
                sameNames = criteria.list();
            } catch (HibernateException e) {
                throw new RollerException(e);
            }
            if (sameNames.size() > 1) {
                return true;
            }
        }
View Full Code Here

                return true;
            }
           
            return false;
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here

            Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
            criteria.add(Expression.eq("category", child));
            criteria.add(Expression.eq("ancestorCategory", ancestor));
            ret = criteria.list().size() > 0;
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
        return ret;
    }
View Full Code Here

            Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
            criteria.add(Expression.eq("category", cat));
            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(WeblogCategoryAssoc.class);
            criteria.add(Expression.eq("ancestorCategory", cat));
            criteria.add(Expression.eq("relation", Assoc.PARENT));
            return criteria.list();
        } catch (HibernateException e) {
            throw new RollerException(e);
        }
    }
View Full Code Here

            Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
            Criteria criteria = session.createCriteria(WeblogCategoryAssoc.class);
            criteria.add(Expression.eq("ancestorCategory", cat));
            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.