public ConnectionRecordSearchTerm(String term){
  if (term == null)   throw new NullPointerException("Search terms may not be null");
  this.term=term;
  Matcher matcher=DATE_PATTERN.matcher(term);
  if (matcher.matches()) {
    String year=matcher.group(YEAR_GROUP);
    String month=matcher.group(MONTH_GROUP);
    String day=matcher.group(DAY_GROUP);
    Calendar startCalendar=Calendar.getInstance();
    startCalendar.clear();
    startCalendar.set(Integer.parseInt(year),parseInt(month,1) - 1,parseInt(day,1));
    Calendar endCalendar;
    if (month == null) {
      endCalendar=getEndOfYear(startCalendar);
    }
 else     if (day == null) {
      endCalendar=getEndOfMonth(startCalendar);
    }
 else {
      endCalendar=getEndOfDay(startCalendar);
    }
    this.startDate=startCalendar.getTime();
    this.endDate=endCalendar.getTime();
  }
 else {
    this.startDate=null;
    this.endDate=null;
  }
}

public ConnectionRecordSearchTerm ( String term ) { if ( term == null ) throw new NullPointerException ( "Search terms may not be null" ) ; this . term = term ; Matcher matcher = DATE_PATTERN . matcher ( term ) ; if ( matcher . matches ( ) ) { String year = matcher . group ( YEAR_GROUP ) ; String month = matcher . group ( MONTH_GROUP ) ; String day = matcher . group ( DAY_GROUP ) ; Calendar startCalendar = Calendar . getInstance ( ) ; startCalendar . clear ( ) ; startCalendar . set ( Integer . parseInt ( year ) , parseInt ( month , 1 ) - 1 , parseInt ( day , 1 ) ) ; Calendar endCalendar ; if ( month == null ) { endCalendar = getEndOfYear ( startCalendar ) ; } else if ( day == null ) { endCalendar = getEndOfMonth ( startCalendar ) ; } else { endCalendar = getEndOfDay ( startCalendar ) ; } this . startDate = startCalendar . getTime ( ) ; this . endDate = endCalendar . getTime ( ) ; } else { this . startDate = null ; this . endDate = null ; } }
creates a new connectionrecordsearchterm representing the given string . if the given string appears to be a date , the start and end dates of the implied date range will be automatically determined and made available via getstartdate ( ) and getenddate ( ) respectively .
