throws IOException, ServletException
{
ActionForward forward = mapping.findForward("exportEntries.page");
try
{
RollerRequest rreq = RollerRequest.getRollerRequest(request);
RollerSession rses = RollerSession.getRollerSession(rreq.getRequest());
WeblogEntryManagementForm form = (WeblogEntryManagementForm)actionForm;
if ( rreq.getWebsite() != null
&& rses.isUserAuthorizedToAdmin(rreq.getWebsite()) )
{
request.setAttribute("model",
new BasePageModel("", request, response, mapping));
Locale locale = Locale.getDefault();//rreq.getWebsite().getLocaleInstance();
final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
Date startDate;
Date endDate;
try
{
startDate = DateUtil.getStartOfDay(df.parse(form.getStartDateString()));
endDate = DateUtil.getEndOfDay(df.parse(form.getEndDateString()));
}
catch (ParseException e)
{
throw new RollerException("ERROR parsing date:" + e.getMessage());
}
if (startDate != null && endDate != null)
{
// this work should go into a Thread!
WeblogManager weblogMgr =
RollerFactory.getRoller().getWeblogManager();
//List entries = weblogMgr.getWeblogEntriesInDateRange(
//rreq.getUser().getUserName(), null, startDate, endDate, false);
//System.out.println("Export: got " + entries.size() + " entries.");
List entries = weblogMgr.getWeblogEntries(
rreq.getWebsite(), // userName
startDate, // startDate
endDate, // endDate
null, // catName
null, // status
null, // sortby (null for pubtime)
null); // maxEntries
ActionMessages messages = writeSuccessMessage(request, response, rreq, form);
// seperate the entries as specified: day, month, year
Map entryMap = seperateByPeriod(entries, form.getFileBy());
// now export each List in the entryMap
ExportRss exporter = new ExportRss(rreq.getWebsite());
String exportTo = form.getExportFormat().toLowerCase();
if ("atom".equals(exportTo))
{
exporter.setExportAtom(true);
}