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);
}
}