Example usage for org.joda.time LocalDateTime parse

List of usage examples for org.joda.time LocalDateTime parse

Introduction

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

Prototype

@FromString
public static LocalDateTime parse(String str) 

Source Link

Document

Parses a LocalDateTime from the specified string.

Usage

From source file:org.devgateway.eudevfin.exchange.liquibase.PopulateExchangeDbChangeLTL.java

License:Open Source License

@Override
@Transactional/* w  w  w.ja va 2 s.  c  om*/
public void execute(Database database) throws CustomChangeException {

    //LTL
    Currency LTL = Currency.getInstance("LTL");
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(4.0000), LocalDateTime.parse("2001-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(3.6733), LocalDateTime.parse("2002-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(3.0599), LocalDateTime.parse("2003-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(2.7808), LocalDateTime.parse("2004-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));

    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(2.7746), LocalDateTime.parse("2005-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(2.7513), LocalDateTime.parse("2006-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(2.5230), LocalDateTime.parse("2007-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(2.3569), LocalDateTime.parse("2008-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(2.4828), LocalDateTime.parse("2009-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(2.6067), LocalDateTime.parse("2010-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(2.4817), LocalDateTime.parse("2011-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(2.6867), LocalDateTime.parse("2012-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LTL), CurrencyUnit.USD,
            invert(2.6012), LocalDateTime.parse("2013-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));

}

From source file:org.devgateway.eudevfin.exchange.liquibase.PopulateExchangeDbChangeLVL.java

License:Open Source License

@Override
@Transactional/*from www .  j a v a 2s .  c  o  m*/
public void execute(Database database) throws CustomChangeException {
    //LVL
    Currency LVL = Currency.getInstance("LVL");
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LVL), CurrencyUnit.USD,
            invert(0.5469), LocalDateTime.parse("2012-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
    exchangeRateDaoImplEndpoint.save(HistoricalExchangeRate.of(CurrencyUnit.of(LVL), CurrencyUnit.USD,
            invert(0.5295), LocalDateTime.parse("2013-06-06"), ExchangeRateConstants.SOURCE_NATIONAL));
}

From source file:org.devgateway.eudevfin.financial.liquibase.PopulateFinancialDbChange.java

License:Open Source License

@Override
@Transactional//from  w w w  . ja  v  a2s .co m
public void execute(Database database) throws CustomChangeException {
    Random r = new Random();
    List<Organization> listOrgs = orgDao.findAllAsList();

    //List<Category> listTypeOfFlow = catDao.findByCode("TYPE_OF_FLOW##10");
    List<Category> listTypeOfFlow = catDao.findByTagsCode(CategoryConstants.TYPE_OF_FLOW_TAG);
    List<Category> listSectors = catDao.findByTagsCode(CategoryConstants.ALL_SECTOR_TAG);
    List<Category> listTypeOfFinance = catDao.findByTagsCode(CategoryConstants.TYPE_OF_FINANCE_TAG);
    List<Category> listTypeofAid = catDao.findByTagsCode(CategoryConstants.TYPE_OF_AID_TAG);
    List<Category> listBiMultilateral = catDao.findByTagsCode(CategoryConstants.BI_MULTILATERAL_TAG);
    List<ChannelCategory> listChannel = channelCatDao.findAllAsList();
    List<ChannelCategory> listMultilateralChannel = getMultilaterals(listChannel);
    List<Category> bilateral = catDao.findByCode("BI_MULTILATERAL##1");
    List<Category> multilateral = catDao.findByCode("BI_MULTILATERAL##2");
    List<Area> listAreas = areaDao.findAllAsList();

    for (int j = 0; j < NUM_OF_YEARS; j++) {
        for (int i = 0; i < NUM_OF_TX; i++) {
            double disbursement = Math.ceil(Math.random() * 5000000);
            boolean draft = false;// ((int)disbursement) % 2 == 0 ? true:false;
            CustomFinancialTransaction tx = new CustomFinancialTransaction();
            tx.setDraft(draft);
            tx.setCommitments(BigMoney.parse("EUR " + Math.ceil(Math.random() * 100000)));
            tx.setAmountsExtended(BigMoney.parse("EUR " + disbursement));
            tx.setAmountsReceived(BigMoney.parse("EUR " + Math.ceil(disbursement / 2)));

            Organization extAgency = null;
            Category sector = null;
            Category typeOfFlow = null;
            Category typeOfFinance = null;
            Category typeOfAid = null;
            ChannelCategory channel = null;
            Area area = null;

            int extAgencyRandomIndex = r.nextInt(listOrgs.size());
            int sectorRandomIndex = r.nextInt(listSectors.size());
            int typeOfFlowRandomIndex = r.nextInt(listTypeOfFlow.size());
            int typeOfFinanceRandomIndex = r.nextInt(listTypeOfFinance.size());
            int typeOfAidRandomIndex = r.nextInt(listTypeofAid.size());
            int biMultilateralRandomIndex = r.nextInt(listBiMultilateral.size());
            int channelRandomIndex = r.nextInt(listMultilateralChannel.size());
            int areaRandomIndex = r.nextInt(listAreas.size());

            extAgency = listOrgs.get(extAgencyRandomIndex);
            sector = listSectors.get(sectorRandomIndex);
            typeOfFlow = listTypeOfFlow.get(typeOfFlowRandomIndex);
            typeOfFinance = listTypeOfFinance.get(typeOfFinanceRandomIndex);
            typeOfAid = listTypeofAid.get(typeOfAidRandomIndex);
            channel = listMultilateralChannel.get(channelRandomIndex);
            area = listAreas.get(areaRandomIndex);

            tx.setChannel(channel);
            tx.setExtendingAgency(extAgency);
            tx.setLocale("en");
            tx.setShortDescription("CDA Test Transaction " + i + " en");
            tx.setDescription("Long" + tx.getDescription());
            tx.setLocale("ro");
            tx.setShortDescription("CDA Test Transaction " + i + " ro");
            tx.setDescription("Long" + tx.getDescription());
            tx.setSector(sector);
            tx.setTypeOfFlow(typeOfFlow);
            tx.setTypeOfFinance(typeOfFinance);
            tx.setTypeOfAid(typeOfAid);
            tx.setReportingYear(LocalDateTime.parse((2009 + j) + "-07-01"));
            tx.setFormType((biMultilateralRandomIndex % 2 == 0) ? "bilateralOda.advanceQuestionnaire"
                    : "multilateralOda.advanceQuestionnaire");
            tx.setBiMultilateral((biMultilateralRandomIndex % 2 == 0) ? bilateral.get(0) : multilateral.get(0));
            tx.setRecipient(area);
            txDao.save(tx);
        }

    }

}

From source file:org.jpmml.evaluator.TypeUtil.java

License:Open Source License

static private LocalDateTime parseDateTime(String value) {
    return LocalDateTime.parse(value);
}

From source file:org.jtwig.functions.builtin.DateFunctions.java

License:Apache License

@JtwigFunction(name = "date_modify")
public Date modifyDate(@Parameter String input, @Parameter String modifyString) throws FunctionException {
    return modify(modifyString, LocalDateTime.parse(input));
}

From source file:org.jtwig.functions.builtin.DateFunctions.java

License:Apache License

@JtwigFunction(name = "date")
public String format(@Parameter String input) {
    if (input == null)
        return "";
    return format(LocalDateTime.parse(input).toDate());
}

From source file:org.jtwig.functions.builtin.DateFunctions.java

License:Apache License

@JtwigFunction(name = "date")
public String format(@Parameter String input, @Parameter String format) {
    if (input == null)
        return "";
    return format(LocalDateTime.parse(input).toDate(), format);
}

From source file:org.supercsv.cellprocessor.joda.ParseLocalDateTime.java

License:Apache License

/**
 * {@inheritDoc}
 */
@Override
protected LocalDateTime parse(final String string) {
    return LocalDateTime.parse(string);
}

From source file:se.inera.certificate.schema.adapter.LocalDateAdapter.java

License:Open Source License

/**
 * Converts an intyg:common-model:1:dateTime to a Joda Time LocalDateTime.
 *//*  ww w .ja v a  2s.c o  m*/
public static LocalDateTime parseIsoDateTime(String dateTimeString) {
    return LocalDateTime.parse(dateTimeString);
}

From source file:se.inera.statistics.hsa.adapter.LocalDateAdapter.java

License:Open Source License

/**
 * Converts an intyg:common-model:1:dateTime to a Joda Time LocalDateTime.
 *//*ww w  .  j  a va2s.com*/
public static LocalDateTime parseIsoDateTime(String dateString) {
    return LocalDateTime.parse(dateString);
}