@Override public Object unwrap(Value value) throws RepositoryException { return value.getDate(); } @Override
@Override public Object unwrap(Value value) throws RepositoryException { return value.getDate(); } @Override
@Override protected Calendar getValue(Value value) throws RepositoryException { return value.getDate(); }
private Date getDateValue(Value[] values) throws RepositoryException { if (values == null || values.length == 0) { return null; } return values[0].getDate().getTime(); }
@Override @NotNull public Calendar getDate() throws RepositoryException { return getValue().getDate(); }
/** * @see Property#getDate() */ public Calendar getDate() throws ValueFormatException, RepositoryException { return getValue().getDate(); }
@Override @NotNull public Calendar getDate() throws RepositoryException { return getValue().getDate(); }
public Calendar getDate() throws ValueFormatException, RepositoryException { if (values.length > 1) { throw new ValueFormatException(); } return values[0].getDate(); }
javax.jcr.query.QueryResult result = query.execute(); NodeIterator iter = result.getNodes(); while ( iter.hasNext() ) { Node node = iter.nextNode(); // The 'jcr:created' property is mandatory (and autocreated), so // in our case we don't have to check if the property exists // or handle a PathNotFoundException. And single-valued properties // always have a value. Value value = node.getProperty("jcr:created").getDate(); int year = value.getDate().get(Calendar.YEAR); // do something with the year }
/** Wrapper around {@link #getValue()} */ public Calendar getDate() throws RepositoryException { return getValue().getDate(); }
/** * Returns the date value of this property. Implemented as * getValue().getDate(). * * {@inheritDoc} */ public Calendar getDate() throws RepositoryException { return getValue().getDate(); }
@Override @Nonnull public Calendar getDate() throws RepositoryException { return getValue().getDate(); }
/** * @see Property#getDate() */ public Calendar getDate() throws ValueFormatException, RepositoryException { return getValue().getDate(); }
@Nonnull @Override public Calendar perform() throws RepositoryException { PropertyDelegate dlg = getPropertyOrThrow(JcrConstants.JCR_CREATED); return ValueFactoryImpl.createValue(dlg.getSingleState(), sessionContext).getDate(); } });
/** * tests conversion from Double type to Date type */ public void testGetDate() throws RepositoryException { Value val = PropertyUtil.getValue(prop); Calendar calendar = val.getDate(); assertEquals("Conversion from Double value to Date value is not correct.", calendar.getTimeInMillis(), new Double(val.getDouble()).longValue()); }
/** * Tests conversion from Date type to Long type. */ public void testGetLong() throws RepositoryException { Value val = PropertyUtil.getValue(prop); long l = val.getLong(); long mili = val.getDate().getTimeInMillis(); assertEquals("Conversion from a Date value to a Long value " + "returns a different number of miliseconds.", mili, l); }
/** * Tests conversion from Date type to Double type. */ public void testGetDouble() throws RepositoryException { Value val = PropertyUtil.getValue(prop); double d = val.getDouble(); long mili = val.getDate().getTimeInMillis(); assertEquals("Conversion from a Date value to a Double value " + "returns a different number of miliseconds.", mili, (long) d); }
/** * Tests conversion from Long type to Date type. */ public void testGetDate() throws RepositoryException { Value val = PropertyUtil.getValue(prop); Calendar calendar = val.getDate(); assertEquals("Conversion from Long value to Date value is not correct.", val.getLong(), calendar.getTimeInMillis()); }
/** * Test the persistence of a property modified with an date parameter and * saved from the parent Node */ public void testDateParent() throws RepositoryException { property1.setValue(value.getDate()); node.save(); Value orig = superuser.getValueFactory().createValue(value.getDate()); assertEquals("Date node property not saved", orig, property1.getValue()); }
private void assertPropertyEquals(Node node, String relPath, Calendar expectedValue) throws RepositoryException { assertTrue(node.hasProperty(relPath)); assertEquals(expectedValue.getTimeInMillis(), node.getProperty(relPath).getValue().getDate().getTimeInMillis()); } }