Esri / geoportal-server

Geoportal Server is a standards-based, open source product that enables discovery and use of geospatial resources including data and services.
https://gptogc.esri.com/geoportal
Apache License 2.0
245 stars 149 forks source link

Synchronization rule not correct #275

Open gcampanile opened 7 years ago

gcampanile commented 7 years ago

Ther's an error in one of the rules for harvesting "at a date": when inserting both an occurrence AND a day of the week, the rule appears for example as: Every 2 FRIDAY at 6.30 The class DayOfTheWeekInTheMonthEvent.java has a calculation error: public Date getNextEventDate(Date lastHarvestDate) { Calendar req = Calendar.getInstance(); req.set(Calendar.DAY_OF_WEEK_IN_MONTH, (7*dayOfTheMonth)+dayOfTheWeek.getCalendarDay()); req.set(Calendar.HOUR_OF_DAY, timeOfTheDay.getHours()); req.set(Calendar.MINUTE, timeOfTheDay.getMinutes()); req.set(Calendar.SECOND, 0); req.set(Calendar.MILLISECOND, 0);

Will not create the required date. The lines should be: public Date getNextEventDate(Date lastHarvestDate) { Calendar req = Calendar.getInstance(); req.set(Calendar.DAY_OF_MONTH, dayOfTheMonth); req.set(Calendar.DAY_OF_WEEK, dayOfTheWeek.getCalendarDay()); req.set(Calendar.HOUR_OF_DAY, timeOfTheDay.getHours()); req.set(Calendar.MINUTE, timeOfTheDay.getMinutes()); req.set(Calendar.SECOND, 0); req.set(Calendar.MILLISECOND, 0);

In addition it would be useful to insert soem check on the page to avoid inconsisent inputs, like for example the 100 day of the month or similar