List of usage examples for org.joda.time LocalDate toString
public String toString(String pattern)
From source file:org.flowable.form.engine.impl.cmd.GetFormInstanceModelCmd.java
License:Apache License
public void fillVariablesWithFormValues(Map<String, JsonNode> submittedFormFieldMap, List<FormField> allFields) { for (FormField field : allFields) { JsonNode fieldValueNode = submittedFormFieldMap.get(field.getId()); if (fieldValueNode == null || fieldValueNode.isNull()) { continue; }/*from w w w. java2 s . c om*/ String fieldType = field.getType(); String fieldValue = fieldValueNode.asText(); if (FormFieldTypes.DATE.equals(fieldType)) { try { if (StringUtils.isNotEmpty(fieldValue)) { LocalDate dateValue = LocalDate.parse(fieldValue); variables.put(field.getId(), dateValue.toString("d-M-yyyy")); } } catch (Exception e) { logger.error("Error parsing form date value for process instance {} and task {} with value {}", processInstanceId, taskId, fieldValue, e); } } else { variables.put(field.getId(), fieldValue); } } }
From source file:org.fornax.cartridges.sculptor.framework.propertyeditor.LocalDateEditor.java
License:Apache License
/** * Format the LocalDate as String, using the specified format. *//*from w w w. j a va 2 s . co m*/ public String getAsText() { LocalDate value = (LocalDate) getValue(); return (value != null ? value.toString(this.formatter) : ""); }
From source file:org.gnucash.android.ui.chart.BarChartActivity.java
License:Apache License
/** * Returns the start data of x-axis for the specified account type * @param accountType account type//from ww w. j av a2 s . c om * @return the start data */ private LocalDate getStartDate(AccountType accountType) { TransactionsDbAdapter adapter = TransactionsDbAdapter.getInstance(); String code = mCurrency.getCurrencyCode(); LocalDate startDate = new LocalDate(adapter.getTimestampOfEarliestTransaction(accountType, code)) .withDayOfMonth(1); Log.d(TAG, accountType + " X-axis star date: " + startDate.toString("dd MM yyyy")); return startDate; }
From source file:org.gnucash.android.ui.chart.BarChartActivity.java
License:Apache License
/** * Returns the end data of x-axis for the specified account type * @param accountType account type// w w w.ja v a2s . co m * @return the end data */ private LocalDate getEndDate(AccountType accountType) { TransactionsDbAdapter adapter = TransactionsDbAdapter.getInstance(); String code = mCurrency.getCurrencyCode(); LocalDate endDate = new LocalDate(adapter.getTimestampOfLatestTransaction(accountType, code)) .withDayOfMonth(1); Log.d(TAG, accountType + " X-axis end date: " + endDate.toString("dd MM yyyy")); return endDate; }
From source file:org.gnucash.android.ui.chart.LineChartActivity.java
License:Apache License
/** * Returns a data object that represents a user data of the specified account types * @param accountTypeList account's types which will be displayed * @return a {@code LineData} instance that represents a user data */// ww w .j a v a2 s . c om private LineData getData(List<AccountType> accountTypeList) { calculateEarliestAndLatestTimestamps(accountTypeList); LocalDate startDate = new LocalDate(mEarliestTransactionTimestamp).withDayOfMonth(1); LocalDate endDate = new LocalDate(mLatestTransactionTimestamp).withDayOfMonth(1); List<String> xValues = new ArrayList<>(); while (!startDate.isAfter(endDate)) { xValues.add(startDate.toString(X_AXIS_PATTERN)); Log.d(TAG, "X axis " + startDate.toString("MM yy")); startDate = startDate.plusMonths(1); } List<LineDataSet> dataSets = new ArrayList<>(); for (AccountType accountType : accountTypeList) { LineDataSet set = new LineDataSet(getEntryList(accountType), accountType.toString()); set.setDrawFilled(true); set.setLineWidth(2); set.setColor(COLORS[dataSets.size()]); set.setFillColor(FILL_COLORS[dataSets.size()]); dataSets.add(set); } LineData lineData = new LineData(xValues, dataSets); if (lineData.getYValueSum() == 0) { mChartDataPresent = false; return getEmptyData(); } return lineData; }
From source file:org.gnucash.android.ui.report.barchart.StackedBarChartFragment.java
License:Apache License
/** * Returns the start data of x-axis for the specified account type * @param accountType account type//ww w. j a v a2 s . c o m * @return the start data */ private LocalDate getStartDate(AccountType accountType) { TransactionsDbAdapter adapter = TransactionsDbAdapter.getInstance(); String code = mCommodity.getCurrencyCode(); LocalDate startDate; if (mReportPeriodStart == -1) { startDate = new LocalDate(adapter.getTimestampOfEarliestTransaction(accountType, code)); } else { startDate = new LocalDate(mReportPeriodStart); } startDate = startDate.withDayOfMonth(1); Log.d(TAG, accountType + " X-axis star date: " + startDate.toString("dd MM yyyy")); return startDate; }
From source file:org.gnucash.android.ui.report.barchart.StackedBarChartFragment.java
License:Apache License
/** * Returns the end data of x-axis for the specified account type * @param accountType account type/* ww w .j a v a 2 s . c om*/ * @return the end data */ private LocalDate getEndDate(AccountType accountType) { TransactionsDbAdapter adapter = TransactionsDbAdapter.getInstance(); String code = mCommodity.getCurrencyCode(); LocalDate endDate; if (mReportPeriodEnd == -1) { endDate = new LocalDate(adapter.getTimestampOfLatestTransaction(accountType, code)); } else { endDate = new LocalDate(mReportPeriodEnd); } endDate = endDate.withDayOfMonth(1); Log.d(TAG, accountType + " X-axis end date: " + endDate.toString("dd MM yyyy")); return endDate; }
From source file:org.gnucash.android.ui.report.BarChartFragment.java
License:Apache License
/** * Returns the start data of x-axis for the specified account type * @param accountType account type/*from w w w .ja va2 s . com*/ * @return the start data */ private LocalDate getStartDate(AccountType accountType) { TransactionsDbAdapter adapter = TransactionsDbAdapter.getInstance(); String code = mCurrency.getCurrencyCode(); LocalDate startDate; if (mReportStartTime == -1) { startDate = new LocalDate(adapter.getTimestampOfEarliestTransaction(accountType, code)); } else { startDate = new LocalDate(mReportStartTime); } startDate = startDate.withDayOfMonth(1); Log.d(TAG, accountType + " X-axis star date: " + startDate.toString("dd MM yyyy")); return startDate; }
From source file:org.gnucash.android.ui.report.BarChartFragment.java
License:Apache License
/** * Returns the end data of x-axis for the specified account type * @param accountType account type// w ww .jav a 2 s.c om * @return the end data */ private LocalDate getEndDate(AccountType accountType) { TransactionsDbAdapter adapter = TransactionsDbAdapter.getInstance(); String code = mCurrency.getCurrencyCode(); LocalDate endDate; if (mReportEndTime == -1) { endDate = new LocalDate(adapter.getTimestampOfLatestTransaction(accountType, code)); } else { endDate = new LocalDate(mReportEndTime); } endDate = endDate.withDayOfMonth(1); Log.d(TAG, accountType + " X-axis end date: " + endDate.toString("dd MM yyyy")); return endDate; }
From source file:org.gnucash.android.ui.report.linechart.CashFlowLineChartFragment.java
License:Apache License
/** * Returns a data object that represents a user data of the specified account types * @param accountTypeList account's types which will be displayed * @return a {@code LineData} instance that represents a user data *//* w w w .j a va 2 s. c o m*/ private LineData getData(List<AccountType> accountTypeList) { Log.w(TAG, "getData"); calculateEarliestAndLatestTimestamps(accountTypeList); // LocalDateTime? LocalDate startDate; LocalDate endDate; if (mReportPeriodStart == -1 && mReportPeriodEnd == -1) { startDate = new LocalDate(mEarliestTransactionTimestamp).withDayOfMonth(1); endDate = new LocalDate(mLatestTransactionTimestamp).withDayOfMonth(1); } else { startDate = new LocalDate(mReportPeriodStart).withDayOfMonth(1); endDate = new LocalDate(mReportPeriodEnd).withDayOfMonth(1); } int count = getDateDiff(new LocalDateTime(startDate.toDate().getTime()), new LocalDateTime(endDate.toDate().getTime())); Log.d(TAG, "X-axis count" + count); List<String> xValues = new ArrayList<>(); for (int i = 0; i <= count; i++) { switch (mGroupInterval) { case MONTH: xValues.add(startDate.toString(X_AXIS_PATTERN)); Log.d(TAG, "X-axis " + startDate.toString("MM yy")); startDate = startDate.plusMonths(1); break; case QUARTER: int quarter = getQuarter(new LocalDateTime(startDate.toDate().getTime())); xValues.add("Q" + quarter + startDate.toString(" yy")); Log.d(TAG, "X-axis " + "Q" + quarter + startDate.toString(" MM yy")); startDate = startDate.plusMonths(3); break; case YEAR: xValues.add(startDate.toString("yyyy")); Log.d(TAG, "X-axis " + startDate.toString("yyyy")); startDate = startDate.plusYears(1); break; // default: } } List<LineDataSet> dataSets = new ArrayList<>(); for (AccountType accountType : accountTypeList) { LineDataSet set = new LineDataSet(getEntryList(accountType), accountType.toString()); set.setDrawFilled(true); set.setLineWidth(2); set.setColor(COLORS[dataSets.size()]); set.setFillColor(FILL_COLORS[dataSets.size()]); dataSets.add(set); } LineData lineData = new LineData(xValues, dataSets); if (lineData.getYValueSum() == 0) { mChartDataPresent = false; return getEmptyData(); } return lineData; }