Examples of createValue()


Examples of javax.jcr.ValueFactory.createValue()

               
                Node contentNode = session.getNode("/content/test-root/file.txt/jcr:content");
                contentNode.addMixin("sling:chunks");

                Node chunkNode = contentNode.addNode("firstChunk", "sling:chunk");
                chunkNode.setProperty("sling:offset", valueFactory.createValue(0));
                chunkNode.setProperty( "jcr:data",
                        valueFactory.createValue( valueFactory.createBinary(
                                        new ByteArrayInputStream("hello, world".getBytes()))));

                session.save();
View Full Code Here

Examples of javax.jcr.ValueFactory.createValue()

                contentNode.addMixin("sling:chunks");

                Node chunkNode = contentNode.addNode("firstChunk", "sling:chunk");
                chunkNode.setProperty("sling:offset", valueFactory.createValue(0));
                chunkNode.setProperty( "jcr:data",
                        valueFactory.createValue( valueFactory.createBinary(
                                        new ByteArrayInputStream("hello, world".getBytes()))));

                session.save();

                return null;
View Full Code Here

Examples of javax.jcr.ValueFactory.createValue()

        node.setProperty("content.approved", APPROVED);
        node.setProperty("my.contents.property", CONTENT);
       
       
        ValueFactory valFact = session.getValueFactory();
        Value[] vals = new Value[] {valFact.createValue("value-1"), valFact.createValue("value-2")};
        node.setProperty("my.multi.valued", vals);
       
        identifier = node.getIdentifier();

        session.save();
View Full Code Here

Examples of javax.jcr.ValueFactory.createValue()

        node.setProperty("content.approved", APPROVED);
        node.setProperty("my.contents.property", CONTENT);
       
       
        ValueFactory valFact = session.getValueFactory();
        Value[] vals = new Value[] {valFact.createValue("value-1"), valFact.createValue("value-2")};
        node.setProperty("my.multi.valued", vals);
       
        identifier = node.getIdentifier();

        session.save();
View Full Code Here

Examples of javax.jcr.ValueFactory.createValue()

        super.setUp();

        Session session = openSession();

        ValueFactory valFact = session.getValueFactory();
        multiValued = new Value[]{valFact.createValue("value-1"),
                valFact.createValue("value-2")};

        session.logout();
    }
View Full Code Here

Examples of javax.jcr.ValueFactory.createValue()

        Session session = openSession();

        ValueFactory valFact = session.getValueFactory();
        multiValued = new Value[]{valFact.createValue("value-1"),
                valFact.createValue("value-2")};

        session.logout();
    }

    @Test
View Full Code Here

Examples of javax.jcr.ValueFactory.createValue()

    private void createOrUpdateIndex(Node indexNode, IndexDefinition def) throws RepositoryException {
        ValueFactory valueFactory = indexNode.getSession().getValueFactory();

        indexNode.setProperty(PN_TYPE, TYPE_PROPERTY);
        indexNode.setProperty(PN_PROPERTY_NAMES,
                new Value[] { valueFactory.createValue(def.propertyName, PropertyType.NAME) });
        if (def.async) {
            indexNode.setProperty(PN_ASYNC, PN_ASYNC);
        } else if (indexNode.hasProperty(PN_ASYNC)) {
            indexNode.getProperty(PN_ASYNC).remove();
        }
View Full Code Here

Examples of javax.jcr.ValueFactory.createValue()

            indexNode.getProperty(PN_UNIQUE).remove();
        }
        if (def.declaringNodeTypes != null && def.declaringNodeTypes.length > 0) {
            Value[] values = new Value[def.declaringNodeTypes.length];
            for (int i = 0; i < def.declaringNodeTypes.length; i++) {
                values[i] = valueFactory.createValue(def.declaringNodeTypes[0], PropertyType.NAME);
            }
            indexNode.setProperty(PN_DECLARING_NODE_TYPES, values);
        } else if (indexNode.hasProperty(PN_DECLARING_NODE_TYPES)) {
            indexNode.getProperty(PN_DECLARING_NODE_TYPES).remove();
        }
View Full Code Here

Examples of javax.jcr.ValueFactory.createValue()

        QueryManager qm = session.getWorkspace().getQueryManager();

        // SQL-2

        Query q = qm.createQuery("select text from [nt:base] where id = $id", Query.JCR_SQL2);
        q.bindValue("id", vf.createValue("1"));
        QueryResult r = q.execute();
        RowIterator it = r.getRows();
        assertTrue(it.hasNext());
        Row row = it.nextRow();
        assertEquals("hello_world", row.getValue("text").getString());
View Full Code Here

Examples of javax.jcr.ValueFactory.createValue()

        hello2.setProperty("data""y");
        session.save();
        ValueFactory vf = session.getValueFactory();
        QueryManager qm = session.getWorkspace().getQueryManager();
        Query q = qm.createQuery("select id from [nt:base] where data >= $data order by id", Query.JCR_SQL2);
        q.bindValue("data", vf.createValue("x"));
        for (int i = -1; i < 5; i++) {
            QueryResult r = q.execute();
            RowIterator it = r.getRows();
            assertEquals(3, r.getRows().getSize());
            assertEquals(3, r.getNodes().getSize());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.