Package org.apache.isis.applib.value

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


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

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


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

        iswf.beginTran();
       
        ApplibValuedEntity entity = repo.newEntity();
        entity.setStringProperty("1");

        Date date = new Date();
        entity.setDateProperty(date);
       
        iswf.commitTran();

        iswf.bounceSystem();
       
        iswf.beginTran();
        entity = repo.list().get(0);
        assertThat(entity.getDateProperty().dateValue(), is(date.dateValue()));
       
        date = date.add(-1, -1, -1);
        entity.setDateProperty(date);
       
        iswf.commitTran();

        iswf.bounceSystem();
       
        iswf.beginTran();
        entity = repo.list().get(0);
        assertThat(entity.getDateProperty().dateValue(), is(date.dateValue()));
       
        iswf.commitTran();
    }
View Full Code Here

    }
   
    @Test
    public void roundtripWhenParsingDateFormat() {
        final DateConverterForApplibDate converter = new DateConverterForApplibDate(settings, 0);
        final Date dt = converter.convertToObject("2013-05-11", null);
        assertThat(dt, is(new Date(2013, 05, 11)));
       
        final String str = converter.convertToString(dt, null);
        assertThat(str, is("2013-05-11"));
    }
View Full Code Here

    }

    @Test
    public void roundtripWhenParsingDateFormatWithAdjustBy() {
        final DateConverterForApplibDate converter = new DateConverterForApplibDate(settings, -1);
        final Date dt = converter.convertToObject("2013-05-11", null);
        assertThat(dt, is(new Date(2013, 05, 12)));
       
        final String str = converter.convertToString(dt, null);
        assertThat(str, is("2013-05-11"));
    }
View Full Code Here

            }
        });

        TestClock.initialize();
        setupSpecification(Date.class);
        date = new Date(2001, 2, 4);
        holder = new FacetHolderImpl();
        setValue(adapter = new DateValueSemanticsProvider(holder, mockConfiguration, mockContext));
    }
View Full Code Here

        assertEquals("20010204", adapter.toEncodedString(date));
    }

    @Test
    public void testParseEntryOfDaysAfterDate() throws Exception {
        final Date parsed = adapter.parseTextEntry(date, "+7");
        assertEquals(new Date(2001, 2, 11), parsed);
    }
View Full Code Here

        assertEquals(new Date(2001, 2, 11), parsed);
    }

    @Test
    public void testParseEntryOfDaysAfterToToday() throws Exception {
        final Date parsed = adapter.parseTextEntry(null, "+5");
        assertEquals(new Date(2003, 8, 22), parsed);
    }
View Full Code Here

        assertEquals(new Date(2003, 8, 22), parsed);
    }

    @Test
    public void testParseEntryOfDaysBeforeDate() throws Exception {
        final Date parsed = adapter.parseTextEntry(date, "-7");
        assertEquals(new Date(2001, 1, 28), parsed);
    }
View Full Code Here

        assertEquals(new Date(2001, 1, 28), parsed);
    }

    @Test
    public void testParseEntryOfDaysBeforeToToday() throws Exception {
        final Date parsed = adapter.parseTextEntry(null, "-5");
        assertEquals(new Date(2003, 8, 12), parsed);
    }
View Full Code Here

TOP

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

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.