Example usage for org.joda.time DateTime DateTime

List of usage examples for org.joda.time DateTime DateTime

Introduction

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

Prototype

public DateTime() 

Source Link

Document

Constructs an instance set to the current system millisecond time using ISOChronology in the default time zone.

Usage

From source file:br.eti.ranieri.opcoesweb.page.ExibirOnlinePage.java

License:Apache License

public ExibirOnlinePage() {
    add(new FeedbackPanel("feedback"));
    add(new Link("atualizar") {

        @Override//from www .j av a2  s . c  om
        public void onClick() {
            importar();
        }
    });

    boolean configurado = OpcoesWebHttpSession.get().getConfiguracaoOnline().isConfigurado();
    if (configurado == false) {
        info("Para exibir cotaes online,  necessria a configurao.");
        getRequestCycle().setRedirect(true);
        setResponsePage(ConfigurarOnlinePage.class);
    } else {
        Map<Acao, CotacaoAcaoOpcoes> cotacoesOnline = OpcoesWebHttpSession.get().getCacheCotacoesOnline();
        add(new PainelAcaoOpcoes("tabelaPetrobras",
                cotacoesOnline == null ? null : cotacoesOnline.get(PETROBRAS), new DateTime()));
        add(new PainelAcaoOpcoes("tabelaVale", cotacoesOnline == null ? null : cotacoesOnline.get(VALE),
                new DateTime()));
    }
}

From source file:br.eti.ranieri.opcoesweb.page.ExibirOnlinePage.java

License:Apache License

private void importar() {
    Map<Acao, CotacaoAcaoOpcoes> cotacoesOnline = importador
            .importar(OpcoesWebHttpSession.get().getConfiguracaoOnline());
    OpcoesWebHttpSession.get().setCacheCotacoesOnline(cotacoesOnline);

    DateTime agora = new DateTime();
    addOrReplace(new PainelAcaoOpcoes("tabelaPetrobras", cotacoesOnline.get(PETROBRAS), agora));

    addOrReplace(new PainelAcaoOpcoes("tabelaVale", cotacoesOnline.get(VALE), agora));
}

From source file:br.gov.sc.fatma.resourcemanager.common.AResource.java

public Period upTime() {
    if (startTime == null) {
        startTime = new DateTime();
    }//w ww.  j  av a 2  s  . c om
    DateTime today = new DateTime();
    return new Period(startTime, today);
}

From source file:br.ifes.leds.sincap.gerenciaNotificacao.cln.cgt.AplEntrevista.java

/**
 * Verifica se a data de cadastro existe. Se no existir, ento a data de cadastro  definida.
 *
 * @param notificacao A notificao a ser verificada. ({@code Obito}, {@code Entrevista} ou {@code Captacao})
 *///from  w ww.  j  a  va  2 s  . c om
private static void verificaDataCadastro(DataCadastro notificacao) {
    if (notificacao.getDataCadastro() == null) {
        notificacao.setDataCadastro(new DateTime().toCalendar(Locale.getDefault()));
    }
}

From source file:bussinessLogic.manageSR.java

public List<WrisSR> getSRsNeedingReview() {
    List<WrisSR> srList;//from  w  w  w. j  av a2  s .co  m
    ArrayList<WrisSR> srReviewList = new ArrayList();
    srList = wrisSRFacade.findAll();
    for (int i = 0; i < srList.size(); i++) {
        if (srList.get(i).getReqStatus().equalsIgnoreCase("new") && Days
                .daysBetween(new DateTime(), new DateTime(srList.get(i).getCreateDate())).getDays() >= 3) {
            srReviewList.add(srList.get(i));
        }
    }
    return srReviewList;
}

From source file:c3.ops.priam.resources.BackupServlet.java

License:Apache License

@GET
@Path("/restore")
public Response restore(@QueryParam(REST_HEADER_RANGE) String daterange,
        @QueryParam(REST_HEADER_REGION) String region, @QueryParam(REST_HEADER_TOKEN) String token,
        @QueryParam(REST_KEYSPACES) String keyspaces, @QueryParam(REST_RESTORE_PREFIX) String restorePrefix)
        throws Exception {
    Date startTime;/* w w w.  j  a va 2  s .c o  m*/
    Date endTime;

    if (StringUtils.isBlank(daterange) || daterange.equalsIgnoreCase("default")) {
        startTime = new DateTime().minusDays(1).toDate();
        endTime = new DateTime().toDate();
    } else {
        String[] restore = daterange.split(",");
        AbstractBackupPath path = pathProvider.get();
        startTime = path.parseDate(restore[0]);
        endTime = path.parseDate(restore[1]);
    }

    String origRestorePrefix = config.getRestorePrefix();
    if (StringUtils.isNotBlank(restorePrefix)) {
        config.setRestorePrefix(restorePrefix);
    }

    logger.info("Parameters: { token: [" + token + "], region: [" + region + "], startTime: [" + startTime
            + "], endTime: [" + endTime + "], keyspaces: [" + keyspaces + "], restorePrefix: [" + restorePrefix
            + "]}");

    restore(token, region, startTime, endTime, keyspaces);

    //Since this call is probably never called in parallel, config is multi-thread safe to be edited
    if (origRestorePrefix != null)
        config.setRestorePrefix(origRestorePrefix);
    else
        config.setRestorePrefix("");

    return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build();
}

From source file:c3.ops.priam.resources.BackupServlet.java

License:Apache License

@GET
@Path("/list")
public Response list(@QueryParam(REST_HEADER_RANGE) String daterange,
        @QueryParam(REST_HEADER_FILTER) @DefaultValue("") String filter) throws Exception {
    Date startTime;//from ww w  .ja va2 s  . c om
    Date endTime;

    if (StringUtils.isBlank(daterange) || daterange.equalsIgnoreCase("default")) {
        startTime = new DateTime().minusDays(1).toDate();
        endTime = new DateTime().toDate();
    } else {
        String[] restore = daterange.split(",");
        AbstractBackupPath path = pathProvider.get();
        startTime = path.parseDate(restore[0]);
        endTime = path.parseDate(restore[1]);
    }

    logger.info("Parameters: {backupPrefix: [" + config.getBackupPrefix() + "], daterange: [" + daterange
            + "], filter: [" + filter + "]}");

    Iterator<AbstractBackupPath> it = bkpStatusFs.list(config.getBackupPrefix(), startTime, endTime);
    JSONObject object = new JSONObject();
    object = constructJsonResponse(object, it, filter);
    return Response.ok(object.toString(2), MediaType.APPLICATION_JSON).build();
}

From source file:ca.barrenechea.ticker.data.Event.java

License:Apache License

private DateTime getPreparedTime() {
    return new DateTime().withMillisOfSecond(0);
}

From source file:cd.education.data.collector.android.widgets.DateTimeWidget.java

License:Apache License

/**
 * Resets date to today.//  w w  w.jav a2 s  . c  o  m
 */
@Override
public void clearAnswer() {
    DateTime ldt = new DateTime();
    mDatePicker.init(ldt.getYear(), ldt.getMonthOfYear() - 1, ldt.getDayOfMonth(), mDateListener);
    mTimePicker.setCurrentHour(ldt.getHourOfDay());
    mTimePicker.setCurrentMinute(ldt.getMinuteOfHour());
}

From source file:cd.education.data.collector.android.widgets.DateWidget.java

License:Apache License

/**
 * Resets date to today./*  ww  w. j a va 2 s. c  o m*/
 */
@Override
public void clearAnswer() {
    DateTime ldt = new DateTime();
    mDatePicker.init(ldt.getYear(), ldt.getMonthOfYear() - 1, ldt.getDayOfMonth(), mDateListener);
}