Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.QValue


        QPropertyDefinition def = getApplicablePropertyDefinition(qName, type, false);
        int targetType = def.getRequiredType();
        if (targetType == PropertyType.UNDEFINED) {
            targetType = type;
        }
        QValue qvs;
        if (targetType == PropertyType.UNDEFINED) {
            qvs = ValueFormat.getQValue(value, session.getNamePathResolver(), session.getQValueFactory());
            targetType = qvs.getType();
        } else {
            Value targetValue = ValueHelper.convert(value, targetType, session.getValueFactory());
            qvs = ValueFormat.getQValue(targetValue, session.getNamePathResolver(), session.getQValueFactory());
        }
        return createProperty(qName, targetType, def, new QValue[] {qvs});
View Full Code Here


        }
    }

    public void value(String value) throws IOException {
        try {
            QValue v;
            switch (propertyType) {
                case SPECIAL_JSON_PAIR:
                    // currently no special boolean value pair -> ignore
                    return;
                case PropertyType.BINARY:
View Full Code Here

                parent.setNumberOfChildNodes(value);
            }
            return;
        }
        try {
            QValue v;
            if (propertyType == PropertyType.BINARY) {
                int indx = (mvPropInfo == null) ? -1 : mvPropInfo.numberOfValues();
                v = vFactory.create(value, getValueURI(), indx);
            } else {
                v = vFactory.create(value);
View Full Code Here

            int type;

            NamePathResolver resolver = getNamePathResolver(sessionInfo);
            if (ct.startsWith("jcr-value")) {
                type = JcrValueType.typeFromContentType(ct);               
                QValue v;
                if (type == PropertyType.BINARY) {
                    v = getQValueFactory().create(method.getResponseBodyAsStream());
                } else {
                    Reader reader = new InputStreamReader(method.getResponseBodyAsStream(), method.getResponseCharSet());
                    StringBuffer sb = new StringBuffer();
View Full Code Here

         * @inheritDoc
         */
        public void setPrimaryType(NodeId nodeId, Name primaryNodeTypeName) throws RepositoryException {
            assertMethod();

            QValue v = getQValueFactory(sessionInfo).create(primaryNodeTypeName);
            Path p = getPathFactory().create(getPath(nodeId, sessionInfo), NameConstants.JCR_PRIMARYTYPE, true);
            // register the diff entry including clearing previous calls to
            // setPrimaryType for the same node.
            setProperty(p, v, true);
        }
View Full Code Here

        }
    }

    public void testGetDoubleOnBooleanValue() throws RepositoryException {
        try {
            QValue v = factory.create(true);
            v.getDouble();
            fail("'true' cannot be converted to a valid double value.");
        } catch (ValueFormatException e) {
            // ok
        }
    }
View Full Code Here

        }
    }

    public void testGetLongOnBooleanValue() throws RepositoryException {
        try {
            QValue v = factory.create(true);
            v.getLong();
            fail("'true' cannot be converted to a valid long value.");
        } catch (ValueFormatException e) {
            // ok
        }
    }
View Full Code Here

        }
    }

    public void testGetDecimalOnBooleanValue() throws RepositoryException {
        try {
            QValue v = factory.create(true);
            v.getDecimal();
            fail("'true' cannot be converted to a valid decimal value.");
        } catch (ValueFormatException e) {
            // ok
        }
    }
View Full Code Here

     * type return equal objects.
     *
     * @throws RepositoryException
     */
    public void testCreateBooleanValueFromString() throws RepositoryException {
        QValue v = factory.create(Boolean.TRUE.toString(), PropertyType.BOOLEAN);
        assertEquals("Creating boolean type QValue from boolean or String must be equal.",
                factory.create(true), v);

        v = factory.create(Boolean.FALSE.toString(), PropertyType.BOOLEAN);
        assertEquals("Creating boolean type QValue from boolean or String must be equal.",
View Full Code Here

        assertEquals("Creating boolean type QValue from boolean or String must be equal.",
                factory.create(false), v);
    }

    public void testCreateTrueBooleanValue() throws RepositoryException {
        QValue v = factory.create(true);
        assertEquals("Boolean value must be true", Boolean.TRUE.toString(), v.getString());
        assertEquals("Boolean value must be true", true, v.getBoolean());
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.QValue

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.