Package org.apache.isis.applib.value

Examples of org.apache.isis.applib.value.DateTime


        // assertEquals("21-May-2007 10:30", adapter.titleString(null));
    }

    private void assertEntry(final String entry, final int year, final int month, final int day, final int hour, final int minute, final int second) {
        final Object object = adapter.parseTextEntry(null, entry, null);
        assertEquals(new DateTime(year, month, day, hour, minute, second), object);
    }
View Full Code Here


        super(holder, DateTime.class, Immutability.NOT_IMMUTABLE, EqualByContent.NOT_HONOURED, configuration, context);
    }

    @Override
    protected Date dateValue(final Object value) {
        final DateTime date = (DateTime) value;
        return date == null ? null : date.dateValue();
    }
View Full Code Here

        return date == null ? null : date.dateValue();
    }

    @Override
    protected DateTime add(final DateTime original, final int years, final int months, final int days, final int hours, final int minutes) {
        DateTime date = original;
        date = date.add(years, months, days, hours, minutes);
        return date;
    }
View Full Code Here

        return date;
    }

    @Override
    protected DateTime now() {
        return new DateTime();
    }
View Full Code Here

        return new DateTime();
    }

    @Override
    protected DateTime setDate(final Date date) {
        return new DateTime(date);
    }
View Full Code Here

        this.dataType = dataType;
    }

    @Override
    protected Object preparedStatementObject(final ObjectAdapter value) {
        final DateTime asDate = (DateTime) value.getObject();
        final java.sql.Timestamp dateTime = new java.sql.Timestamp(asDate.millisSinceEpoch());
        return dateTime;
    }
View Full Code Here

        ObjectAdapter restoredValue;
        final Class<?> correspondingClass = field.getSpecification().getCorrespondingClass();
        if (correspondingClass == DateTime.class) {
            final java.sql.Timestamp o = (java.sql.Timestamp) results.getObject(columnName);
            final DateTime timeValue = new DateTime(o.getTime());
            restoredValue = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(timeValue);
        } else {
            throw new PersistFailedException("Unhandled time type: " + correspondingClass.getCanonicalName());
        }
        return restoredValue;
View Full Code Here

         * actually be set to the dat BEFORE.
         *
         * This test is a simple test to confirm that date/time before and after checks work as expected.
         */

        DateTime dateTime = sqlDataClass.getDateTime(); // new DateTime(2010, 3, 5, 1, 23);
        Date date = sqlDataClass.getDate(); // new Date(2010, 3, 5);

        // java.sql.Date sqlDate = sqlDataClass.getSqlDate(); // "2010-03-05"
        // assertTrue("dateTime's value (" + dateTime.dateValue() + ") should be after java.sql.date's (" + sqlDate +
        // ")",
        // dateTime.dateValue().after(sqlDate));

        assertTrue("dateTime's value (" + dateTime.dateValue() + ") should be after date's (" + date + ")", dateTime
            .dateValue().after(date.dateValue()));

    }
View Full Code Here

    public Long toDatastoreType(DateTime memberValue) {
        if(memberValue == null) {
            return null;
        }

        DateTime d = (DateTime)memberValue;
        return d.getMillisSinceEpoch();
    }
View Full Code Here

    @Override
    public DateTime toMemberType(Long datastoreValue) {
        if(datastoreValue == null) {
            return null;
        }
        return new DateTime(datastoreValue);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.applib.value.DateTime

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.