use of javax.jcr.Value in project jackrabbit by apache.
the class ClientNode method setProperty.
/** {@inheritDoc} */
public Property setProperty(String name, Value[] values) throws RepositoryException {
try {
if (values == null) {
remote.setProperty(name, values);
return null;
} else {
Value[] serials = SerialValueFactory.makeSerialValueArray(values);
RemoteProperty property = remote.setProperty(name, serials);
return getFactory().getProperty(getSession(), property);
}
} catch (RemoteException ex) {
throw new RemoteRepositoryException(ex);
}
}
use of javax.jcr.Value in project jackrabbit by apache.
the class ClientNode method setProperty.
/** {@inheritDoc} */
public Property setProperty(String name, String[] strings) throws RepositoryException {
try {
if (strings == null) {
remote.setProperty(name, (Value[]) null);
return null;
} else {
Value[] serials = SerialValueFactory.makeSerialValueArray(strings);
RemoteProperty property = remote.setProperty(name, serials);
return getFactory().getProperty(getSession(), property);
}
} catch (RemoteException ex) {
throw new RemoteRepositoryException(ex);
}
}
use of javax.jcr.Value in project jackrabbit by apache.
the class ClientNode method setProperty.
/** {@inheritDoc} */
public Property setProperty(String name, String[] strings, int type) throws RepositoryException {
try {
if (strings == null) {
remote.setProperty(name, (Value[]) null);
return null;
} else {
Value[] serials = SerialValueFactory.makeSerialValueArray(strings);
RemoteProperty property = remote.setProperty(name, serials, type);
return getFactory().getProperty(getSession(), property);
}
} catch (RemoteException ex) {
throw new RemoteRepositoryException(ex);
}
}
use of javax.jcr.Value in project jackrabbit by apache.
the class SimpleValueFactoryTest method testDouble.
public void testDouble() throws RepositoryException {
double a = 123456789.0;
Value value = factory.createValue(a);
assertEquals(PropertyType.DOUBLE, value.getType());
assertEquals(value, factory.createValue(a));
try {
value.getBoolean();
fail();
} catch (ValueFormatException e) {
}
assertEquals((long) a, value.getDate().getTimeInMillis());
assertEquals(new BigDecimal(a), value.getDecimal());
assertEquals(a, value.getDouble());
assertEquals((long) a, value.getLong());
assertEquals(Double.toString(a), value.getString());
// TODO: binary representation
}
use of javax.jcr.Value in project jackrabbit by apache.
the class SimpleValueFactoryTest method testDecimal.
public void testDecimal() throws RepositoryException {
BigDecimal a = new BigDecimal(1234567890);
Value value = factory.createValue(a);
assertEquals(PropertyType.DECIMAL, value.getType());
assertEquals(value, factory.createValue(a));
try {
value.getBoolean();
fail();
} catch (ValueFormatException e) {
}
assertEquals(a.longValue(), value.getDate().getTimeInMillis());
assertEquals(a, value.getDecimal());
assertEquals(a.doubleValue(), value.getDouble());
assertEquals(a.longValue(), value.getLong());
assertEquals(a.toString(), value.getString());
// TODO: binary representation
}
Aggregations