Package org.apache.jackrabbit.value

Examples of org.apache.jackrabbit.value.StringValue


                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


                } catch (NoPrefixDeclaredException npde) {
                    // should never get here...
                    throw new RepositoryException("internal error: encountered unregistered namespace", npde);
                }
            case PropertyType.STRING:
                return new StringValue((String) val);
            default:
                throw new RepositoryException("illegal internal value type");
        }
    }
View Full Code Here

                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

                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

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

            // should have failed => change value back.
            n.setProperty(UserConstants.REP_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.REP_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

        pe = createEntry(testPrincipal, privs, true, restr);
        assertNull(pe.getRestriction(glob));

        restr = new HashMap<String, Value>();
        restr.put(nodePath,  restrictions.get(nodePath));
        restr.put(glob,  new StringValue(""));

        pe = createEntry(testPrincipal, privs, true, restr);
        assertEquals("", pe.getRestriction(glob).getString());

        restr = new HashMap<String, Value>();
View Full Code Here

        // ACLTemplate impl tries to convert the property types if the don't
        // match the required ones.
        Privilege[] privs = privilegesFromName(Privilege.JCR_ALL);

        Map<String, Value> restr = new HashMap<String, Value>();
        restr.put(nodePath, new StringValue("/a/b/c/d"));
        JackrabbitAccessControlEntry pe = createEntry(testPrincipal, privs, true, restr);

        assertEquals("/a/b/c/d", pe.getRestriction(nodePath).getString());
        assertEquals(PropertyType.PATH, pe.getRestriction(nodePath).getType());
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

        return new DateValue(calendar);
    }

    @Converter
    public static Value toValue(String value) {
        return new StringValue(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.