Examples of WeblogEntryManager


Examples of org.apache.roller.weblogger.business.WeblogEntryManager

   
    public long getCommentCount() {
        long count = 0;
        try {
            Weblogger roller = WebloggerFactory.getWeblogger();
            WeblogEntryManager mgr = roller.getWeblogEntryManager();
            count = mgr.getCommentCount();           
        } catch (WebloggerException e) {
            log.error("Error getting comment count for site ", e);
        }
        return count;
    }
View Full Code Here

Examples of org.apache.roller.weblogger.business.WeblogEntryManager

   
    public long getEntryCount() {
        long count = 0;
        try {
            Weblogger roller = WebloggerFactory.getWeblogger();
            WeblogEntryManager mgr = roller.getWeblogEntryManager();
            count = mgr.getEntryCount();           
        } catch (WebloggerException e) {
            log.error("Error getting entry count for site", e);
        }
        return count;
    }
View Full Code Here

Examples of org.apache.roller.weblogger.business.WeblogEntryManager

    }
   
   
    public void myPrepare() {
        try {
            WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
            if(!StringUtils.isEmpty(getCategoryId()) &&
                    !"/".equals(getCategoryId())) {
                setCategory(wmgr.getWeblogCategory(getCategoryId()));
            } else {
                setCategory(wmgr.getRootWeblogCategory(getActionWeblog()));
            }
        } catch (WebloggerException ex) {
            log.error("Error looking up category", ex);
        }
    }
View Full Code Here

Examples of org.apache.roller.weblogger.business.WeblogEntryManager

        // build list of categories for display
        TreeSet allCategories = new TreeSet(new WeblogCategoryPathComparator());
       
        try {
            // Build list of all categories, except for current one, sorted by path.
            WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
            List<WeblogCategory> cats = wmgr.getWeblogCategories(getActionWeblog(), true);
            for(WeblogCategory cat : cats) {
                if (!cat.getId().equals(getCategoryId())) {
                    allCategories.add(cat);
                }
            }
View Full Code Here

Examples of org.apache.roller.weblogger.business.WeblogEntryManager

   
   
    public String move() {
       
        try {
            WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
           
            log.debug("Moving categories to category - "+getTargetCategoryId());
           
            // Move subCategories to new category.
            String[] cats = getSelectedCategories();
            WeblogCategory parent = wmgr.getWeblogCategory(getTargetCategoryId());
            if(cats != null) {
                for (int i = 0; i < cats.length; i++) {
                    WeblogCategory cd =
                            wmgr.getWeblogCategory(cats[i]);
                   
                    // Don't move category into itself.
                    if (!cd.getId().equals(parent.getId()) &&
                            !parent.descendentOf(cd)) {
                        wmgr.moveWeblogCategory(cd, parent);
                    } else {
                        addMessage("categoriesForm.warn.notMoving", cd.getName());
                    }
                }
               
View Full Code Here

Examples of org.apache.roller.weblogger.business.WeblogEntryManager

    public WeblogCategory getWeblogCategory() {
       
        if(weblogCategory == null && weblogCategoryName != null) {
            try {
                WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
                weblogCategory = wmgr.getWeblogCategoryByPath(getWeblog(), weblogCategoryName);
            } catch (WebloggerException ex) {
                log.error("Error getting weblog category "+weblogCategoryName, ex);
            }
        }
       
View Full Code Here

Examples of org.apache.roller.weblogger.business.WeblogEntryManager

        }
       
        try {
            TreeSet categories = new TreeSet();
            Weblogger roller = WebloggerFactory.getWeblogger();
            WeblogEntryManager weblogMgr = roller.getWeblogEntryManager();
           
            WeblogEntry entry = null;
            Document doc = null;
            String handle = null;
            Timestamp now = new Timestamp(new Date().getTime());
            for(int i = offset; i < offset+limit; i++) {
               
                entry = null; // reset for each iteration
               
                doc = hits.doc(i);
                handle = doc.getField(FieldConstants.WEBSITE_HANDLE).stringValue();
               
                if(websiteSpecificSearch &&
                        handle.equals(feedRequest.getWeblogHandle())) {
                   
                    entry = weblogMgr.getWeblogEntry(
                            doc.getField(FieldConstants.ID).stringValue());
                } else {
                   
                    entry = weblogMgr.getWeblogEntry(
                            doc.getField(FieldConstants.ID).stringValue());
                   
                    if (doc.getField(FieldConstants.CATEGORY) != null) {
                        categories.add(
                                doc.getField(FieldConstants.CATEGORY).stringValue());
View Full Code Here

Examples of org.apache.roller.weblogger.business.WeblogEntryManager

    public WeblogEntry getWeblogEntry() {
       
        if(weblogEntry == null && weblogAnchor != null) {
            try {
                WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
                weblogEntry = wmgr.getWeblogEntryByAnchor(getWeblog(), weblogAnchor);
            } catch (WebloggerException ex) {
                log.error("Error getting weblog entry "+weblogAnchor, ex);
            }
        }
       
View Full Code Here

Examples of org.apache.roller.weblogger.business.WeblogEntryManager

    public WeblogCategory getWeblogCategory() {
       
        if(weblogCategory == null && weblogCategoryName != null) {
            try {
                WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
                weblogCategory = wmgr.getWeblogCategoryByPath(getWeblog(), weblogCategoryName);
            } catch (WebloggerException ex) {
                log.error("Error getting weblog category "+weblogCategoryName, ex);
            }
        }
       
View Full Code Here

Examples of org.apache.roller.weblogger.business.WeblogEntryManager

     */
    public String save() {
       
        if(!hasActionErrors()) try {
            UserManager userMgr = WebloggerFactory.getWeblogger().getUserManager();
            WeblogEntryManager weblogMgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
           
            WeblogEntry entry = new WeblogEntry();
            entry.setCreatorUserName(getAuthenticatedUser().getUserName());
            entry.setWebsite(getActionWeblog());
           
            // set updatetime & pubtime if it was specified
            entry.setUpdateTime(new Timestamp(new Date().getTime()));
            entry.setPubTime(getBean().getPubTime(getLocale(), getActionWeblog().getTimeZoneInstance()));
           
            // copy data to new entry pojo
            getBean().copyTo(entry);
           
            // handle pubtime auto set
            if(entry.isPublished()) {
                if(entry.getPubTime() == null) {
                    // no time specified, use current time
                    entry.setPubTime(entry.getUpdateTime());
                }
               
                // if user does not have author perms then force PENDING status
                if(!getActionWeblog().hasUserPermission(getAuthenticatedUser(),WeblogPermission.POST)) {
                    entry.setStatus(WeblogEntry.PENDING);
                }
            }
           
            // if user is an admin then apply pinned to main value as well
            GlobalPermission adminPerm =
                new GlobalPermission(Collections.singletonList(GlobalPermission.ADMIN));
            if (userMgr.checkPermission(adminPerm, getAuthenticatedUser())) {
                entry.setPinnedToMain(getBean().getPinnedToMain());
            }
           
            if(!StringUtils.isEmpty(getBean().getEnclosureURL())) try {
                // Fetch MediaCast resource
                log.debug("Checking MediaCast attributes");
                MediacastResource mediacast = MediacastUtil.lookupResource(getBean().getEnclosureURL());
               
                // set mediacast attributes
                entry.putEntryAttribute("att_mediacast_url", mediacast.getUrl());
                entry.putEntryAttribute("att_mediacast_type", mediacast.getContentType());
                entry.putEntryAttribute("att_mediacast_length", ""+mediacast.getLength());
               
            } catch (MediacastException ex) {
                addMessage(getText(ex.getErrorKey()));
            }
           
            if(log.isDebugEnabled()) {
                log.debug("entry bean is ...\n"+getBean().toString());
                log.debug("final status = "+entry.getStatus());
                log.debug("updtime = "+entry.getUpdateTime());
                log.debug("pubtime = "+entry.getPubTime());
            }
           
            log.debug("Saving entry");
            weblogMgr.saveWeblogEntry(entry);
            WebloggerFactory.getWeblogger().flush();
           
            // notify search of the new entry
            reindexEntry(entry);
           
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.