Examples of PlanetSubscriptionData


Examples of org.apache.roller.pojos.PlanetSubscriptionData

           
            String feed_url1 = "http://rollerweblogger.org/rss/roller";
            String feed_url2 = "http://linuxintegrators.com/acoliver/?flavor=rss2";
           
            {
                PlanetSubscriptionData sub1 = new PlanetSubscriptionData();
                sub1.setFeedURL(feed_url1);
                planet.saveSubscription(sub1);
                PlanetSubscriptionData sub2 = new PlanetSubscriptionData();
                sub2.setFeedURL(feed_url2);
                planet.saveSubscription(sub2);
                TestUtils.endSession(true);
               
                assertEquals(2, planet.getSubscriptionCount());
               
View Full Code Here

Examples of org.apache.roller.pojos.PlanetSubscriptionData

                Roller roller = RollerFactory.getRoller();
                PlanetManager planet = roller.getPlanetManager();
                PlanetSubscriptionFormEx form = (PlanetSubscriptionFormEx)actionForm;
                if (request.getParameter("feedUrl") != null) {
                    String feedUrl = request.getParameter("feedUrl");
                    PlanetSubscriptionData sub =
                            planet.getSubscription(feedUrl);
                    form.copyFrom(sub, request.getLocale());
                } else {
                    form.doReset(mapping, request);
                }
View Full Code Here

Examples of org.apache.roller.pojos.PlanetSubscriptionData

            if (RollerSession.getRollerSession(request).isGlobalAdminUser()) {
                Roller roller = RollerFactory.getRoller();
                PlanetManager planet = roller.getPlanetManager();
                PlanetSubscriptionFormEx form = (PlanetSubscriptionFormEx)actionForm;
                if (form.getId() != null) {
                    PlanetSubscriptionData sub =
                            planet.getSubscriptionById(form.getId());
                   
                    String groupHandle = request.getParameter("groupHandle");
                    groupHandle = (groupHandle == null) ? form.getGroupHandle() : groupHandle;
                    groupHandle = (groupHandle == null) ? "external" : groupHandle;
View Full Code Here

Examples of org.apache.roller.pojos.PlanetSubscriptionData

            PlanetGroupData targetGroup = planet.getGroup(groupHandle);
           
            if (RollerSession.getRollerSession(request).isGlobalAdminUser()) {
               
                ActionMessages messages = new ActionMessages();
                PlanetSubscriptionData sub = null;
                ActionErrors errors = validate(planet, form);
                if (errors.isEmpty()) {
                    if (form.getId() == null || form.getId().trim().length() == 0) {                       
                        // Adding new subscription to group                       
                        // But, does subscription to that feed already exist?
                        if (form.getFeedURL() != null) {
                            sub = planet.getSubscription(form.getFeedURL());
                        }
                        if (sub != null) {
                            // Yes, we'll use it instead
                            messages.add(null, new ActionMessage(
                                "planetSubscription.foundExisting", sub.getTitle()));
                        } else {
                            // No, add new subscription
                            sub = new PlanetSubscriptionData();
                            form.copyTo(sub, request.getLocale());
                        }                       
                        targetGroup.addSubscription(sub);
                       
                    } else {
View Full Code Here

Examples of org.apache.roller.pojos.PlanetSubscriptionData

               
                // add feed url to the "live" list
                liveUserFeeds.add(feedUrl);
               
                // if sub already exists then update it, otherwise add it
                PlanetSubscriptionData sub = planet.getSubscription(feedUrl);
                if (sub == null) {
                    log.info("ADDING feed: "+feedUrl);
                   
                    sub = new PlanetSubscriptionData();
                    sub.setTitle(weblog.getName());
                    sub.setFeedURL(feedUrl);
                    sub.setSiteURL(siteUrl);
                    sub.setAuthor(weblog.getHandle());
                   
                    planet.saveSubscription(sub);
                    group.addSubscription(sub);
                } else {
                    sub.setTitle(weblog.getName());
                    sub.setAuthor(weblog.getHandle());
                   
                    planet.saveSubscription(sub);
                }
            }
           
            // new subs added, existing subs updated, now delete old subs
            Iterator subs = group.getSubscriptions().iterator();
            while(subs.hasNext()) {
                PlanetSubscriptionData sub =
                        (PlanetSubscriptionData) subs.next();
                if (!liveUserFeeds.contains(sub.getFeedURL())) {
                    log.info("DELETING feed: "+sub.getFeedURL());
                    planet.deleteSubscription(sub);
                    group.removeSubscription(sub);
                }
            }
           
View Full Code Here

Examples of org.apache.roller.pojos.PlanetSubscriptionData

                end = end > userCount ? userCount : end;
                log.info("Updating subscriptions ["+start+":"+end+"]");
               
                Iterator subs = planet.getAllSubscriptions();
                while (subs.hasNext()) {
                    PlanetSubscriptionData sub =
                            (PlanetSubscriptionData)subs.next();
                    if (count >= start && count < end) {
                        try {
                            Technorati.Result result =
                                    technorati.getBloginfo(sub.getSiteURL());
                            if (result != null && result.getWeblog() != null) {
                                sub.setInboundblogs(
                                        result.getWeblog().getInboundblogs());
                                sub.setInboundlinks(
                                        result.getWeblog().getInboundlinks());
                                log.debug("Adding rank for "
                                        +sub.getFeedURL()+" ["+count+"|"
                                        +sub.getInboundblogs()+"|"
                                        +sub.getInboundlinks()+"]");
                            } else {
                                log.debug(
                                        "No ranking available for "
                                        +sub.getFeedURL()+" ["+count+"]");
                                sub.setInboundlinks(0);
                                sub.setInboundblogs(0);
                            }
                            planet.saveSubscription(sub);
                        } catch (Exception e) {
                            log.warn("WARN ranking subscription ["
                                    + count + "]: " + e.getMessage());
View Full Code Here

Examples of org.apache.roller.pojos.PlanetSubscriptionData

        try {
            Roller roller = RollerFactory.getRoller();
            PlanetManager planetManager = roller.getPlanetManager();
            List subs = planetManager.getTopSubscriptions(groupHandle, 0, length);
            for (Iterator it = subs.iterator(); it.hasNext();) {
                PlanetSubscriptionData sub = (PlanetSubscriptionData) it.next();
                list.add(PlanetSubscriptionDataWrapper.wrap(sub));
            }
        } catch (Exception e) {
            log.error("ERROR: get ranked blogs", e);
        }
View Full Code Here

Examples of org.apache.roller.pojos.PlanetSubscriptionData

        strategy.store(entry);
    }
       
    public void saveSubscription(PlanetSubscriptionData sub)
        throws RollerException {
        PlanetSubscriptionData existing = getSubscription(sub.getFeedURL());
        if (existing == null || (existing.getId().equals(sub.getId()))) {
            this.strategy.store(sub);
        } else {
            throw new RollerException("ERROR: duplicate feed URLs not allowed");
        }
    }
View Full Code Here

Examples of org.apache.roller.pojos.PlanetSubscriptionData

        Iterator subs = getAllSubscriptions();
        while (subs.hasNext()) {
           
            long subStartTime = System.currentTimeMillis();
           
            PlanetSubscriptionData sub = (PlanetSubscriptionData)subs.next();
           
            // reattach sub.  sub gets detached as we iterate
            sub = this.getSubscriptionById(sub.getId());
           
            // Fetch latest entries for each subscription
//            Set newEntries = null;
//            int count = 0;
//            if (!StringUtils.isEmpty(localURL) && sub.getFeedURL().startsWith(localURL)) {
//                newEntries = getNewEntriesLocal(sub, feedFetcher, feedInfoCache);
//            } else {
//                newEntries = getNewEntriesRemote(sub, feedFetcher, feedInfoCache);
//            }
            Set newEntries = this.getNewEntries(sub, feedFetcher, feedInfoCache);
            int count = newEntries.size();
           
            log.debug("   Entry count: " + count);
            if (count > 0) {
                sub.purgeEntries();
                sub.addEntries(newEntries);
                this.saveSubscription(sub);
                if(roller != null) roller.flush();
            }
            long subEndTime = System.currentTimeMillis();
            log.info("   " + count + " - "
                    + ((subEndTime-subStartTime)/1000.0)
                    + " seconds to process (" + count + ") entries of "
                    + sub.getFeedURL());
        }
        // Clear the aggregation cache
        clearCachedAggregations();
       
        long endTime = System.currentTimeMillis();
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.