List of usage examples for org.joda.time LocalDate fromDateFields
@SuppressWarnings("deprecation") public static LocalDate fromDateFields(Date date)
java.util.Date
using exactly the same field values. From source file:com.divudi.bean.store.StoreReportsTransfer.java
public void fillMovingWithStock() { String sql;//from ww w . j a v a 2 s .co m Map m = new HashMap(); m.put("i", institution); m.put("t1", BillType.StoreTransferIssue); m.put("t2", BillType.StorePre); m.put("fd", fromDate); m.put("td", toDate); BillItem bi = new BillItem(); sql = "select bi.item, abs(SUM(bi.pharmaceuticalBillItem.qty)), " + "abs(SUM(bi.pharmaceuticalBillItem.stock.itemBatch.purcahseRate * bi.pharmaceuticalBillItem.qty)), " + "SUM(bi.pharmaceuticalBillItem.stock.itemBatch.retailsaleRate * bi.qty)) " + "FROM BillItem bi where bi.retired=false and bi.bill.department.institution=:i and " + "(bi.bill.billType=:t1 or bi.bill.billType=:t2) and " + "bi.bill.billDate between :fd and :td group by bi.item " + "order by SUM(bi.pharmaceuticalBillItem.qty) desc"; List<Object[]> objs = getBillItemFacade().findAggregates(sql, m); movementRecordsQty = new ArrayList<>(); for (Object[] obj : objs) { StockReportRecord r = new StockReportRecord(); r.setItem((Item) obj[0]); r.setQty((Double) obj[1]); Days daysBetween = Days.daysBetween(LocalDate.fromDateFields(fromDate), LocalDate.fromDateFields(toDate)); int ds = daysBetween.getDays(); r.setPurchaseValue((Double) (r.getQty() / ds)); // r.setRetailsaleValue((Double) obj[2]); r.setStockQty(getStoreBean().getStockQty(r.getItem(), institution)); movementRecordsQty.add(r); } }
From source file:com.github.cassandra.jdbc.provider.datastax.CassandraPreparedStatement.java
License:Apache License
@Override protected void setParameter(int paramIndex, Object paramValue) throws SQLException { String typeName = parameterMetaData.getParameterTypeName(paramIndex); Class javaClass = getDataTypeMappings().javaTypeFor(typeName); boolean replaceNullValue = this.cqlStmt.getConfiguration().replaceNullValue(); if (javaClass != null) { paramValue = getDataTypeConverters().convert(paramValue, javaClass, replaceNullValue); // time is mapped by the driver to a primitive long, representing the number of nanoseconds since midnight if (CassandraDataType.TIME.getTypeName().equals(typeName) && paramValue instanceof Time) { Time time = (Time) paramValue; paramValue = new LocalTime(time).getMillisOfDay() * 1000000L; } else if (CassandraDataType.DATE.getTypeName().equals(typeName) && paramValue instanceof Date) { LocalDate localDate = LocalDate.fromDateFields((Date) paramValue); paramValue = com.datastax.driver.core.LocalDate.fromYearMonthDay(localDate.getYear(), localDate.getMonthOfYear(), localDate.getDayOfMonth()); } else if (CassandraDataType.BLOB.getTypeName().equals(typeName) && paramValue instanceof byte[]) { paramValue = ByteBuffer.wrap((byte[]) paramValue); }// www .j av a2 s. co m parameters.put(paramIndex, paramValue); } else { super.setParameter(paramIndex, paramValue); } }
From source file:com.github.cassandra.jdbc.provider.datastax.codecs.JavaSqlDateCodec.java
License:Apache License
@Override public ByteBuffer serialize(Date value, ProtocolVersion protocolVersion) { if (value == null) return null; Days days = daysBetween(EPOCH, LocalDate.fromDateFields(value)); int unsigned = fromSignedToUnsignedInt(days.getDays()); return cint().serializeNoBoxing(unsigned, protocolVersion); }
From source file:com.github.cassandra.jdbc.provider.datastax.codecs.JavaSqlDateCodec.java
License:Apache License
@Override public String format(Date value) { if (value == null) return "NULL"; return quote(FORMATTER.print(LocalDate.fromDateFields(value))); }
From source file:com.gst.infrastructure.campaigns.sms.domain.SmsCampaign.java
License:Apache License
public LocalDate getActivationLocalDate() { LocalDate activationLocalDate = null; if (this.approvedOnDate != null) { activationLocalDate = LocalDate.fromDateFields(this.approvedOnDate); }//from w w w.ja v a 2s . c om return activationLocalDate; }
From source file:com.gst.infrastructure.core.api.JsonCommand.java
License:Apache License
public boolean isChangeInDateParameterNamed(final String parameterName, final Date existingValue) { LocalDate localDate = null;//from ww w .ja va2 s . c o m if (existingValue != null) { localDate = LocalDate.fromDateFields(existingValue); } return isChangeInLocalDateParameterNamed(parameterName, localDate); }
From source file:com.gst.organisation.office.domain.Office.java
License:Apache License
public LocalDate getOpeningLocalDate() { LocalDate openingLocalDate = null; if (this.openingDate != null) { openingLocalDate = LocalDate.fromDateFields(this.openingDate); }// w w w . jav a 2 s .c o m return openingLocalDate; }
From source file:com.gst.organisation.teller.domain.Cashier.java
License:Apache License
public LocalDate getStartLocalDate() { LocalDate startLocalDate = null; if (this.startDate != null) { startLocalDate = LocalDate.fromDateFields(this.startDate); }//w w w .j a va2 s. c o m return startLocalDate; }
From source file:com.gst.organisation.teller.domain.Cashier.java
License:Apache License
public LocalDate getEndLocalDate() { LocalDate endLocalDate = null; if (this.endDate != null) { endLocalDate = LocalDate.fromDateFields(this.endDate); }/* w w w .java 2 s.c o m*/ return endLocalDate; }
From source file:com.gst.organisation.teller.domain.CashierTransaction.java
License:Apache License
public LocalDate getTxnLocalDate() { LocalDate txnLocalDate = null; if (this.txnDate != null) { txnLocalDate = LocalDate.fromDateFields(this.txnDate); }/*from w w w .j a v a2 s . co m*/ return txnLocalDate; }