Example usage for org.joda.time LocalDate toString

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

Introduction

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

Prototype

@ToString
public String toString() 

Source Link

Document

Output the date time in ISO8601 format (yyyy-MM-dd).

Usage

From source file:org.jadira.usertype.dateandtime.joda.columnmapper.DateColumnLocalDateMapper.java

License:Apache License

@Override
public String toNonNullString(LocalDate value) {
    return value.toString();
}

From source file:org.killbill.billing.client.KillBillClient.java

License:Apache License

public RolledUpUsage getRolledUpUsage(final UUID subscriptionId, @Nullable final String unitType,
        final LocalDate startDate, final LocalDate endDate) throws KillBillClientException {
    String uri = JaxrsResource.USAGES_PATH + "/" + subscriptionId;

    if (unitType != null && !unitType.trim().isEmpty()) {
        uri = uri.concat("/").concat(unitType);
    }//  w  ww .j av  a 2  s  .c o m

    final Multimap<String, String> queryParams = ImmutableMultimap.<String, String>of(
            JaxrsResource.QUERY_START_DATE, startDate.toString(), JaxrsResource.QUERY_END_DATE,
            endDate.toString());

    return httpClient.doGet(uri, queryParams, RolledUpUsage.class);
}

From source file:org.killbill.billing.client.KillBillClient.java

License:Apache License

public Invoice createDryRunInvoice(final UUID accountId, @Nullable final LocalDate futureDate,
        final InvoiceDryRun dryRunInfo, final String createdBy, final String reason, final String comment)
        throws KillBillClientException {
    final String uri = JaxrsResource.INVOICES_PATH + "/" + JaxrsResource.DRY_RUN;

    final String futureDateOrUpcomingNextInvoice = (futureDate != null) ? futureDate.toString() : null;
    final Multimap<String, String> rawQueryParams;
    if (futureDateOrUpcomingNextInvoice != null) {
        rawQueryParams = ImmutableMultimap.<String, String>of(JaxrsResource.QUERY_ACCOUNT_ID,
                accountId.toString(), JaxrsResource.QUERY_TARGET_DATE, futureDateOrUpcomingNextInvoice,
                JaxrsResource.QUERY_DRY_RUN, "true");
    } else {/* w ww . j av  a 2 s  . c  om*/
        rawQueryParams = ImmutableMultimap.<String, String>of(JaxrsResource.QUERY_ACCOUNT_ID,
                accountId.toString(), JaxrsResource.QUERY_DRY_RUN, "true");
    }
    final Multimap<String, String> queryParams = paramsWithAudit(rawQueryParams, createdBy, reason, comment);
    return httpClient.doPost(uri, dryRunInfo, queryParams, Invoice.class);
}

From source file:org.killbill.billing.client.KillBillClient.java

License:Apache License

public Invoice createInvoice(final UUID accountId, final LocalDate futureDate, final String createdBy,
        final String reason, final String comment) throws KillBillClientException {
    final String uri = JaxrsResource.INVOICES_PATH;

    final Multimap<String, String> queryParams = paramsWithAudit(
            ImmutableMultimap.<String, String>of(JaxrsResource.QUERY_ACCOUNT_ID, accountId.toString(),
                    JaxrsResource.QUERY_TARGET_DATE, futureDate.toString()),
            createdBy, reason, comment);

    return httpClient.doPostAndFollowLocation(uri, null, queryParams, Invoice.class);
}

From source file:org.kitodo.production.plugin.opac.pica.PicaPlugin.java

License:Open Source License

/**
 * The function createResult() creates a Map&lt;String, Object&gt; as result
 * of getHit(). The map contains the full hit as "fileformat", the docType
 * as "type" and some bibliographic metadata for Production to be able to
 * show a short hit display as supposed in
 * {@link org.goobi.production.plugin.CataloguePlugin.Hit}
 *
 * @param docType// w  w w . jav a2 s.co m
 *            the DocType of the hit
 * @param hit
 *            the hit data as JDom Element
 * @param fileformat
 *            the hit data as Fileformat
 * @return a Map with the hit
 */
private static Map<String, Object> createResult(String docType, Element hit, Fileformat fileformat) {
    final LocalTime DAY_END = new LocalTime(23, 59, 59, 999);

    Map<String, Object> result = new HashMap<>(20);
    LocalDate today = new LocalDate();

    result.put("fileformat", fileformat);
    result.put("type", docType);

    // add some basic metadata
    String accessed = getElementFieldValue(hit, "208@", "a");
    try {
        LocalDate date = toRecentLocalDate(accessed, today);
        result.put("accessed", date.toDateTime(date.isEqual(today) ? new LocalTime() : DAY_END).toString());
    } catch (RuntimeException e) {
        logger.error(e);
    }

    String lastName = getElementFieldValue(hit, "028A", "a");
    if (lastName.equals("")) {
        lastName = getElementFieldValue(hit, "028A", "l");
    }
    String firstName = getElementFieldValue(hit, "028A", "d");
    if (firstName.equals("")) {
        firstName = getElementFieldValue(hit, "028A", "P");
    }
    String middleTitle = getElementFieldValue(hit, "028A", "c");
    String author = lastName + (!firstName.equals("") ? ", " : "") + firstName
            + (!middleTitle.equals("") ? " " : "") + middleTitle;
    if (author.equals("")) {
        author = getElementFieldValue(hit, "028A", "8");
    }
    if (author.equals("")) {
        String lastName2 = getElementFieldValue(hit, "028C", "a");
        if (lastName2.equals("")) {
            lastName2 = getElementFieldValue(hit, "028C", "l");
        }
        String firstName2 = getElementFieldValue(hit, "028C", "d");
        if (firstName2.equals("")) {
            firstName2 = getElementFieldValue(hit, "028C", "P");
        }
        String middleTitle2 = getElementFieldValue(hit, "028C", "c");
        author = lastName2 + (!firstName2.equals("") ? ", " : "") + firstName2
                + (!middleTitle2.equals("") ? " " : "") + middleTitle2;
    }
    result.put("creator", author);

    String date = getElementFieldValue(hit, "201B", "0");
    try {
        LocalDate localDate = toRecentLocalDate(date, today);
        result.put("date", localDate.toString());
    } catch (RuntimeException e) {
        logger.error(e);
    }

    result.put("edition", getElementFieldValue(hit, "032@", "a"));
    result.put("format", docType.startsWith("O") ? "internet" : "monograph");
    result.put("number", getElementFieldValue(hit, "036E", "l"));
    result.put("place", getElementFieldValue(hit, "033A", "p"));
    result.put("publisher", getElementFieldValue(hit, "033A", "n"));
    result.put("series", getElementFieldValue(hit, "036E", "a"));

    String subseries = getElementFieldValue(hit, "021A", "d");
    if (subseries == null || subseries.length() == 0) {
        subseries = getElementFieldValue(hit, "021B", "d");
    }
    if (subseries == null || subseries.length() == 0) {
        subseries = getElementFieldValue(hit, "027D", "d");
    }
    result.put("subseries", subseries);

    String title = getElementFieldValue(hit, "021A", "a");
    if (title == null || title.length() == 0) {
        title = getElementFieldValue(hit, "021B", "a");
    }
    if (title == null || title.length() == 0) {
        title = getElementFieldValue(hit, "027D", "a");
    }
    String titleLong = getElementFieldValue(hit, "021A", "d");
    if (titleLong != null && titleLong.length() > 0) {
        title = title + " : " + titleLong;
    }
    result.put("title", title.replaceAll("@", ""));

    result.put("url", getElementFieldValue(hit, "209R", "a"));
    result.put("year", getElementFieldValue(hit, "011@", "a"));
    return result;
}

From source file:org.libreplan.web.common.converters.LocalDateConverter.java

License:Open Source License

@Override
public String asString(LocalDate entity) {
    return entity.toString();
}

From source file:org.libreplan.web.limitingresources.ManualAllocationController.java

License:Open Source License

public String formatDate(LocalDate date) {
    return (date != null) ? date.toString() : null;
}

From source file:org.lntu.online.server.util.gson.LocalDateTypeAdapter.java

License:Open Source License

@Override
public JsonElement serialize(LocalDate src, Type typeOfSrc, JsonSerializationContext context) {
    return new JsonPrimitive(src.toString());
}

From source file:org.mifos.accounts.persistence.AccountPersistence.java

License:Open Source License

@SuppressWarnings("unchecked")
public List<Integer> getActiveCustomerAndSavingsAccountIdsForGenerateMeetingTask() throws PersistenceException {

    LocalDate date = new LocalDate();
    HashMap<String, Object> queryParameters = new HashMap<String, Object>();
    queryParameters.put("DATE", date.toString());
    List<Integer> customerIds = executeNamedQuery("getActiveCustomerAccountIdsForGenerateMeetingsTask",
            queryParameters);//from  w ww  .ja va  2 s  .c  o m
    List<Integer> savingsIds = executeNamedQuery("getActiveSavingsAccountIdsForGenerateMeetingsTask",
            queryParameters);

    customerIds.addAll(savingsIds);
    return customerIds;
}

From source file:org.mifos.accounts.persistence.LegacyAccountDao.java

License:Open Source License

public List<Integer> getActiveCustomerAndSavingsAccountIdsForGenerateMeetingTask() throws PersistenceException {

    LocalDate date = new LocalDate();
    HashMap<String, Object> queryParameters = new HashMap<String, Object>();
    queryParameters.put("DATE", date.toString());
    List<Integer> customerIds = executeNamedQuery("getActiveCustomerAccountIdsForGenerateMeetingsTask",
            queryParameters);// w  w  w  . java 2  s.c  om
    List<Integer> savingsIds = executeNamedQuery("getActiveSavingsAccountIdsForGenerateMeetingsTask",
            queryParameters);

    customerIds.addAll(savingsIds);
    return customerIds;
}