Examples of SyndEntry


Examples of com.sun.syndication.feed.synd.SyndEntry

                    String thisLink = entryLink + "?articleContentId=" + v.getString("contentId") + "&blogContentId=" + contentId;
                    SyndContent desc = new SyndContentImpl();
                    desc.setType("text/plain");
                    desc.setValue(sub);

                    SyndEntry entry = new SyndEntryImpl();
                    entry.setTitle(v.getString("contentName"));
                    entry.setPublishedDate(v.getTimestamp("createdDate"));
                    entry.setDescription(desc);
                    entry.setLink(thisLink);
                    entry.setAuthor((v.getString("createdByUserLogin")));
                    entries.add(entry);
                }
            }
        }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndEntry

            List<SyndEntry> entries = new ArrayList<SyndEntry>();
            for (SummaryStatBean.StatDataBean dataBean : bean.getData())
            {
                Date date = dataBean.getDate();

                SyndEntry entry = new SyndEntryImpl();
                entries.add(entry);

                // all the feed has the same url... details on the statistics
                // page
                entry.setLink(bean.getStatURL() + "&freq=" + bean.getFreq()
                        + "&date=" + date.getTime());
                // entry.setUri();

                entry.setTitle(MessageFormat
                        .format(localize(msgs, MSG_ENTRY_TITLE, freq, type,
                                null, null), bean.getObjectName(), dataBean
                                .getDate()));

                Calendar c1 = Calendar.getInstance();
                c1.setTime(date);
                if (bean.getFreq() != StatSubscription.FREQUENCY_MONTHLY)
                {
                    c1.add(Calendar.DAY_OF_MONTH, 1);
                }
                else
                {
                    c1.add(Calendar.MONTH, 1);
                }
                date = c1.getTime();
                entry.setPublishedDate(date);
                // date of last change to Item
                entry.setUpdatedDate(dataBean.getDate());

                SyndContent desc = new SyndContentImpl();
                desc.setType("text/html");

                String tmpMessage = "";

                tmpMessage += MessageFormat
                        .format(localize(msgs, MSG_ENTRY_DESCRIPTION, freq,
                                type, AStatComponentService._SELECTED_OBJECT,
                                "view"), dataBean.getPeriodSelectedView(),
                                dataBean.getTotalSelectedView());

                if (dataBean.isShowSelectedObjectDownload())
                {
                    tmpMessage += MessageFormat.format(
                            localize(msgs, MSG_ENTRY_DESCRIPTION, freq, type,
                                    AStatComponentService._SELECTED_OBJECT,
                                    "download"), dataBean
                                    .getPeriodSelectedDownload(), dataBean
                                    .getTotalSelectedDownload());
                }

                for (String key : dataBean.getPeriodAndTotalTopView().keySet())
                {
                    if (dataBean.getPeriodAndTotalTopView().get(key) != null)
                    {
                        if (dataBean.getPeriodAndTotalTopView().get(key).size() > 0)
                        {
                            tmpMessage += MessageFormat.format(
                                    localize(msgs, MSG_ENTRY_DESCRIPTION, freq,
                                            type, key, "view"), dataBean
                                            .getPeriodAndTotalTopView()
                                            .get(key).get(0), dataBean
                                            .getPeriodAndTotalTopView()
                                            .get(key).get(1));
                        }
                        if (dataBean.getPeriodAndTotalTopDownload().get(key) != null)
                        {
                            if (dataBean.getPeriodAndTotalTopDownload()
                                    .get(key).size() > 0)
                            {
                                tmpMessage += MessageFormat.format(
                                        localize(msgs, MSG_ENTRY_DESCRIPTION,
                                                freq, type, key, "download"),
                                        dataBean.getPeriodAndTotalTopDownload()
                                                .get(key).get(0), dataBean
                                                .getPeriodAndTotalTopDownload()
                                                .get(key).get(1));
                            }
                        }

                    }

                }

                String message = MessageFormat.format(
                        localize(msgs, MSG_ENTRY_DESCRIPTION, freq, type, null,
                                null), bean.getObjectName(),
                        dataBean.getDate(), tmpMessage);

                desc.setValue(message);
                entry.setDescription(desc);

                entry.setAuthor(ConfigurationManager
                        .getProperty("webui.feed.stats.authors"));
            }
            feed.setEntries(entries);
        }
    }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndEntry

      JSONArray entries = new JSONArray();
      json.put("Entry", entries);

      int entryCnt = 0;
      for (Object obj : feed.getEntries()) {
        SyndEntry e = (SyndEntry) obj;
        if (entryCnt >= numEntries) {
          break;
        }
        entryCnt++;

        JSONObject entry = new JSONObject();
        entry.put("Title", e.getTitle());
        entry.put("Link", e.getLink());
        if (getSummaries) {
          if (e.getContents() != null && !e.getContents().isEmpty()) {
            entry.put("Summary",
                ((SyndContent)e.getContents().get(0)).getValue());
          } else {
            entry.put("Summary",
                e.getDescription() != null ? e.getDescription().getValue() : "");
          }
        }

        if (e.getUpdatedDate() != null) {
          entry.put("Date", e.getUpdatedDate().getTime());
        } else if (e.getPublishedDate() != null) {
          entry.put("Date", e.getPublishedDate().getTime());
        } else {
          entry.put("Date", 0);
        }

        // if no author at feed level, use the first entry author
        if (jsonAuthor == null) {
          jsonAuthor = e.getAuthor();
        }

        entries.put(entry);
      }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndEntry

    {
      PathElement pe = (PathElement)element;
     
      if (pe.getData() instanceof SyndEntry)
      {
        SyndEntry entry = (SyndEntry)pe.getData();
       
        return entry.getTitle();
      }
      else if (pe.getData() instanceof SyndFeed)
      {
        SyndFeed feed = (SyndFeed)pe.getData();
       
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndEntry

                    // Create the feed
                    feed = new SyndFeedImpl();
                    feed.setTitle("Feed");
                   
                    for (org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object> entry: collection) {
                        SyndEntry feedEntry = createFeedEntry(entry);
                        feed.getEntries().add(feedEntry);
                    }
                }
            }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndEntry

        Object key = entry.getKey();
        Object data = entry.getData();
        if (data instanceof Item) {
            Item item = (Item)data;
           
            SyndEntry feedEntry = new SyndEntryImpl();
            feedEntry.setUri(key.toString());
            feedEntry.setTitle(item.getTitle());
   
            String value = item.getContents();
            if (value != null) {
                SyndContent content = new SyndContentImpl();
                content.setType("text/xml");
                content.setValue(value);
                List<SyndContent> contents = new ArrayList<SyndContent>();
                contents.add(content);
                feedEntry.setContents(contents);
            }
   
            String href = item.getLink();
            if (href == null) {
                href = key.toString();
            }
            SyndLink link = new SyndLinkImpl();
            link.setRel("edit");
            link.setHref(href);
            feedEntry.getLinks().add(link);
            link = new SyndLinkImpl();
            link.setRel("alternate");
            link.setHref(href);
            feedEntry.getLinks().add(link);
   
            Date date = item.getDate();
            if (date == null) {
                date = new Date();
            }
            feedEntry.setPublishedDate(date);
            return feedEntry;
           
        } else if (data != null) {
            SyndEntry feedEntry = new SyndEntryImpl();
            feedEntry.setUri(key.toString());
            feedEntry.setTitle("item");
   
            // Convert the item to XML
            String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();
           
            SyndContent content = new SyndContentImpl();
            content.setType("text/xml");
            content.setValue(value);
            List<SyndContent> contents = new ArrayList<SyndContent>();
            contents.add(content);
            feedEntry.setContents(contents);
   
            SyndLink link = new SyndLinkImpl();
            link.setRel("edit");
            link.setHref(key.toString());
            feedEntry.getLinks().add(link);
            link = new SyndLinkImpl();
            link.setRel("alternate");
            link.setHref(key.toString());
            feedEntry.getLinks().add(link);
   
            feedEntry.setPublishedDate(new Date());
            return feedEntry;
        } else {
            return null;
        }
    }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndEntry

     */
    public double getExchangeRate(String currency) {
        try {
            System.out.println("Retrieving exchange rate...");
            SyndFeed feed = exchangeRate.getRates();
            SyndEntry entry = (SyndEntry)feed.getEntries().get(0);
            String rateTable = entry.getDescription().getValue();

            Document doc = builder.parse(new ByteArrayInputStream(rateTable.getBytes()));
            Node node = doc.getDocumentElement();
            XPath path = XPathFactory.newInstance().newXPath();
            XPathExpression exp = path.compile("/TABLE/TR[TD[1]='" + currency.toUpperCase() + "']/TD[2]");
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndEntry

    public CustomerCollectionImpl() {

        for (int i = 0; i < 4; i++) {
            String id = "urn:uuid:customer-" + UUID.randomUUID().toString();

            SyndEntry entry = new SyndEntryImpl();
            entry.setTitle("customer " + "Jane Doe_" + String.valueOf(i));
            entry.setUri(id);

            SyndContent content = new SyndContentImpl();
            content.setValue("Jane Doe_" + String.valueOf(i));
            content.setType(Content.TEXT);
            entry.setContents(Collections.singletonList(content));

            List<SyndLink> links = new ArrayList<SyndLink>();
            SyndLink link = new SyndLinkImpl();
            link.setRel("edit");
            link.setHref("" + id);
            links.add(link);
            entry.setLinks(links);

            links = new ArrayList<SyndLink>();
            link = new SyndLinkImpl();
            link.setRel("alternate");
            link.setHref("" + id);
            links.add(link);
            entry.setLinks(links);

            entry.setPublishedDate(new Date());

            entries.put(id, entry);
            System.out.println(">>> id=" + id);
        }
    }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndEntry

        System.out.println(">>> get collection");
        SyndFeed feed = resourceCollection.getFeed();
        System.out.println("<<< get collection");
        for (Object o : feed.getEntries()) {
            SyndEntry e = (SyndEntry)o;
            System.out.println("id = " + e.getUri() + " entry = " + e.getTitle());
        }
    }
View Full Code Here

Examples of com.sun.syndication.feed.synd.SyndEntry

        super(type);
    }
    protected SyndEntry createSyndEntry(Item item) {
        DCModule dcm = (DCModule)item.getModule(DCModule.URI);
        Date dcdate = dcm != null ? dcm.getDate() : null;
        SyndEntry syndEntry = super.createSyndEntry(item);
        if (dcdate != null)
        {
            ((DCModule)syndEntry.getModule(DCModule.URI)).setDate(dcdate);
        }
        return syndEntry;
    }
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.