Example usage for org.joda.time LocalDate plusDays

List of usage examples for org.joda.time LocalDate plusDays

Introduction

In this page you can find the example usage for org.joda.time LocalDate plusDays.

Prototype

public LocalDate plusDays(int days) 

Source Link

Document

Returns a copy of this date plus the specified number of days.

Usage

From source file:org.incode.module.document.dom.impl.docs.DocumentRepository.java

License:Apache License

@Programmatic
public List<Document> findBetween(final LocalDate startDate, final LocalDate endDateIfAny) {

    final DateTime startDateTime = startDate.toDateTimeAtStartOfDay();

    final QueryDefault<Document> query;
    if (endDateIfAny != null) {
        final DateTime endDateTime = endDateIfAny.plusDays(1).toDateTimeAtStartOfDay();
        query = new QueryDefault<>(Document.class, "findByCreatedAtBetween", "startDateTime", startDateTime,
                "endDateTime", endDateTime);
    } else {//  ww  w .j a  v a  2 s. c o  m
        query = new QueryDefault<>(Document.class, "findByCreatedAtAfter", "startDateTime", startDateTime);
    }

    return repositoryService.allMatches(query);
}

From source file:org.incode.module.note.fixture.scripts.scenarios.NoteDemoObjectsFixture.java

License:Apache License

@Override
protected void execute(final ExecutionContext executionContext) {

    // prereqs/*from  ww  w .  j  a v  a 2s.  c o m*/
    executionContext.executeChild(this, new NoteDemoObjectsTearDownFixture());

    final LocalDate now = clockService.now();

    final NoteDemoObject foo = create("Foo", executionContext);
    wrap(mixinAddNote(foo)).$$("Note A", now, "BLUE");
    wrap(mixinAddNote(foo)).$$("Note B", now.plusDays(1), "GREEN");
    wrap(mixinAddNote(foo)).$$("Note C", now.plusDays(2), "RED");

    final NoteDemoObject bar = create("Bar", executionContext);
    wrap(mixinAddNote(bar)).$$("Note #1", null, null);
    wrap(mixinAddNote(bar)).$$("Note #2", now.plusDays(-1), "RED");

    final NoteDemoObject baz = create("Baz", executionContext);
    wrap(mixinAddNote(baz)).$$("Another note", now.plusDays(1), "RED");
}

From source file:org.isisaddons.app.kitchensink.dom.date.DateObject.java

License:Apache License

private static List<LocalDate> daysFrom(LocalDate localDate, int numDays) {
    List<LocalDate> dates = Lists.newArrayList();
    for (int i = 0; i < numDays; i++) {
        dates.add(localDate.plusDays(i + 1));
    }//  w  ww.  j  av a 2  s  .  c  o m
    return dates;
}

From source file:org.isisaddons.module.excel.fixture.scripts.ExcelModuleDemoToDoItemRowHandler.java

License:Apache License

private static LocalDate daysFromToday(final Integer i) {
    if (i == null) {
        return null;
    }//w w w  .  j  a va  2 s .  co m
    final LocalDate date = new LocalDate(Clock.getTimeAsDateTime());
    return date.plusDays(i);
}

From source file:org.isisaddons.wicket.fullcalendar2.fixture.scripts.todo.ToDoItemsFixture.java

License:Apache License

private FullCalendar2WicketToDoItem createToDoItemForUser(final String description, final String user,
        final FullCalendar2WicketToDoItem.Category category, final ExecutionContext executionContext) {
    FullCalendar2WicketToDoItem toDo = toDoItems.newToDo(description, user);

    LocalDate today = clockService.now();
    toDo.setDueBy(today.plusDays(random(10) - 2));
    toDo.setCategory(category);/* w  w  w. j  av  a2  s .  c  o m*/

    return executionContext.add(this, description, toDo);
}

From source file:org.isisaddons.wicket.timeline.fixture.scripts.todo.ToDoItemsFixture.java

License:Apache License

private TimelineWicketToDoItem createToDoItemForUser(final String description, final String user,
        final TimelineWicketToDoItem.Category category, final ExecutionContext executionContext) {
    TimelineWicketToDoItem toDo = toDoItems.newToDo(description, user);

    LocalDate today = clockService.now();
    toDo.setDueBy(today.plusDays(random(10) - 2));
    toDo.setCategory(category);//from w  ww .ja  va  2 s.  c om

    return executionContext.add(this, description, toDo);
}

From source file:org.jahap.business.base.Hotelbean.java

License:Open Source License

public void incrementOperationdate() {
    LocalDate hotelday = LocalDate.fromDateFields(allrecordlist.get(currentRecordNumber).getOperationdate());
    allrecordlist.get(currentRecordNumber).setOperationdate(hotelday.plusDays(1).toDate());
    this.saveRecord();

}

From source file:org.jasig.portlet.notice.service.classloader.DemoNotificationService.java

License:Apache License

private void updateDateAttributeIfPresent(List<NotificationAttribute> attributeList, String attributeName,
        int addDays) {
    for (NotificationAttribute attr : attributeList) {
        if (attr.getName().equals(attributeName)) {
            if (attr.getValues().size() == 1) {
                // Allow parse errors to throw exception and stop the data file processing
                LocalDate date = DATE_PARSER.parseLocalDate(attr.getValues().get(0));
                attr.setValues(Arrays.asList(
                        new String[] { DATE_PARSER.print(date.plusDays(addDays).toDateTimeAtStartOfDay()) }));
            } else if (attr.getValues().size() > 1) {
                log.warn("Sample data for Notification Attribute {} has {} values; considering only 1st value",
                        attr.getName(), attr.getValues().size());
            } else {
                log.warn("Sample data for Notification Attribute {} has no values");
            }//from   w w w  .ja  va  2 s.  c  om
            String value = attr.getValues().size() > 0 ? attr.getValues().get(0) : "";
            attr.setValues(Arrays.asList(new String[] { value }));
        }
    }
}

From source file:org.jbpm.console.ng.ht.backend.server.TaskCalendarServiceImpl.java

License:Apache License

private List<TasksPerDaySummary> createTasksPerDayHolder(LocalDate dayFrom, int nrOfDaysTotal) {
    List<TasksPerDaySummary> tasksPerDay = new ArrayList<TasksPerDaySummary>();
    for (int i = 0; i < nrOfDaysTotal; i++) {
        tasksPerDay.add(new TasksPerDaySummary(transformLocalDateToDay(dayFrom.plusDays(i)),
                new ArrayList<TaskSummary>()));
    }//from   w  w w.j  a v  a2  s .  c  o m
    return tasksPerDay;
}

From source file:org.jbpm.console.ng.ht.backend.server.TaskServiceEntryPointImpl.java

License:Apache License

private Map<LocalDate, List<TaskSummary>> createDaysMapAndInitWithEmptyListForEachDay(LocalDate dayFrom,
        int nrOfDaysTotal) {
    Map<LocalDate, List<TaskSummary>> tasksByDay = new LinkedHashMap<LocalDate, List<TaskSummary>>();
    for (int i = 0; i < nrOfDaysTotal; i++) {
        tasksByDay.put(dayFrom.plusDays(i), new ArrayList<TaskSummary>());
    }/*from w ww  . j ava 2  s.  co  m*/
    return tasksByDay;
}