APISonar


org.apache.isis.applib.value.Date.Date

> org > apache > isis > applib > value > Date > Date
org APIs apache APIs isis APIs applib APIs value APIs Date APIs Date APIs

Example 1
private static Date daysFromToday(final int i) {
        final Date date = new Date(Clock.getTimeAsDateTime());
        date.add(0, 0, i);
        return date;
    }
Example 2
public void created() {
        status = "New";
        date = new Date(); // applib date uses the Clock
    }
Example 3
public void testParseEntryOfDaysBeforeToToday() throws Exception {
        final Date parsed = adapter.parseTextEntry(null, "-5");
        assertEquals(new Date(2003, 8, 12), parsed);
    }
Example 4
public String validateClaimsSince(final Claimant claimant, final Date since) {
        final Date today = new Date();
        return since.isGreaterThan(today) ? "cannot be after today" : null;
    }
Example 5
private Claim createClaim(final Employee claimant, final int days, final String description) {
        final Claim claim = newTransientInstance(Claim.class);
        claim.setClaimant(claimant);
        claim.setDescription(description);
        Date date = new Date();
        date = date.add(0, 0, days);
        claim.setDate(date);
        persist(claim);
        return claim;
    }
Example 6
public void addItem(@Named("Days since") final int days, @Named("Amount") final double amount, @Named("Description") final String description) {
        final ClaimItem claimItem = newTransientInstance(ClaimItem.class);
        Date date = new Date();
        date = date.add(0, 0, days);
        claimItem.setDateIncurred(date);
        claimItem.setDescription(description);
        claimItem.setAmount(new Money(amount, "USD"));
        persist(claimItem);
        addToItems(claimItem);
    }
Example 7
public void setUpObjects() throws Exception {
        context.checking(new Expectations() {
            {
                allowing(mockConfiguration).getString("isis.value.format.date");
                will(returnValue(null));
            }
        });

        TestClock.initialize();
        date = new Date(2001, 2, 4);
        holder = new FacetHolderImpl();
        setValue(adapter = new DateValueSemanticsProvider(holder, mockConfiguration, mockContext));
    }
Example 8
public Date getDate(final String columnName) {
        try {
            // 2010-03-05 = 1267747200000
            // 2010-04-08 = 1270684800000
            // This is really painful! Java refuses to create java.util.Date in
            // UTC!
            // It creates java.util.Dates in Local time-zone, but assumes the DB
            // date is UTC.
            final String string = set.getString(columnName);
            final DateTime utcDate = new DateTime(string, Defaults.getTimeZone());
            return new Date(utcDate);
        } catch (final SQLException e) {
            throw new SqlObjectStoreException(e);
        }
    }
Example 9
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"));
    }