Examples of PeriodFormatter


Examples of org.joda.time.format.PeriodFormatter

        return runningDurationMillis == null ? "No duration recorded" : convert(runningDurationMillis.longValue());
    }

    private String convert(long runningDurationMillis) {
        Duration duration = new Duration(runningDurationMillis);
        PeriodFormatter formatter = PeriodFormat.getDefault();
        return formatter.print(duration.toPeriod());
    }
View Full Code Here

Examples of org.joda.time.format.PeriodFormatter

      ActionInvocation invocation = new ActionInvocation(action);


      DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm:ss");

      PeriodFormatter pFormatter= new PeriodFormatterBuilder()
      .printZeroAlways()
      .appendHours()
      .appendSeparator(":")
      .appendMinutes()
      .appendSeparator(":")
      .appendSeconds()
      .toFormatter();


      try {
        invocation.setInput("ID",Integer.toString(alarm.getID()));
        invocation.setInput("StartLocalTime",formatter.print(alarm.getStartTime()));
        invocation.setInput("Duration",pFormatter.print(alarm.getDuration()));
        invocation.setInput("Recurrence",alarm.getRecurrence());
        invocation.setInput("RoomUUID",alarm.getRoomUUID());
        invocation.setInput("ProgramURI",alarm.getProgramURI());
        invocation.setInput("ProgramMetaData",alarm.getProgramMetaData());
        invocation.setInput("PlayMode",alarm.getPlayMode());
View Full Code Here

Examples of org.joda.time.format.PeriodFormatter

      Service service = device.findService(new UDAServiceId("AVTransport"));
      Action action = service.getAction("SnoozeAlarm");
      ActionInvocation invocation = new ActionInvocation(action);

      Period snoozePeriod = Period.minutes(minutes);
      PeriodFormatter pFormatter= new PeriodFormatterBuilder()
      .printZeroAlways()
      .appendHours()
      .appendSeparator(":")
      .appendMinutes()
      .appendSeparator(":")
      .appendSeconds()
      .toFormatter();

      try {
        invocation.setInput("Duration",pFormatter.print(snoozePeriod));
      } catch (InvalidValueException ex) {
        logger.error("Action Invalid Value Exception {}",ex.getMessage());
      } catch (NumberFormatException ex) {
        logger.error("Action Invalid Value Format Exception {}",ex.getMessage())
      }
View Full Code Here

Examples of org.joda.time.format.PeriodFormatter

          DateTimeFormatter formatter = DateTimeFormat.forPattern("HH:mm:ss");
          finalStartTime = formatter.parseDateTime(startTime);
          LocalTime localDateTime = finalStartTime.toLocalTime();
          finalStartTime = localDateTime.toDateTimeToday();
         
           PeriodFormatter pFormatter= new PeriodFormatterBuilder()
             .appendHours()
             .appendSeparator(":")
             .appendMinutes()
             .appendSeparator(":")
             .appendSeconds()
             .toFormatter();
         
          finalDuration = pFormatter.parsePeriod(duration);   
        } catch(Exception e) {
          logger.error("Error parsing DateTime");
        }
       
        alarms.add(new SonosAlarm(finalID,  finalStartTime,  finalDuration,  recurrence,
View Full Code Here

Examples of org.joda.time.format.PeriodFormatter

    if (myWaitAfterLastMessageString == null) {
      logger().debug("No JR_WAIT_AFTER_LAST_MESSAGE property found on message (message={})", getName());
      return null;
    }
   
    PeriodFormatter myPeriodFormatter = ISOPeriodFormat.standard();
    try {
      long myDuration = myPeriodFormatter.parsePeriod(myWaitAfterLastMessageString).toStandardDuration().getMillis();
      return myDuration;
    }
    catch (IllegalArgumentException e) {
      logger().error("Unable to parse JR_WAIT_AFTER_LAST_MESSAGE value for (message={}), value was: \"{}\"  (this is a problem you need to fix!!! e.g. for one day, use \"P1D\")", new Object[] { getName(), myWaitAfterLastMessageString });
      throw new IllegalArgumentException("Error parsing JR_WAIT_AFTER_LAST_MESSAGE value: " + myWaitAfterLastMessageString, e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.