Package javax.jcr

Examples of javax.jcr.Value


            return;
        }
        columnNames.add(DomUtil.getChildText(columnElement, JCR_NAME.getName(), JCR_NAME.getNamespace()));
        selectorNames.add(DomUtil.getChildText(columnElement, JCR_SELECTOR_NAME.getName(), JCR_SELECTOR_NAME.getNamespace()));

        Value jcrValue;
        Element valueElement = DomUtil.getChildElement(columnElement, JCR_VALUE.getName(), JCR_VALUE.getNamespace());
        if (valueElement != null) {
            String typeStr = DomUtil.getAttribute(valueElement, ATTR_VALUE_TYPE, ItemResourceConstants.NAMESPACE);
            jcrValue = ValueHelper.deserialize(DomUtil.getText(valueElement),
                    PropertyType.valueFromName(typeStr), true, valueFactory);
View Full Code Here


    public Element toXml(Document document) {
        Element elem = getName().toXml(document);
        for (int i = 0; i < columnNames.length; i++) {
            String propertyName = columnNames[i];
            String selectorName = selectorNames[i];
            Value propertyValue = values[i];

            Element columnEl = DomUtil.addChildElement(elem, COLUMN, ItemResourceConstants.NAMESPACE);
            DomUtil.addChildElement(columnEl, JCR_NAME.getName(), JCR_NAME.getNamespace(), propertyName);
            if (propertyValue != null) {
                try {
                    String serializedValue = ValueHelper.serialize(propertyValue, true);
                    Element xmlValue = DomUtil.addChildElement(columnEl, XML_VALUE, ItemResourceConstants.NAMESPACE, serializedValue);
                    String type = PropertyType.nameFromValue(propertyValue.getType());
                    DomUtil.setAttribute(xmlValue, ATTR_VALUE_TYPE, ItemResourceConstants.NAMESPACE, type);
                } catch (RepositoryException e) {
                    log.error(e.toString());
                }
            }
View Full Code Here

                    StringBuffer sb = new StringBuffer();
                    int c;
                    while ((c = reader.read()) > -1) {
                        sb.append((char) c);
                    }
                    Value jcrValue = valueFactory.createValue(sb.toString(), type);
                    if (jcrValue instanceof QValueValue) {
                        v = ((QValueValue) jcrValue).getQValue();
                    } else {
                        v = ValueFormat.getQValue(jcrValue, resolver, getQValueFactory());
                    }
View Full Code Here

                throws ValueFormatException, VersionException, LockException, ConstraintViolationException, PathNotFoundException, ItemExistsException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException {
            executeGuarded(new Callable() {
                public Object run() throws RepositoryException {
                    Session s = sInfo.getSession();
                    Node parent = getParent(parentId, sInfo);
                    Value jcrValue = ValueFormat.getJCRValue(value,
                            sInfo.getNamePathResolver(), s.getValueFactory());
                    parent.setProperty(getJcrName(propertyName), jcrValue);
                    return null;
                }
            });
View Full Code Here

        public void setValue(final PropertyId propertyId, final QValue value)
                throws RepositoryException {
            executeGuarded(new Callable() {
                public Object run() throws RepositoryException {
                    Session s = sInfo.getSession();
                    Value jcrValue = ValueFormat.getJCRValue(value,
                            sInfo.getNamePathResolver(), s.getValueFactory());
                    getProperty(propertyId, sInfo).setValue(jcrValue);
                    return null;
                }
            });
View Full Code Here

        if (offset != -1) {
            query.setOffset(offset);
        }
        if (values != null && !values.isEmpty()) {
            for (Map.Entry<String, QValue> entry : values.entrySet()) {
                Value value = ValueFormat.getJCRValue(entry.getValue(), sInfo.getNamePathResolver(), sInfo.getSession().getValueFactory());
                query.bindValue(entry.getKey(), value);
            }
        }
        return new QueryInfoImpl(query.execute(), idFactory,
                sInfo.getNamePathResolver(), getQValueFactory());
View Full Code Here

        public void key(String key) throws IOException {
            this.key = key;
        }

        public void value(String value) throws IOException {
            Value v = (value == null) ? null : vf.createValue(value);
            value(v);
        }
View Full Code Here

        public void value(boolean value) throws IOException {
            value(vf.createValue(value));
        }

        public void value(long value) throws IOException {
            Value v = vf.createValue(value);
            value(v);
        }
View Full Code Here

                        Value[] vs = extractValues(diffValue);
                        parent.setProperty(propName, vs);
                    }
                } else {
                    // single prop value included in the diff
                    Value v = extractValue(diffValue);
                    parent.setProperty(propName, v);
                }
            }
        } catch (RepositoryException e) {
            throw new DiffException(e.getMessage(), e);
View Full Code Here

                        ));
                return true;
            }
        } else {
            if (values.length >= 1) {
                Value v = referenceParser.parse(values[0], valFac, isWeakReference(type));
                if (v != null) {
                    changes.add(Modification.onModified(
                            parent.node.setProperty(name, v).getPath()
                            ));
                    return true;
View Full Code Here

TOP

Related Classes of javax.jcr.Value

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.