Package org.joda.time

Examples of org.joda.time.LocalTime


    @Test
    public void testStringToLocalTime() {
        String dateTimeAsString = "00:00";
        Target target = new Target();
        target.setLocalTime( dateTimeAsString );
        LocalTime sourceTime =
            new LocalTime( 0, 0 );

        Source src = SourceTargetMapper.INSTANCE.targetToSourceLocalTimeMapped( target );
        assertThat( src ).isNotNull();
        assertThat( src.getLocalTime() ).isEqualTo( sourceTime );
    }
View Full Code Here


        Source src = SourceTargetMapper.INSTANCE.targetToSource( target );

        assertThat( src.getDateTime() ).isEqualTo( new DateTime( 2014, 1, 1, 0, 0, DateTimeZone.UTC ) );
        assertThat( src.getLocalDateTime() ).isEqualTo( new LocalDateTime( 2014, 1, 1, 0, 0 ) );
        assertThat( src.getLocalDate() ).isEqualTo( new LocalDate( 2014, 1, 1 ) );
        assertThat( src.getLocalTime() ).isEqualTo( new LocalTime( 0, 0 ) );
    }
View Full Code Here

                Employee employee = createEmployee();

                createMissions();

                Period period = new Period();
                period.start = new LocalTime(4, 0);
                period.end = new LocalTime(7, 0);
                period.mission = Mission.byCode("M0");

                // Morning
                HalfDay morning = new HalfDay();
                morning.addPeriod(period);
View Full Code Here

        checkValue(path, node, "a time");
        if (!node.isTextual()) {
            throw new IllegalArgumentException(formatExMsg(path, "is not a time"));
        }
        final String textValue = node.getTextValue();
        final LocalTime localTime = _HHmmss.parseLocalTime(textValue + "Z");
        return new java.util.Date(localTime.getMillisOfDay());
    }
View Full Code Here

               
                DateTime nextDateTime = start.minuteOfDay().roundFloorCopy();
                while (nextDateTime.isBefore(end)) {
                   
                    //get/create TimeDimension
                    final LocalTime localTime = nextDateTime.toLocalTime();
                    TimeDimension td = times.get(localTime);
                    if (td == null) {
                        td = timeDimensionDao.createTimeDimension(localTime);
                        times.put(localTime, td);
                    }
View Full Code Here

    @Test
    public void populateSomeTimeDimensions() {
        final Builder<Object> existingTimeDimensionBuilder = ImmutableList.builder();
       
        TimeDimension td = mock(TimeDimension.class);
        when(td.getTime()).thenReturn(new LocalTime(0, 1));
        existingTimeDimensionBuilder.add(td);
       
        final List<TimeDimension> existingTimeDimensions = ImmutableList.of(
                createMockTimeDimension(new LocalTime(0, 1)),
                createMockTimeDimension(new LocalTime(0, 2)),
                createMockTimeDimension(new LocalTime(0, 3)),
                createMockTimeDimension(new LocalTime(0, 4)),
                createMockTimeDimension(new LocalTime(0, 7)),
                createMockTimeDimension(new LocalTime(0, 8)),
                createMockTimeDimension(new LocalTime(0, 9)),
                createMockTimeDimension(new LocalTime(1, 23)),
                createMockTimeDimension(new LocalTime(23, 58))
            );
       
        when(timeDimensionDao.getTimeDimensions()).thenReturn(existingTimeDimensions);
       
        this.portalEventDimensionPopulator.doPopulateTimeDimensions();
View Full Code Here

                start = interval.determineStart(instant);
                end = interval.determineEnd(start);
            }
        }
       
        final LocalTime startTime = start.toLocalTime();
        final TimeDimension startTimeDimension = this.timeDimensionDao.getTimeDimensionByTime(startTime);

        final DateMidnight startDateMidnight = start.toDateMidnight();
        final DateDimension startDateDimension = this.dateDimensionDao.getDateDimensionByDate(startDateMidnight);
       
View Full Code Here

        else {
            this.logger.debug("Found expected " + timeDimensions.size() + " time dimensions");
            return;
        }
           
        LocalTime nextTime = new LocalTime(0, 0);
        final LocalTime lastTime = new LocalTime(23, 59);
       
        for (final TimeDimension timeDimension : timeDimensions) {
            LocalTime dimensionTime = timeDimension.getTime();
            if (nextTime.isBefore(dimensionTime)) {
                do {
                    checkShutdown();
                    this.timeDimensionDao.createTimeDimension(nextTime);
                    nextTime = nextTime.plusMinutes(1);
                } while (nextTime.isBefore(dimensionTime));
            }
            else if (nextTime.isAfter(dimensionTime)) {
                do {
                    checkShutdown();
                    this.timeDimensionDao.createTimeDimension(dimensionTime);
                    dimensionTime = dimensionTime.plusMinutes(1);
                } while (nextTime.isAfter(dimensionTime));
            }
           
            nextTime = dimensionTime.plusMinutes(1);
        }
       
        //Add any missing times from the tail
        while (nextTime.isBefore(lastTime) || nextTime.equals(lastTime)) {
            checkShutdown();
View Full Code Here

    }
   
    @Test
    public void LocalTime() {
        TimePath<LocalTime> entity = new TimePath<LocalTime>(LocalTime.class, "entity");
        query.from(entity, Arrays.asList(new LocalTime(), new LocalTime(0l)))
             .list(entity.hour(), entity.minute(), entity.second(), entity.milliSecond());
    }
View Full Code Here

    }

    @Override
    public LocalTime getValue(ResultSet rs, int startIndex) throws SQLException {
        Time time = rs.getTime(startIndex, utc());
        return time != null ? new LocalTime(time.getTime(), DateTimeZone.UTC) : null;
    }
View Full Code Here

TOP

Related Classes of org.joda.time.LocalTime

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.