Examples of JcrValueFactory


Examples of org.brixcms.jcr.api.JcrValueFactory

    private static void assignProperties(List<NodePair> nodes, Map<String, String> uuidMap) {
        for (NodePair current : nodes) {
            JcrNode originalNode = current.originalNode;
            JcrNode targetNode = current.targetNode;

            JcrValueFactory vf = targetNode.getSession().getValueFactory();
            JcrPropertyIterator propertyIterator = originalNode.getProperties();
            while (propertyIterator.hasNext()) {
                JcrProperty property = propertyIterator.nextProperty();
                String name = property.getName();
                if (!property.getDefinition().isProtected()) {
View Full Code Here

Examples of org.modeshape.jcr.JcrValueFactory

     * @see org.modeshape.jcr.query.parse.BasicSqlQueryParser#literal(TypeSystem, Object)
     */
    @Override
    protected LiteralValue literal( TypeSystem typeSystem,
                                    Object value ) throws ValueFormatException {
        JcrValueFactory factory = ((JcrTypeSystem)typeSystem).getValueFactory();
        Value jcrValue = null;
        if (value instanceof String) {
            jcrValue = factory.createValue((String)value);
        } else if (value instanceof Boolean) {
            jcrValue = factory.createValue(((Boolean)value).booleanValue());
        } else if (value instanceof Binary) {
            jcrValue = factory.createValue((Binary)value);
        } else if (value instanceof DateTime) {
            jcrValue = factory.createValue(((DateTime)value).toCalendar());
        } else if (value instanceof Calendar) {
            jcrValue = factory.createValue((Calendar)value);
        } else if (value instanceof BigDecimal) {
            jcrValue = factory.createValue((BigDecimal)value);
        } else if (value instanceof Double) {
            jcrValue = factory.createValue((Double)value);
        } else if (value instanceof Long) {
            jcrValue = factory.createValue((Long)value);
        } else if (value instanceof Reference) {
            jcrValue = factory.createValue((Reference)value);
        } else if (value instanceof URI) {
            jcrValue = factory.createValue((URI)value);
        } else if (value instanceof InputStream) {
            Binary binary = factory.createBinary((InputStream)value);
            jcrValue = factory.createValue(binary);
        } else if (value instanceof Name || value instanceof Path) {
            // Convert first to a string ...
            String strValue = typeSystem.getStringFactory().create(value);
            jcrValue = factory.createValue(strValue);
        } else if (value instanceof Node) {
            try {
                jcrValue = factory.createValue((Node)value);
            } catch (RepositoryException e) {
                throw new ValueFormatException(value, PropertyType.REFERENCE,
                                               GraphI18n.errorConvertingType.text(Node.class.getSimpleName(),
                                                                                  Reference.class.getSimpleName(), value), e);
            }
        } else {
            jcrValue = factory.createValue(value.toString());
        }
        return new LiteralValue(jcrValue, value);
    }
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.