Package org.joda.time

Examples of org.joda.time.DateMidnight.monthOfYear()


        linkHeader.addLink(null, SELF, self, null);

        DateMidnight prevMonth = yearMonth.minusMonths(1);
        DateMidnight nextMonth = yearMonth.plusMonths(1);
        boolean hasPrev = repository.hasActivitiesByYearMonth(prevMonth.year().get(), prevMonth.monthOfYear().get());
        boolean hasNext = repository.hasActivitiesByYearMonth(nextMonth.year().get(), nextMonth.monthOfYear().get());
        if (hasPrev)
        {
            String prev = uriInfo.getBaseUriBuilder().path("activities")
                    .segment(String.valueOf(prevMonth.year().get()), String.valueOf(prevMonth.monthOfYear().get()))
                    .build().toASCIIString();
View Full Code Here


            linkHeader.addLink(null, PREV, prev, null);
        }
        if (hasNext)
        {
            String next = uriInfo.getBaseUriBuilder().path("activities")
                    .segment(String.valueOf(nextMonth.year().get()), String.valueOf(nextMonth.monthOfYear().get()))
                    .build().toASCIIString();
            linkHeader.addLink(null, NEXT, next, null);
        }

        Response.ResponseBuilder response;
View Full Code Here

    public Response activitiesForYearMonthDay(@PathParam("year") int year, @PathParam("month") int month,
            @PathParam("day") int day)
    {
        DateMidnight yearMonthDay = new DateMidnight(year, month, day, settings.get().getTimeZone());
        Activities activities = activitiesConverter.toModel(yearMonthDay, DAY,
                repository.findByYearMonthDay(yearMonthDay.year().get(), yearMonthDay.monthOfYear().get(), yearMonthDay
                        .dayOfMonth().get()));
        return addLinksForYearMonthDay(activities, yearMonthDay);
    }

    @GET
View Full Code Here

    @Path("/{year:\\d{4}}/{month:\\d{1,2}}/{day:\\d{1,2}}/duration")
    public Duration minutesForYearMonthDay(@PathParam("year") int year, @PathParam("month") int month,
            @PathParam("day") int day)
    {
        DateMidnight date = new DateMidnight(year, month, day, settings.get().getTimeZone());
        return minutes(repository.findByYearMonthDay(date.year().get(), date.monthOfYear().get(), date
                .dayOfMonth().get()));
    }

    @GET
    @Path("/today")
View Full Code Here

    @Path("/today")
    public Response activitiesForToday()
    {
        DateMidnight now = now(settings.get().getTimeZone());
        Activities activities = activitiesConverter.toModel(now, DAY,
                repository.findByYearMonthDay(now.year().get(), now.monthOfYear().get(), now
                        .dayOfMonth().get()));
        return addLinksForYearMonthDay(activities, now);
    }

    @GET
View Full Code Here

    @Produces(TEXT_PLAIN)
    @Path("/today/duration")
    public Duration minutesForToday()
    {
        DateMidnight date = now(settings.get().getTimeZone());
        return minutes(repository.findByYearMonthDay(date.year().get(), date.monthOfYear().get(), date
                .dayOfMonth().get()));
    }

    private Response addLinksForYearMonthDay(Activities activities, DateMidnight yearMonthDay)
    {
View Full Code Here

        DateMidnight prevDay = yearMonthDay.minusDays(1);
        DateMidnight nextDay = yearMonthDay.plusDays(1);
        boolean hasPrev = repository.hasActivitiesByYearMonthDay(prevDay.year().get(), prevDay.monthOfYear().get(),
                prevDay.dayOfMonth().get());
        boolean hasNext = repository.hasActivitiesByYearMonthDay(nextDay.year().get(), nextDay.monthOfYear().get(),
                nextDay.dayOfMonth().get());
        if (hasPrev)
        {
            String prev = uriInfo
                    .getBaseUriBuilder()
View Full Code Here

        if (hasNext)
        {
            String next = uriInfo
                    .getBaseUriBuilder()
                    .path("activities")
                    .segment(String.valueOf(nextDay.year().get()), String.valueOf(nextDay.monthOfYear().get()),
                            String.valueOf(nextDay.dayOfMonth().get())).build().toASCIIString();
            linkHeader.addLink(null, NEXT, next, null);
        }

        Response.ResponseBuilder response;
View Full Code Here

    @Path("/current/durations")
    public Response minutesForCurrentMonthWeekAndDay()
    {
        DateMidnight now = now(settings.get().getTimeZone());
        int year = now.year().get();
        int month = now.monthOfYear().get();
        int week = now.weekOfWeekyear().get();
        int day = now.dayOfMonth().get();
        Duration currentMonth = minutes(repository.findByYearMonth(year, month));
        Duration currentWeek = minutes(repository.findByYearWeek(year, week));
        Duration today = minutes(repository.findByYearMonthDay(year, month, day));
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.