Package javax.jcr

Examples of javax.jcr.ValueFormatException


    @Nonnull
    public PropertyState getSingleState() throws InvalidItemStateException, ValueFormatException {
        PropertyState p = getPropertyState();
        if (p.isArray()) {
            throw new ValueFormatException(p + " is multi-valued.");
        }
        return p;
    }
View Full Code Here


    @Nonnull
    public PropertyState getMultiState() throws InvalidItemStateException, ValueFormatException {
        PropertyState p = getPropertyState();
        if (!p.isArray()) {
            throw new ValueFormatException(p + " is single-valued.");
        }
        return p;
    }
View Full Code Here

                if (valueType == PropertyType.UNDEFINED) {
                    valueType = values[i].getType();
                } else if (valueType != values[i].getType()) {
                    String msg = "Inhomogeneous type of values (" + safeGetJCRPath() + ")";
                    log.debug(msg);
                    throw new ValueFormatException(msg);
                }
            }
        }

        int targetType = getDefinition().getRequiredType();
View Full Code Here

                    absolute = p.isAbsolute();
                    return (absolute) ? session.getNode(pathValue.getString()) : getParent().getNode(pathValue.getString());
                }

            default:
                throw new ValueFormatException("Property value cannot be converted to a PATH, REFERENCE or WEAKREFERENCE");
        }
    }
View Full Code Here

        boolean absolute;
        try {
            Path p = session.getPathResolver().getQPath(path);
            absolute = p.isAbsolute();
        } catch (RepositoryException e) {
            throw new ValueFormatException("Property value cannot be converted to a PATH");
        }
        return (absolute) ? session.getProperty(path) : getParent().getProperty(path);
    }
View Full Code Here

        // check common to properties and nodes
        checkIsWritable();

        // property specific check
        if (isMultiple() != multiValues) {
            throw new ValueFormatException(getPath() + "Multivalue definition of " + safeGetJCRPath() + " does not match to given value(s).");
        }
    }
View Full Code Here

     * @throws RepositoryException
     */
    private QValue getQValue() throws ValueFormatException, RepositoryException {
        checkStatus();
        if (isMultiple()) {
            throw new ValueFormatException(safeGetJCRPath() + " is multi-valued and can therefore only be retrieved as an array of values");
        }
        // avoid unnecessary object creation if possible
        return getPropertyState().getValue();
    }
View Full Code Here

     * @throws RepositoryException
     */
    private QValue[] getQValues() throws ValueFormatException, RepositoryException {
        checkStatus();
        if (!isMultiple()) {
            throw new ValueFormatException(safeGetJCRPath() + " is not multi-valued and can therefore only be retrieved as single value");
        }
        // avoid unnecessary object creation if possible
        return getPropertyState().getValues();
    }
View Full Code Here

     */
    static void checkValidReference(Node value, int propertyType, NameResolver resolver) throws ValueFormatException, RepositoryException {
        if (propertyType == PropertyType.REFERENCE) {
            String jcrName = resolver.getJCRName(NameConstants.MIX_REFERENCEABLE);
            if (!value.isNodeType(jcrName)) {
                throw new ValueFormatException("Target node must be of node type mix:referenceable");
            }
        } else {
            throw new ValueFormatException("Property must be of type REFERENCE.");
        }
    }
View Full Code Here

     * @return
     * @throws ValueFormatException if {@link #isMultiValued()} returns true.
     */
    public QValue getValue() throws ValueFormatException {
        if (isMultiValued()) {
            throw new ValueFormatException("'getValue' may not be called on a multi-valued state.");
        }
        QValue[] values = getValues();
        if (values == null || values.length == 0) {
            return null;
        } else {
View Full Code Here

TOP

Related Classes of javax.jcr.ValueFormatException

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.