Example usage for org.joda.time LocalDate toDateTime

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

Introduction

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

Prototype

public DateTime toDateTime(LocalTime time) 

Source Link

Document

Converts this object to a DateTime using a LocalTime to fill in the missing fields and using the default time zone.

Usage

From source file:au.com.scds.chats.dom.activity.Activities.java

License:Apache License

@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(bookmarking = BookmarkPolicy.NEVER)
@MemberOrder(sequence = "7")
public List<ActivityEvent> listActivitiesInPeriod(
        @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "Start Period") LocalDate start,
        @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "End Period") LocalDate end) {
    return container
            .allMatches(new QueryDefault<>(ActivityEvent.class, "findActivitiesInPeriod", "startDateTime",
                    start.toDateTimeAtStartOfDay(), "endDateTime", end.toDateTime(new LocalTime(23, 59))));
}

From source file:au.com.scds.chats.dom.attendance.AttendanceLists.java

License:Apache License

@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(bookmarking = BookmarkPolicy.NEVER)
@MemberOrder(sequence = "1.0")
public List<AttendanceList> listAttendanceListsInPeriod(
        @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "Start Period") LocalDate start,
        @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "End Period") LocalDate end) {
    return container
            .allMatches(new QueryDefault<>(AttendanceList.class, "findAttendanceListsInPeriod", "startDateTime",
                    start.toDateTimeAtStartOfDay(), "endDateTime", end.toDateTime(new LocalTime(23, 59))));
}

From source file:au.com.scds.chats.dom.attendance.AttendanceLists.java

License:Apache License

@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(bookmarking = BookmarkPolicy.NEVER, named = "List Attendances In Period")
@MemberOrder(sequence = "3.0")
public List<Attend> listAttendsInPeriod(
        @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "Start Period") LocalDate start,
        @Parameter(optionality = Optionality.MANDATORY) @ParameterLayout(named = "End Period") LocalDate end) {
    return container.allMatches(new QueryDefault<>(Attend.class, "findAttendsInPeriod", "startDateTime",
            start.toDateTimeAtStartOfDay(), "endDateTime", end.toDateTime(new LocalTime(23, 59))));
}

From source file:br.ifes.leds.sincap.web.controller.NotificacaoEntrevistaController.java

@DefaultTimeZone
@RequestMapping(value = SALVAR, method = POST)
public String salvarEntrevista(ModelMap model, HttpSession session,
        @DateTimeFormat(pattern = "dd/MM/yyyy") @RequestParam("dataEntrevista") LocalDate dataEntrevista,
        @DateTimeFormat(pattern = "HH:mm") @RequestParam("horaEntrevista") LocalTime horaEntrevista,
        @RequestParam(value = "recusaFamiliar", defaultValue = "") Long recusaFamiliar,
        @RequestParam(value = "problemasEstruturais", defaultValue = "") Long problemasEstruturais,
        @ModelAttribute("processo") ProcessoNotificacaoDTO processo,
        @RequestParam(value = "descricaoComentario", defaultValue = "") String descricaoComentario) {

    UsuarioSessao usuarioSessao = (UsuarioSessao) session.getAttribute("user");

    if (!descricaoComentario.isEmpty()) {
        String momento = EstadoNotificacaoEnum.AGUARDANDOENTREVISTA.toString();
        ComentarioDTO comentario = utilityWeb.criarComentario(momento, descricaoComentario, usuarioSessao);
        processo.getComentarios().add(comentario);
    }/* w w  w .  j  a  va2  s  .  c o  m*/

    if (dataEntrevista != null && horaEntrevista != null) {
        processo.getEntrevista()
                .setDataEntrevista(dataEntrevista.toDateTime(horaEntrevista).toCalendar(Locale.getDefault()));
    }

    if (!processo.getEntrevista().isEntrevistaRealizada()) {
        processo.setCausaNaoDoacao(problemasEstruturais);
        processo.getEntrevista().setResponsavel(null);
        processo.getEntrevista().setResponsavel2(null);
        processo.getEntrevista().setTestemunha1(null);
        processo.getEntrevista().setTestemunha2(null);
        processo.getEntrevista().setDataEntrevista(null);
    } else if (!processo.getEntrevista().isDoacaoAutorizada()) {
        processo.setCausaNaoDoacao(recusaFamiliar);
    }

    try {
        processo.getEntrevista().setFuncionario(usuarioSessao.getIdUsuario());
        aplProcessoNotificacao.salvarEntrevista(processo, usuarioSessao.getIdUsuario());
    } catch (ViolacaoDeRIException e) {
        addAtributosIniciais(model, processo);
        utilityWeb.addConstraintViolations(e.getConstraintViolations(), model);
        utilityWeb.preencherEndereco(processo.getObito().getPaciente().getEndereco(), model);
        if (processo.getEntrevista().getResponsavel() != null
                && processo.getEntrevista().getResponsavel().getEndereco() != null) {
            utilityWeb.preencherEndereco(processo.getEntrevista().getResponsavel().getEndereco(), model);
        }
        model.addAttribute("tipoDocumentos", utilityWeb.getTipoDocumentoComFotoSelectItem());
        model.addAttribute("grauEscolaridade", utilityWeb.getEscolaridadeSelectItem());

        return "form-entrevista";
    }

    if (processo.getEntrevista().isDoacaoAutorizada()) {
        return "redirect:" + INDEX + "?sucessoEntrevista=true&idEntrevista=" + processo.getId();

    } else {
        return "redirect:" + INDEX + "?doacaoNaoAutorizada=true&idEntrevista=" + processo.getId();
    }
}

From source file:com.gst.portfolio.loanaccount.loanschedule.domain.DefaultScheduledDateGenerator.java

License:Apache License

private boolean intervalListContainsDate(List<Interval> intervalList, LocalDate date) {
    for (Interval interval : intervalList) {
        if (interval.contains(date.toDateTime(LocalTime.parse("11:59:59")))) {
            return true;
        }//w  w  w .  j  a v a2  s .c  o m
    }
    return false;
}

From source file:com.helger.poi.excel.WorkbookCreationHelper.java

License:Apache License

/**
 * @param aValue/*from w w w . ja  v a 2s. co m*/
 *        The value to be set.
 * @return A new cell in the current row of the current sheet with the passed
 *         value
 */
@Nonnull
public Cell addCell(@Nonnull final LocalDate aValue) {
    return addCell(aValue.toDateTime(CPDT.NULL_LOCAL_TIME));
}

From source file:com.qcadoo.commons.dateTime.TimeRange.java

License:Open Source License

public Interval toInterval(final LocalDate date) {
    DateTime start = date.toDateTime(getFrom());
    DateTime end = date.toDateTime(getTo());
    if (startsDayBefore()) {
        end = end.plusDays(1);/*  www.jav  a  2 s.c  om*/
    }
    return new Interval(start, end);
}

From source file:com.stagecents.pa.api.ActivityService.java

License:Open Source License

private void updateTimecardHours(Timecard timecard, Position position, LocalDate startDate, LocalDate endDate) {
    while (timecard.isEffective(startDate)) {
        Interval duration = new Interval(startDate.toDateTime(activity.getScheduledStart()),
                startDate.toDateTime(activity.getScheduledEnd()));

        // Update the time card hours for each element type
        Iterator<ElementType> iter = position.getElements().iterator();
        while (iter.hasNext()) {
            ElementType e = iter.next();
            e.processHours(duration, activity, timecard, position);
        }// w w  w .j a  va2  s.c om

        // Increment the day
        startDate = startDate.plusDays(1);
        if (startDate.isAfter(endDate)) {
            return;
        }
    }
}

From source file:config.TimeManipulation.java

License:Open Source License

/**
 * // w  w  w  .j av  a 2  s  .  c  o  m
 * @param LocalDate Date
 * @param String Time 
 */

public DateTime EventDateTime(LocalDate Date, String Time) {

    if (Time == null)
        return null;

    char modifier = Time.charAt(Time.length() - 1);
    Time = Time.substring(0, Time.length() - 1);

    if (modifier == 'B') {
        Date.minusDays(1);
    }

    if (modifier == 'X') {
        Date.plusDays(1);
    }
    LocalTime timeformat = new LocalTime(Time);

    return Date.toDateTime(timeformat);
}

From source file:de.symeda.sormas.app.component.controls.ControlDateTimeField.java

License:Open Source License

@Override
protected Date getFieldValue() {
    if (StringUtils.isEmpty(dateInput.getText().toString())) {
        return null;
    }//w w w  .j  av a 2 s .  c  om

    Date date = DateHelper.parseDate(dateInput.getText().toString(), dateFormat);
    Date time = !StringUtils.isEmpty(timeInput.getText().toString())
            ? DateHelper.parseTime(timeInput.getText().toString())
            : null;

    if (time != null) {
        LocalDate localDate = new LocalDate(date);
        DateTime dateTime = localDate.toDateTime(new LocalTime(time));
        return dateTime.toDate();
    } else {
        return date;
    }
}