use of javax.jcr.ValueFactory in project jackrabbit by apache.
the class NameTest method testExpandedNameValueProperty.
/**
* Expanded names must always be resolved.
* Test setting a NAME-value property.
*
* @throws RepositoryException
*/
public void testExpandedNameValueProperty() throws RepositoryException {
ValueFactory vf = superuser.getValueFactory();
Value nameValue = vf.createValue(Workspace.NAME_VERSION_STORAGE_NODE, PropertyType.NAME);
Property p = testRootNode.setProperty(propertyName1, nameValue);
assertEquals(PropertyType.NAME, p.getType());
assertEquals(nameValue.getString(), p.getValue().getString());
assertEquals(nameValue, p.getValue());
assertEquals("jcr:versionStorage", p.getString());
}
use of javax.jcr.ValueFactory in project jackrabbit by apache.
the class NameTest method testExpandedNameValue.
/**
* Expanded names must always be resolved.
* Test NAME-value creation.
*
* @throws RepositoryException
*/
public void testExpandedNameValue() throws RepositoryException {
ValueFactory vf = superuser.getValueFactory();
Value nameValue = vf.createValue(Workspace.NAME_VERSION_STORAGE_NODE, PropertyType.NAME);
assertEquals(PropertyType.NAME, nameValue.getType());
assertEquals(nameValue.getString(), vf.createValue("jcr:versionStorage", PropertyType.NAME).getString());
assertEquals(nameValue, vf.createValue("jcr:versionStorage", PropertyType.NAME));
assertEquals("jcr:versionStorage", nameValue.getString());
}
use of javax.jcr.ValueFactory in project jackrabbit by apache.
the class TestContentLoader method addPropertyTestData.
/**
* Creates a boolean, double, long, calendar and a path property at the
* given node.
*/
private void addPropertyTestData(Node node) throws RepositoryException {
node.setProperty("boolean", true);
node.setProperty("double", Math.PI);
node.setProperty("long", 90834953485278298l);
Calendar c = Calendar.getInstance();
c.set(2005, 6, 18, 17, 30);
node.setProperty("calendar", c);
ValueFactory factory = node.getSession().getValueFactory();
node.setProperty("path", factory.createValue("/", PropertyType.PATH));
node.setProperty("multi", new String[] { "one", "two", "three" });
}
use of javax.jcr.ValueFactory in project jackrabbit by apache.
the class LowerCaseOperand method getValues.
/**
* {@inheritDoc}
*/
public Value[] getValues(ScoreNode sn, EvaluationContext context) throws RepositoryException {
ValueFactory vf = context.getSession().getValueFactory();
Value[] values = operand.getValues(sn, context);
for (int i = 0; i < values.length; i++) {
values[i] = vf.createValue(values[i].getString().toLowerCase());
}
return values;
}
use of javax.jcr.ValueFactory in project jackrabbit by apache.
the class UpperCaseOperand method getValues.
/**
* {@inheritDoc}
*/
public Value[] getValues(ScoreNode sn, EvaluationContext context) throws RepositoryException {
ValueFactory vf = context.getSession().getValueFactory();
Value[] values = operand.getValues(sn, context);
for (int i = 0; i < values.length; i++) {
values[i] = vf.createValue(values[i].getString().toUpperCase());
}
return values;
}
Aggregations