}
}
protected GetSubscriptionResults buildGetSubscriptionResults(Subscription subscription, Date endPoint)
throws DispositionReportFaultMessage, DatatypeConfigurationException {
GetSubscriptionResults getSubscriptionResults = null;
Date startPoint = subscription.getLastNotified();
if (startPoint==null) startPoint = new Date(0);
Duration duration = TypeConvertor.convertStringToDuration(subscription.getNotificationInterval());
Date nextDesiredNotificationDate = new Date(startPoint.getTime());
duration.addTo(nextDesiredNotificationDate);
if (subscription.getLastNotified()==null || nextDesiredNotificationDate.after(startPoint) && nextDesiredNotificationDate.before(endPoint)) {
getSubscriptionResults = new GetSubscriptionResults();
CoveragePeriod period = new CoveragePeriod();
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTimeInMillis(startPoint.getTime());
period.setStartPoint(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
calendar.setTimeInMillis(endPoint.getTime());
period.setEndPoint(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
getSubscriptionResults.setCoveragePeriod(period);
}
return getSubscriptionResults;
}