Package hirondelle.web4j.model

Examples of hirondelle.web4j.model.DateTime


    }
  }
 
  private Float getUptime(HttpServletRequest aRequest){
    TimeZone tz = (TimeZone)getExistingSession().getServletContext().getAttribute(Controller.TIME_ZONE);
    DateTime now = DateTime.now(tz);
    DateTime startup = getStartTime();
    int SECONDS_PER_DAY = 86400;
    return new Float(startup.numSecondsFrom(now)/SECONDS_PER_DAY);
  }
View Full Code Here


    }
    return result;
  }
 
  private DateTime parseDateTime(String aInputValue, Pattern aRegex){
    DateTime result = null;
    Matcher matcher = aRegex.matcher(aInputValue);
    if( matcher.matches() ) {
      DateTimeParts parts = getParts(matcher);
      Integer year = new Integer(parts.year);
      Integer month = new Integer(parts.month);
      Integer day = new Integer(parts.day);
      String hour = parts.hour;
      String minute = parts.minute;
      if( hour == null ){
        result = DateTime.forDateOnly(year, month, day);
      }
      else {
        Integer hourVal = new Integer(hour);
        Integer minuteVal = new Integer(minute);
        result = new DateTime(year, month, day, hourVal, minuteVal, null, null);
      }
    }
    return result;
  }
View Full Code Here

      Calendar calendar = new GregorianCalendar(aYear, aMonth - 1, aDay, aHour, aMinute);
      return calendar.getTime();
    }

    private void testFormatDateTime(String aDateTime, String aExpected){
      DateTime dt = new DateTime(aDateTime);
      DateConverter converter = new DateConverterImpl();
      String actual = converter.formatEyeFriendlyDateTime(dt, null);
      if(!actual.equals(aExpected)){
        fail("Actual:'"+ actual + "' Expected:'" + aExpected + "'");
      }
View Full Code Here

        fail("Actual:'"+ actual + "' Expected:'" + aExpected + "'");
      }
    }
   
    private void testParseEyeDateTime(String aInput, String aExpected){
      DateTime expected = new DateTime(aExpected);
      DateConverter converter = new DateConverterImpl();
      DateTime actual = converter.parseEyeFriendlyDateTime(aInput, null);
      if(!actual.equals(expected)){
        fail("Actual:" + actual + " Expected:" + aExpected);
      }
    }
View Full Code Here

        fail("Actual:" + actual + " Expected:" + aExpected);
      }
    }
   
    private void testParseHandDateTime(String aInput, String aExpected){
      DateTime expected = new DateTime(aExpected);
      DateConverter converter = new DateConverterImpl();
      DateTime actual = converter.parseHandFriendlyDateTime(aInput, null);
      if(actual == null){
        fail("Failed to parse the input '" + aInput + "'");
      }
      else if(!actual.equals(expected)){
        fail("Actual:" + actual + " Expected:" + aExpected);
      }
    }
View Full Code Here

    String month;
    String day;
  }
 
  private DateTime parseDateTime(String aInputValue, Pattern aRegex){
    DateTime result = null;
    Matcher matcher = aRegex.matcher(aInputValue);
    if( matcher.matches() ) {
      DateTimeParts parts = getParts(matcher);
      Integer year = new Integer(parts.year);
      Integer month = new Integer(parts.month);
View Full Code Here

   The outcome date is calculated from the old record and the new one.
   If there is a change in the outcome, then a new outcome date is applied.
   Otherwise, the outcome date is coerced to the old one (which may be null)
  */
  private DateTime getOutcomeDate(Prediction aNew, Prediction aOld, DateTime aToday){
    DateTime result = aOld.getOutcomeDate(); //may be null
    if (hasChangedOutcome(aOld, aNew)) {
      if( aNew.getOutcome() != null ){
        result = aToday;
      }
      else {
View Full Code Here

    String result = null;
    if ( aObject == null ){
      result = Consts.EMPTY_STRING;
    }
    else if ( aObject instanceof DateTime ){
      DateTime dateTime = (DateTime)aObject;
      result = fDateConverter.formatEyeFriendlyDateTime(dateTime, fLocale);
    }
    else if ( aObject instanceof Date ){
      Date date = (Date)aObject;
      result = fDateConverter.formatEyeFriendly(date, fLocale, fTimeZone);
View Full Code Here

    }
    else if (aObject instanceof String) {
      result = aObject.toString();
    }
    else if ( aObject instanceof DateTime ){
      DateTime dateTime = (DateTime)aObject;
      result = fDateConverter.formatEyeFriendlyDateTime(dateTime, fLocale);
    }
    else if ( aObject instanceof Date ){
      Date date = (Date)aObject;
      result = fDateConverter.formatEyeFriendly(date, fLocale, fTimeZone);
View Full Code Here

        result = cal.getTime();
      }
      return result;
    }
    private DateTime parseDateTime(String aInputValue, Pattern aRegex){
      DateTime result = null;
      Matcher matcher = aRegex.matcher(aInputValue);
      if( matcher.matches() ) {
        Integer month = new Integer(matcher.group(Regex.FIRST_GROUP));
        Integer day = new Integer(matcher.group(Regex.SECOND_GROUP));
        Integer year = new Integer( matcher.group(Regex.THIRD_GROUP) );
View Full Code Here

TOP

Related Classes of hirondelle.web4j.model.DateTime

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.