Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.CoreValue


        NodeState test = root.getChildNode("test");
        NodeStateBuilder testBuilder = store.getBuilder(test);

        NodeStateBuilder newNodeBuilder = store.getBuilder(MemoryNodeState.EMPTY_NODE);
        final CoreValue fortyTwo = store.getValueFactory().createValue(42);
        newNodeBuilder.setProperty("n", fortyTwo);

        testBuilder.setNode("newNode", newNodeBuilder.getNodeState());
        testBuilder.removeNode("a");
View Full Code Here


        NodeState test = root.getChildNode("test");
        NodeStateBuilder testBuilder = store.getBuilder(test);

        NodeStateBuilder newNodeBuilder = store.getBuilder(MemoryNodeState.EMPTY_NODE);
        final CoreValue fortyTwo = store.getValueFactory().createValue(42);
        newNodeBuilder.setProperty("n", fortyTwo);

        testBuilder.setNode("newNode", newNodeBuilder.getNodeState());
        testBuilder.removeNode("a");
View Full Code Here

        String uuid = UUID.randomUUID().toString();
        singleValueMap.put(valueFactory.createValue(uuid, PropertyType.REFERENCE), "\"ref:" +uuid+ '\"');
        singleValueMap.put(valueFactory.createValue(uuid, PropertyType.WEAKREFERENCE), "\"wea:" +uuid+ '\"');

        CoreValue binary = valueFactory.createValue(new ByteArrayInputStream("123".getBytes()));
        singleValueMap.put(binary, "\"bin:"+ binary.getString()+ '\"');

        // multi valued properties
        mvValueMap = new HashMap<String, List<CoreValue>>();
        mvValueMap.put("[]", Collections.<CoreValue>emptyList());

        List<CoreValue> strValues = new ArrayList<CoreValue>();
        strValues.add(valueFactory.createValue("abc"));
        strValues.add(valueFactory.createValue("a:bc"));
        strValues.add(valueFactory.createValue("boo:abc"));
        strValues.add(valueFactory.createValue("str:abc"));
        strValues.add(valueFactory.createValue("str:"));
        mvValueMap.put("[\"abc\",\"a:bc\",\"str:boo:abc\",\"str:str:abc\",\"str:str:\"]", strValues);

        List<CoreValue> boValues = new ArrayList<CoreValue>();
        boValues.add(valueFactory.createValue(true));
        boValues.add(valueFactory.createValue(false));
        mvValueMap.put("[true,false]", boValues);

        List<CoreValue> longs = new ArrayList<CoreValue>();
        longs.add(valueFactory.createValue(1));
        longs.add(valueFactory.createValue(2));
        longs.add(valueFactory.createValue(3));
        mvValueMap.put("[1,2,3]", longs);

        List<CoreValue> doubles = new ArrayList<CoreValue>();
        doubles.add(valueFactory.createValue(1.23));
        mvValueMap.put("[\"dou:1.23\"]", doubles);

        List<CoreValue> decimals = new ArrayList<CoreValue>();
        decimals.add(valueFactory.createValue(decimal));
        decimals.add(valueFactory.createValue(decimal));
        mvValueMap.put("[\"dec:" + decimal.toString() + "\",\"dec:" + decimal.toString() + "\"]", decimals);

        List<CoreValue> dates = Collections.singletonList(valueFactory.createValue("2012-05-01T12:00.000:00GMT", PropertyType.DATE));
        mvValueMap.put("[\"dat:2012-05-01T12:00.000:00GMT\"]", dates);

        List<CoreValue> names = Collections.singletonList(valueFactory.createValue("jcr:primaryType", PropertyType.NAME));
        mvValueMap.put("[\"nam:jcr:primaryType\"]", names);

        List<CoreValue> paths = new ArrayList<CoreValue>();
        paths.add(valueFactory.createValue("/jcr:system", PropertyType.PATH));
        paths.add(valueFactory.createValue("../../content", PropertyType.PATH));
        mvValueMap.put("[\"pat:/jcr:system\",\"pat:../../content\"]", paths);

        List<CoreValue> uris = Collections.singletonList(valueFactory.createValue("http://jackrabbit.apache.org", PropertyType.URI));
        mvValueMap.put("[\"uri:http://jackrabbit.apache.org\"]", uris);

        List<CoreValue> refs = new ArrayList<CoreValue>();
        refs.add(valueFactory.createValue(uuid, PropertyType.REFERENCE));
        mvValueMap.put("[\"ref:" +uuid+ "\"]", refs);

        List<CoreValue> wr = new ArrayList<CoreValue>();
        wr.add(valueFactory.createValue(uuid, PropertyType.WEAKREFERENCE));
        mvValueMap.put("[\"wea:" +uuid+ "\"]", wr);

        mvValueMap.put("[\"bin:"+ binary.getString()+ "\"]", Collections.singletonList(binary));
    }
View Full Code Here

        String ntName = (isGroup) ? UserConstants.NT_REP_GROUP : UserConstants.NT_REP_USER;
        Node authorizableNode = folder.addNode(nodeName, ntName);

        String nodeID = getNodeID(authorizableId);
        CoreValue idValue = ValueConverter.toCoreValue(nodeID, PropertyType.STRING, sessionDelegate);
        sessionDelegate.getNode(authorizableNode).setProperty(JcrConstants.JCR_UUID, idValue);

        return folder.getNode(nodeName);
    }
View Full Code Here

        }
        setInternalProperty(userNode, UserConstants.REP_PRINCIPAL_NAME, principal.getName(), PropertyType.STRING);
    }

    void setInternalProperty(Node userNode, String oakName, String value, int type) throws RepositoryException {
        CoreValue cv = ValueConverter.toCoreValue(value, type, sessionDelegate);
        sessionDelegate.getNode(userNode).setProperty(oakName, cv);
    }
View Full Code Here

*/
public class FilterTest extends AbstractQueryTest {

    @Test
    public void propertyRestriction() {
        CoreValue one = vf.createValue("1");
        CoreValue two = vf.createValue("2");

        FilterImpl f = new FilterImpl(null);
        assertTrue(null == f.getPropertyRestriction("x"));
        f.restrictProperty("x", Operator.LESS_OR_EQUAL, two);
        assertEquals("..2]", f.getPropertyRestriction("x").toString());
View Full Code Here

            if (property.isArray()) {
                for (CoreValue value : property.getValues()) {
                    first = render(first, name, value, writer);
                }
            } else {
                CoreValue value = property.getValue();
                first = render(first, name, value, writer);
            }
        }
    }
View Full Code Here

        RootImpl root1 = createRootImpl(null);
        RootImpl root2 = createRootImpl(null);

        checkEqual(root1.getTree("/"), root2.getTree("/"));

        CoreValue value = valueFactory.createValue("V1");
        root2.getTree("/").addChild("one").addChild("two").addChild("three")
                .setProperty("p1", value);
        root2.commit(DefaultConflictHandler.OURS);

        root1.rebase(DefaultConflictHandler.OURS);
View Full Code Here

        expectedProperties.put("b", valueFactory.createValue(2));
        expectedProperties.put("c", valueFactory.createValue(3));

        Iterable<? extends PropertyState> properties = tree.getProperties();
        for (PropertyState property : properties) {
            CoreValue value = expectedProperties.remove(property.getName());
            assertNotNull(value);
            assertFalse(property.isArray());
            assertEquals(value, property.getValue());
        }
View Full Code Here

    public void setProperty() throws CommitFailedException {
        RootImpl root = createRootImpl(null);
        Tree tree = root.getTree("/");

        assertFalse(tree.hasProperty("new"));
        CoreValue value = valueFactory.createValue("value");
        tree.setProperty("new", value);
        PropertyState property = tree.getProperty("new");
        assertNotNull(property);
        assertEquals("new", property.getName());
        assertEquals(value, property.getValue());
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.api.CoreValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.