List of usage examples for org.joda.time LocalDate toDateMidnight
@Deprecated
public DateMidnight toDateMidnight()
From source file:com.aperigeek.gotadate.parser.DateParser.java
License:Open Source License
public void parse() throws DateParseException { while (token != null) { LocalDate date = null; LocalTime time = null;/*from www. j a v a2 s .c o m*/ try { if (isDate()) { date = parseDate(); } else if (isRelativeDate()) { date = parseRelativeDate(); } else if (isMonthName(token)) { date = parseDateMonthFirst(); } if (isTime()) { time = parseTime(); } if (date == null) { if (isDate()) { date = parseDate(); } else if (isRelativeDate()) { date = parseRelativeDate(); } else if (isMonthName(token)) { date = parseDateMonthFirst(); } } } catch (UnexpectedTokenException ex) { } finally { if (time != null) { ReadableInstant ref = (date == null) ? now : date.toDateMidnight(); DateTime dt = time.toDateTime(ref); parsed.add(dt.toDate()); } else if (date != null) { parsed.add(date.toDate()); } } next(); } }
From source file:com.tourapp.tour.util.script.importdata.ImportOTACodeTablesProcess.java
License:Open Source License
/** * Run Method.//from www. j a v a 2 s.c o m */ public void run() { try { OTACodeTable recOTACodeTable = (OTACodeTable) this.getMainRecord(); OTACodes recOTACodes = (OTACodes) this.getRecord(OTACodes.OTA_CODES_FILE); String strFilePath = this.getProperty("filepath"); String NONE = "none"; String VALUE_PARAM = ".value"; IBindingFactory jc = BindingDirectory.getFactory(CodeTables.class); IUnmarshallingContext unmarshaller = jc.createUnmarshallingContext(); InputStream inStream = new FileInputStream(strFilePath); CodeTables codeTables = (CodeTables) unmarshaller.unmarshalDocument(inStream, Constants.URL_ENCODING); if (codeTables.getCodeTableList() != null) for (CodeTables.CodeTable table : codeTables.getCodeTableList()) { String strName = table.getName(); String strNameCode = table.getNameCode(); LocalDate calCreate = table.getCreationDate(); LocalDate calDeletion = table.getMarkedForDeletionDate(); CodeTables.CodeTable.Descriptions descriptions = table.getDescriptions(); Map<String, Object> properties = null; if (descriptions != null) for (FreeText desc : descriptions.getDescriptionList()) { String strLanguage = desc.getLanguage(); String strValue = desc.getString(); if ((strLanguage == null) || (strLanguage.length() == 0)) strLanguage = NONE; if (properties == null) properties = new HashMap<String, Object>(); properties.put(strLanguage, strValue); } recOTACodeTable.addNew(); recOTACodeTable.getField(OTACodeTable.NAME).setString(strName); recOTACodeTable.getField(OTACodeTable.NAME_CODE).setString(strNameCode); if (calCreate != null) ((DateField) recOTACodeTable.getField(OTACodeTable.CREATION_DATE)) .setDate(calCreate.toDateMidnight().toDate(), true, DBConstants.SCREEN_MOVE); if (calDeletion != null) ((DateField) recOTACodeTable.getField(OTACodeTable.DELETION_DATE)) .setDate(calDeletion.toDateMidnight().toDate(), true, DBConstants.SCREEN_MOVE); ((PropertiesField) recOTACodeTable.getField(OTACodeTable.PROPERTIES)).setProperties(properties); recOTACodeTable.add(); Object bookmark = recOTACodeTable.getLastModified(DBConstants.BOOKMARK_HANDLE); if (table.getCodes() != null) if (table.getCodes().getCodeList() != null) for (CodeTables.CodeTable.Codes.Code code : table.getCodes().getCodeList()) { String strValue2 = code.getValue(); LocalDate calCreate2 = code.getCreationDate(); LocalDate calDeletion2 = code.getMarkedForDeletionDate(); java.util.List<CodeContent> contents = code.getCodeContentList(); String strNameDefault = null; properties = null; if (contents != null) for (CodeContent contentType : contents) { String strLanguage = contentType.getLanguage(); String strName3 = contentType.getName(); String strValue3 = contentType.getString(); if (((strLanguage == null) || (strLanguage.length() == 0)) || (strNameDefault == null)) strNameDefault = strName3; if ((strLanguage == null) || (strLanguage.length() == 0)) strLanguage = NONE; if (properties == null) properties = new HashMap<String, Object>(); if ((strName3 != null) && (strName3.length() > 0)) properties.put(strLanguage, strName3); if ((strValue3 != null) && (strValue3.length() > 0)) properties.put(strLanguage + VALUE_PARAM, strValue3); } recOTACodes.addNew(); recOTACodes.getField(OTACodes.OTA_CODE_TABLE_ID).setString(bookmark.toString()); recOTACodes.getField(OTACodes.VALUE).setString(strValue2); recOTACodes.getField(OTACodes.NAME).setString(strNameDefault); if (calCreate2 != null) ((DateField) recOTACodes.getField(OTACodes.CREATION_DATE)).setDate( calCreate2.toDateMidnight().toDate(), true, DBConstants.SCREEN_MOVE); if (calDeletion2 != null) ((DateField) recOTACodes.getField(OTACodes.DELETION_DATE)).setDate( calDeletion2.toDateMidnight().toDate(), true, DBConstants.SCREEN_MOVE); ((PropertiesField) recOTACodes.getField(OTACodes.PROPERTIES)) .setProperties(properties); recOTACodes.add(); } } } catch (DBException ex) { ex.printStackTrace(); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (JiBXException e) { e.printStackTrace(); } }
From source file:com.tourgeek.tour.util.script.importdata.ImportOTACodeTablesProcess.java
License:Open Source License
/** * Run Method./*from www . j ava2s . c o m*/ */ public void run() { try { OTACodeTable recOTACodeTable = (OTACodeTable) this.getMainRecord(); OTACodes recOTACodes = (OTACodes) this.getRecord(OTACodes.OTA_CODES_FILE); String strFilePath = this.getProperty("filepath"); String NONE = "none"; String VALUE_PARAM = ".value"; IBindingFactory jc = BindingDirectory.getFactory(CodeTables.class); IUnmarshallingContext unmarshaller = jc.createUnmarshallingContext(); InputStream inStream = new FileInputStream(strFilePath); CodeTables codeTables = (CodeTables) unmarshaller.unmarshalDocument(inStream, Constants.URL_ENCODING); if (codeTables.getCodeTableList() != null) for (CodeTables.CodeTable table : codeTables.getCodeTableList()) { String strName = table.getName(); String strNameCode = table.getNameCode(); LocalDate calCreate = table.getCreationDate(); LocalDate calDeletion = table.getMarkedForDeletionDate(); CodeTables.CodeTable.Descriptions descriptions = table.getDescriptions(); Map<String, Object> properties = null; if (descriptions != null) for (org.jibx.schema.org.opentravel._2012B.base.FreeText desc : descriptions .getDescriptionList()) { String strLanguage = desc.getLanguage(); String strValue = desc.getString(); if ((strLanguage == null) || (strLanguage.length() == 0)) strLanguage = NONE; if (properties == null) properties = new HashMap<String, Object>(); properties.put(strLanguage, strValue); } recOTACodeTable.addNew(); recOTACodeTable.getField(OTACodeTable.NAME).setString(strName); recOTACodeTable.getField(OTACodeTable.NAME_CODE).setString(strNameCode); if (calCreate != null) ((DateField) recOTACodeTable.getField(OTACodeTable.CREATION_DATE)) .setDate(calCreate.toDateMidnight().toDate(), true, DBConstants.SCREEN_MOVE); if (calDeletion != null) ((DateField) recOTACodeTable.getField(OTACodeTable.DELETION_DATE)) .setDate(calDeletion.toDateMidnight().toDate(), true, DBConstants.SCREEN_MOVE); ((PropertiesField) recOTACodeTable.getField(OTACodeTable.PROPERTIES)).setProperties(properties); recOTACodeTable.add(); Object bookmark = recOTACodeTable.getLastModified(DBConstants.BOOKMARK_HANDLE); if (table.getCodes() != null) if (table.getCodes().getCodeList() != null) for (CodeTables.CodeTable.Codes.Code code : table.getCodes().getCodeList()) { String strValue2 = code.getValue(); LocalDate calCreate2 = code.getCreationDate(); LocalDate calDeletion2 = code.getMarkedForDeletionDate(); java.util.List<CodeContent> contents = code.getCodeContentList(); String strNameDefault = null; properties = null; if (contents != null) for (CodeContent contentType : contents) { String strLanguage = contentType.getLanguage(); String strName3 = contentType.getName(); String strValue3 = contentType.getString(); if (((strLanguage == null) || (strLanguage.length() == 0)) || (strNameDefault == null)) strNameDefault = strName3; if ((strLanguage == null) || (strLanguage.length() == 0)) strLanguage = NONE; if (properties == null) properties = new HashMap<String, Object>(); if ((strName3 != null) && (strName3.length() > 0)) properties.put(strLanguage, strName3); if ((strValue3 != null) && (strValue3.length() > 0)) properties.put(strLanguage + VALUE_PARAM, strValue3); } recOTACodes.addNew(); recOTACodes.getField(OTACodes.OTA_CODE_TABLE_ID).setString(bookmark.toString()); recOTACodes.getField(OTACodes.VALUE).setString(strValue2); recOTACodes.getField(OTACodes.NAME).setString(strNameDefault); if (calCreate2 != null) ((DateField) recOTACodes.getField(OTACodes.CREATION_DATE)).setDate( calCreate2.toDateMidnight().toDate(), true, DBConstants.SCREEN_MOVE); if (calDeletion2 != null) ((DateField) recOTACodes.getField(OTACodes.DELETION_DATE)).setDate( calDeletion2.toDateMidnight().toDate(), true, DBConstants.SCREEN_MOVE); ((PropertiesField) recOTACodes.getField(OTACodes.PROPERTIES)) .setProperties(properties); recOTACodes.add(); } } } catch (DBException ex) { ex.printStackTrace(); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (JiBXException e) { e.printStackTrace(); } }
From source file:com.welflex.model.hibernate.LocalDateUserType.java
License:Apache License
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException { if (value == null) { st.setNull(index, Types.DATE); } else {/*from w ww.ja v a2s .c o m*/ LocalDate localDate = (LocalDate) value; Date sqlDate = new Date(localDate.toDateMidnight().getMillis()); st.setDate(index, sqlDate); } }
From source file:de.brands4friends.daleq.examples.JdbcOrderDao.java
License:Apache License
@Override public List<Order> findExpensiveOrders(final long customerId, final LocalDate boughtAt, final BigDecimal minimumAmount) { final DateTime dateLower = boughtAt.toDateMidnight().toDateTime(); final DateTime dateUpper = dateLower.plusDays(1); return getJdbcTemplate().query("select o.* from CUSTOMER_ORDER o " + "LEFT JOIN (" + " SELECT o.ID as ORDER_ID,SUM(PRICE) as TOTAL" + " FROM CUSTOMER_ORDER o " + " LEFT JOIN CUSTOMER_ORDER_ITEM oi ON o.ID = oi.ORDER_ID " + " LEFT JOIN PRODUCT p ON oi.PRODUCT_ID = p.ID " + " GROUP BY o.ID" + ") prices ON o.ID = prices.ORDER_ID " + "WHERE o.CUSTOMER_ID = ? " + " AND o.CREATION >= ? " + " AND o.CREATION < ? " + " AND prices.TOTAL >= ? ", ROW_MAPPER, customerId, dateLower.toDate(), dateUpper.toDate(), minimumAmount); }
From source file:de.hh.changeRing.infrastructure.eclipselink.JodaLocalDateConverter.java
License:Open Source License
@Override public java.util.Date toDatabaseLayerType(org.joda.time.LocalDate objectValue) { return objectValue.toDateMidnight().toDate(); }
From source file:energy.usef.agr.model.ConnectionForecastSnapshot.java
License:Apache License
public void setPtuDate(LocalDate ptuDate) { if (ptuDate == null) { this.ptuDate = null; } else {//from w w w .jav a 2 s .c o m this.ptuDate = ptuDate.toDateMidnight().toDate(); } }
From source file:energy.usef.agr.model.DeviceRequest.java
License:Apache License
public void setPeriod(LocalDate period) { if (period == null) { this.period = null; } else {/*from w ww .j a va2 s .c o m*/ this.period = period.toDateMidnight().toDate(); } }
From source file:energy.usef.agr.model.Udi.java
License:Apache License
public void setValidFrom(LocalDate validFrom) { if (validFrom == null) { this.validFrom = null; } else {/*from w w w. j a v a 2 s . c om*/ this.validFrom = validFrom.toDateMidnight().toDate(); } }
From source file:energy.usef.agr.model.Udi.java
License:Apache License
public void setValidUntil(LocalDate validUntil) { if (validUntil == null) { this.validUntil = null; } else {//from w ww. j av a 2s . c o m this.validUntil = validUntil.toDateMidnight().toDate(); } }