Search in sources :

Example 96 with Value

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);
    }
}
Also used : RemoteProperty(org.apache.jackrabbit.rmi.remote.RemoteProperty) Value(javax.jcr.Value) RemoteException(java.rmi.RemoteException)

Example 97 with Value

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);
    }
}
Also used : RemoteProperty(org.apache.jackrabbit.rmi.remote.RemoteProperty) Value(javax.jcr.Value) RemoteException(java.rmi.RemoteException)

Example 98 with Value

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);
    }
}
Also used : RemoteProperty(org.apache.jackrabbit.rmi.remote.RemoteProperty) Value(javax.jcr.Value) RemoteException(java.rmi.RemoteException)

Example 99 with Value

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
}
Also used : Value(javax.jcr.Value) ValueFormatException(javax.jcr.ValueFormatException) BigDecimal(java.math.BigDecimal)

Example 100 with Value

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
}
Also used : Value(javax.jcr.Value) ValueFormatException(javax.jcr.ValueFormatException) BigDecimal(java.math.BigDecimal)

Aggregations

Value (javax.jcr.Value)600 Node (javax.jcr.Node)158 Test (org.junit.Test)118 Property (javax.jcr.Property)99 RepositoryException (javax.jcr.RepositoryException)82 NotExecutableException (org.apache.jackrabbit.test.NotExecutableException)82 PropertyDefinition (javax.jcr.nodetype.PropertyDefinition)70 Session (javax.jcr.Session)63 NodeType (javax.jcr.nodetype.NodeType)57 ValueFormatException (javax.jcr.ValueFormatException)53 ValueFactory (javax.jcr.ValueFactory)51 QValue (org.apache.jackrabbit.spi.QValue)51 HashMap (java.util.HashMap)46 ArrayList (java.util.ArrayList)31 ConstraintViolationException (javax.jcr.nodetype.ConstraintViolationException)30 Privilege (javax.jcr.security.Privilege)30 InputStream (java.io.InputStream)29 JackrabbitNode (org.apache.jackrabbit.api.JackrabbitNode)29 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)29 QValueValue (org.apache.jackrabbit.spi.commons.value.QValueValue)27