org.hackystat.sensorbase.resource.projects
Class ProjectUtils

java.lang.Object
  extended by org.hackystat.sensorbase.resource.projects.ProjectUtils

public class ProjectUtils
extends java.lang.Object

Methods that really should be part of the Project JAXB class, but I don't know how to extend that class with additional methods.

Author:
Philip Johnson

Constructor Summary
ProjectUtils()
           
 
Method Summary
static boolean isValidEndTime(Project project, javax.xml.datatype.XMLGregorianCalendar date)
          Returns true if the passed date falls within the project end date.
static boolean isValidInterval(Project project, javax.xml.datatype.XMLGregorianCalendar start, javax.xml.datatype.XMLGregorianCalendar end)
          Returns true if the start and end date constitute a valid project interval.
static boolean isValidStartTime(Project project, javax.xml.datatype.XMLGregorianCalendar date)
          Returns true if the passed date falls within the project start date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectUtils

public ProjectUtils()
Method Detail

isValidStartTime

public static boolean isValidStartTime(Project project,
                                       javax.xml.datatype.XMLGregorianCalendar date)
Returns true if the passed date falls within the project start date. Due to time zones and other issues, we are going to be lenient with the definition. Basically, we will accept the day before the project start date, and any day afterwards.

Parameters:
project - The project.
date - The date of interest.
Returns:
True if date is after the day before the project start date.

isValidEndTime

public static boolean isValidEndTime(Project project,
                                     javax.xml.datatype.XMLGregorianCalendar date)
Returns true if the passed date falls within the project end date. Due to time zones and other issues, we will accept the day after the official project end date as well.

Parameters:
project - The project.
date - The date of interest.
Returns:
True if date is less than to equal to the project start date.

isValidInterval

public static boolean isValidInterval(Project project,
                                      javax.xml.datatype.XMLGregorianCalendar start,
                                      javax.xml.datatype.XMLGregorianCalendar end)
Returns true if the start and end date constitute a valid project interval. This means that isValidStartDate() and isValidEndDate() return true, and that start is less than end.

Parameters:
project - The project.
start - The proposed start date.
end - The proposed end date.
Returns:
True if start and end are acceptable according to the project definition.