private URL buildDateGraph() throws IOException {
Distribution distribution = new Distribution();
for (Resource resource : getResources()) {
// Examine the ddms:dates element (optional field with optional attributes)
// Ignores ddms:DateHourMinType dates, which were introduced in DDMS 4.1, to simplify example
Dates dates = resource.getDates();
if (dates != null) {
if (dates.getCreated() != null)
distribution.incrementCount(String.valueOf(dates.getCreated().getYear()));
if (dates.getPosted() != null)
distribution.incrementCount(String.valueOf(dates.getPosted().getYear()));
if (dates.getValidTil() != null)
distribution.incrementCount(String.valueOf(dates.getValidTil().getYear()));
if (dates.getInfoCutOff() != null)
distribution.incrementCount(String.valueOf(dates.getInfoCutOff().getYear()));
if (dates.getApprovedOn() != null)
distribution.incrementCount(String.valueOf(dates.getApprovedOn().getYear()));
if (dates.getReceivedOn() != null)
distribution.incrementCount(String.valueOf(dates.getReceivedOn().getYear()));
}
// Resource createDate (required field in 3.0, 4.0.1, and 4.1, optional in 2.0)
if (resource.getCreateDate() != null)
distribution.incrementCount(String.valueOf(resource.getCreateDate().getYear()));