Package org.apache.jackrabbit.value

Examples of org.apache.jackrabbit.value.StringValue


                for (int i = 0; i < properties.length; i++) {
                    if (node.hasProperty(properties[i])) {
                        PropertyImpl prop = node.getProperty(properties[i]);
                        if (!prop.getDefinition().isMultiple()) {
                            if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED) {
                                tmp[i] = new StringValue(prop.getString());
                            } else {
                                tmp[i] = prop.getValue();
                            }
                        } else {
                            // mvp values cannot be returned
View Full Code Here


                    throw new ItemNotFoundException(propertyName);
                }
                if (node.hasProperty(prop)) {
                    Property p = node.getProperty(prop);
                    if (p.getDefinition().getRequiredType() == PropertyType.UNDEFINED) {
                        return new StringValue(p.getString());
                    } else {
                        return p.getValue();
                    }
                } else {
                    // either jcr:score, jcr:path or not set
View Full Code Here

                long time = System.currentTimeMillis();
                String excerpt = excerptProvider.getExcerpt(node.getNodeId(), 3, 150);
                time = System.currentTimeMillis() - time;
                log.debug("Created excerpt in {} ms.", new Long(time));
                if (excerpt != null) {
                    return new StringValue(excerpt);
                } else {
                    return null;
                }
            } catch (IOException e) {
                return null;
View Full Code Here

    public void testSetSpecialPropertiesDirectly() throws NotExecutableException, RepositoryException {
        AuthorizableImpl user = (AuthorizableImpl) getTestUser(superuser);
        NodeImpl n = user.getNode();
        try {
            String pName = user.getPrincipalName();
            n.setProperty(UserConstants.P_PRINCIPAL_NAME, new StringValue("any-value"));

            // should have failed => change value back.
            n.setProperty(UserConstants.P_PRINCIPAL_NAME, new StringValue(pName));
            fail("Attempt to change protected property rep:principalName should fail.");
        } catch (ConstraintViolationException e) {
            // ok.
        }
       
        try {
            String imperson = "anyimpersonator";
            n.setProperty(UserConstants.P_IMPERSONATORS, new Value[] {new StringValue(imperson)});
            fail("Attempt to change protected property rep:impersonators should fail.");
        } catch (ConstraintViolationException e) {
            // ok.
        }
    }
View Full Code Here

    public void testSetSpecialPropertiesDirectly() throws NotExecutableException, RepositoryException {
        AuthorizableImpl user = (AuthorizableImpl) getTestUser(superuser);
        NodeImpl n = user.getNode();
        try {
            String pName = user.getPrincipalName();
            n.setProperty(UserConstants.P_PRINCIPAL_NAME, new StringValue("any-value"));

            // should have failed => change value back.
            n.setProperty(UserConstants.P_PRINCIPAL_NAME, new StringValue(pName));
            fail("Attempt to change protected property rep:principalName should fail.");
        } catch (ConstraintViolationException e) {
            // ok.
        }
       
        try {
            String imperson = "anyimpersonator";
            n.setProperty(
                    UserConstants.P_IMPERSONATORS,
                    new Value[] {new StringValue(imperson)},
                    PropertyType.STRING);
            fail("Attempt to change protected property rep:impersonators should fail.");
        } catch (ConstraintViolationException e) {
            // ok.
        }
View Full Code Here

        if (!uSession.hasPermission(((UserImpl) u).getNode().getPath(), "set_property")) {
            throw new NotExecutableException("Users should be able to modify their properties -> Check repository config.");
        }

        // single valued properties
        u.setProperty("Email", new StringValue("tu@security.test"));
        save(uSession);

        assertNotNull(u.getProperty("Email"));
        assertEquals("tu@security.test", u.getProperty("Email")[0].getString());
View Full Code Here

            case PropertyType.PATH:
                return PathValue.valueOf(resolver.getJCRPath((Path) val));
            case PropertyType.NAME:
                return NameValue.valueOf(resolver.getJCRName((Name) val), false);
            case PropertyType.STRING:
                return new StringValue((String) val);
            default:
                throw new RepositoryException("illegal internal value type");
        }
    }
View Full Code Here

            case PropertyType.PATH:
                return PathValue.valueOf(resolver.getJCRPath((Path) val));
            case PropertyType.NAME:
                return NameValue.valueOf(resolver.getJCRName((Name) val), false);
            case PropertyType.STRING:
                return new StringValue((String) val);
            default:
                throw new RepositoryException("illegal internal value type");
        }
    }
View Full Code Here

                PropertyImpl prop = userNode.getProperty(P_IMPERSONATORS);
                userManager.removeProtectedItem(prop, userNode);
            } else {
                Value[] values = new Value[pNames.length];
                for (int i = 0; i < pNames.length; i++) {
                    values[i] = new StringValue(pNames[i]);
                }
                userManager.setProtectedProperty(userNode, P_IMPERSONATORS, values);
            }
        } catch (RepositoryException e) {
            // revert pending changes
View Full Code Here

                if (v instanceof Value) {
                    // create copy of the value
                    value = ValueHelper.copy((Value) v, VALUE_FACTORY);
                } else {
                    // fallback
                    value = new StringValue(v.toString());
                }
                this.restrictions.put(key.toString(), value);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.value.StringValue

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.