=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java 2014-04-26 06:11:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java 2014-04-26 06:29:49 +0000 @@ -79,7 +79,7 @@ DateUnit fromIso( DateUnit dateUnit ); /** - * Returns this local year as a ISO 8601 interval + * Gets this local year as a ISO 8601 interval * @param year Local year * @return ISO 8601 interval for year * @see http://en.wikipedia.org/wiki/ISO_8601 @@ -87,7 +87,7 @@ DateInterval toIsoInterval( int year ); /** - * Returns this local year/month as a ISO 8601 interval + * Gets this local year/month as a ISO 8601 interval * @param year Local year * @param month Local month * @return ISO 8601 interval for year/month @@ -96,37 +96,37 @@ DateInterval toIsoInterval( int year, int month ); /** - * Returns current date as local DateUnit + * Gets current date as local DateUnit * @return Today date as local DateUnit */ DateUnit today(); /** - * Returns the number of months in a calendar year. + * Gets the number of months in a calendar year. * @return Number of months in a year */ int monthsInYear(); /** - * Returns the number of days in a calendar week. + * Gets the number of days in a calendar week. * @return Number of days in a week */ int daysInWeek(); /** - * Returns the number of days in a calendar year. + * Gets the number of days in a calendar year. * @return Number of days in this calendar year */ int daysInYear( int year ); /** - * Returns the number of days in a calendar year/month. + * Gets the number of days in a calendar year/month. * @return Number of days in this calendar year/month */ int daysInMonth( int year, int month ); /** - * Returns week number using local DateUnit, week number is calculated based on + * Gets week number using local DateUnit, week number is calculated based on * ISO 8601 week numbers * @param dateUnit DateUnit representing local year, month, day * @return Week number @@ -143,7 +143,7 @@ int week( DateUnit dateUnit ); /** - * Returns the ISO 8601 weekday for this local DateUnit, using ISO 8601 day numbering, + * Gets the ISO 8601 weekday for this local DateUnit, using ISO 8601 day numbering, * 1=Monday => 7=Sunday. * @param dateUnit DateUnit representing local year, month, day * @return Weekday number @@ -153,10 +153,12 @@ int isoWeekday( DateUnit dateUnit ); /** - * Returns the local weekday for this local DateUnit, using ISO 8601 day numbering, + * Gets the local weekday for this local DateUnit, using ISO 8601 day numbering, * 1=Monday => 7=Sunday. * @param dateUnit DateUnit representing local year, month, day * @return Weekday number + * @see http://en.wikipedia.org/wiki/ISO_8601 + * @see http://en.wikipedia.org/wiki/ISO_week_date */ int weekday( DateUnit dateUnit ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarService.java 2014-04-25 13:14:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/CalendarService.java 2014-04-26 06:29:49 +0000 @@ -31,11 +31,21 @@ import java.util.List; /** + * Simple service for returning all available calendars, and also giving the current system calendar. * @author Morten Olav Hansen + * @see Calendar */ public interface CalendarService { + /** + * Gets all available calendars as a sorted list. + * @return All available calendars + */ List getAll(); + /** + * Gets the currently selected system calendar. + * @return System calendar + */ Calendar getSystemCalendar(); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateInterval.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateInterval.java 2014-04-25 06:29:27 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateInterval.java 2014-04-26 06:29:49 +0000 @@ -28,13 +28,26 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import javax.validation.constraints.NotNull; + /** + * Class representing a date interval. * @author Morten Olav Hansen + * @see DateUnit + * @see Calendar */ public class DateInterval { + /** + * Start of interval. Required. + */ + @NotNull private final DateUnit from; + /** + * End of interval. Required. + */ + @NotNull private final DateUnit to; public DateInterval( DateUnit from, DateUnit to ) === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.java 2014-04-24 16:21:52 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.java 2014-04-26 06:29:49 +0000 @@ -32,17 +32,37 @@ import org.joda.time.DateTime; import org.joda.time.chrono.ISOChronology; +import javax.validation.constraints.NotNull; + /** + * Class representing a specific calendar date. * @author Morten Olav Hansen + * @see DateInterval + * @see Calendar */ public class DateUnit { + /** + * Year of date. Required. + */ + @NotNull int year; + /** + * Month of date. Required. + */ + @NotNull int month; + /** + * Day of date. Required. + */ + @NotNull int day; + /** + * Day of week, numbering is unspecified and left up to user. + */ int dayOfWeek; public DateUnit()