@Override public Long getValue(Value value) throws RepositoryException { return value.getLong(); } };
@Override public Object unwrap(Value value) throws RepositoryException { return value.getLong(); } @Override
@Override public Object unwrap(Value value) throws RepositoryException { return value.getLong(); } @Override
@Override public Object unwrap(Value value) throws RepositoryException { return value.getLong(); } @Override
/** * Returns the long value of this property. Implemented as * getValue().getLong(). * * {@inheritDoc} */ public long getLong() throws RepositoryException { return getValue().getLong(); }
/** * @see Property#getLong() */ public long getLong() throws ValueFormatException, RepositoryException { return getValue().getLong(); }
public long getLong() throws ValueFormatException, RepositoryException { if (values.length > 1) { throw new ValueFormatException(); } return values[0].getLong(); }
/** * @see Property#getLong() */ public long getLong() throws ValueFormatException, RepositoryException { return getValue().getLong(); }
/** * Test the persistence of a property modified with an long parameter and * saved from the parent Node */ public void testLongParent() throws RepositoryException { property1.setValue(value.getLong()); node.save(); assertEquals("Long property not saved", value.getLong(), property1.getValue().getLong()); }
/** * Tests the conversion from a Long to a String Value. */ public void testGetString() throws RepositoryException { Value val = PropertyUtil.getValue(prop); String str = val.getString(); String otherStr = new Long(val.getLong()).toString(); assertEquals("Conversion from a Long value to a String value is not correct", str, otherStr); }
/** * Test the persistence of a property modified with an LongValue parameter * and saved from the Session */ public void testLongSession() throws RepositoryException { property1.setValue(value); superuser.save(); assertEquals("Long property not saved", value.getLong(), property1.getValue().getLong()); }
/** * tests the conversion from a Double to a Long Value */ public void testGetLong() throws RepositoryException { Value val = PropertyUtil.getValue(prop); long l = val.getLong(); long ll = new Double(val.getDouble()).longValue(); assertTrue("Conversion from Double value to Long value is not correct.", l == ll); }
/** * Tests conversion from Long type to Double type. */ public void testGetDouble() throws RepositoryException { Value val = PropertyUtil.getValue(prop); double d = val.getDouble(); assertEquals("Conversion from Long value to Double value is not correct.", new Long(val.getLong()).doubleValue(), d, 0d); }
/** * 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()); }
/** * 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); }
public Object visit(LengthImpl node, Object data) throws Exception { Value staticValue = (Value) data; // make sure it can be converted to Long try { staticValue.getLong(); } catch (ValueFormatException e) { throw new InvalidQueryException("Static value " + staticValue.getString() + " cannot be converted to a Long"); } PropertyValueImpl propValue = (PropertyValueImpl) node.getPropertyValue(); return new LengthOperand((PropertyValueOperand) propValue.accept(this, null)); }
public Object visit(LengthImpl node, Object data) throws Exception { Value staticValue = (Value) data; // make sure it can be converted to Long try { staticValue.getLong(); } catch (ValueFormatException e) { throw new InvalidQueryException("Static value " + staticValue.getString() + " cannot be converted to a Long"); } PropertyValueImpl propValue = (PropertyValueImpl) node.getPropertyValue(); return new LengthOperand((PropertyValueOperand) propValue.accept(this, null)); }
public boolean evaluate(User user) { try { Value[] numberOfLegs = user.getProperty("numberOfLegs"); return numberOfLegs != null && numberOfLegs.length == 1 && numberOfLegs[0].getLong() == 8; } catch (RepositoryException e) { fail(e.getMessage()); } return false; } });
public boolean apply(User user) { try { Value[] numberOfLegs = user.getProperty("numberOfLegs"); return numberOfLegs != null && numberOfLegs.length == 1 && numberOfLegs[0].getLong() == 8; } catch (RepositoryException e) { fail(e.getMessage()); } return false; } });
protected void verifyProperty( Node node, String propertyName, long expectedValue ) throws RepositoryException { Property property = node.getProperty(propertyName); Value value = property.isMultiple() ? property.getValues()[0] : property.getValue(); assertEquals(expectedValue, value.getLong()); }