Package org.apache.jackrabbit.value

Examples of org.apache.jackrabbit.value.StringValue


            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

    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 refereeName = "anyreferee";
            n.setProperty(UserConstants.P_REFEREES, new Value[] {new StringValue(refereeName)});
            fail("Attempt to change protected property rep:referees 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

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

        restr = new HashMap();
        restr.put("rep:nodePath",  restrictions.get("rep:nodePath"));
        restr.put("rep:glob"new StringValue(""));

        pe = createEntry(testPrincipal, privs, true, restr);
        assertEquals("", pe.getRestriction("rep:glob").getString());
    }
View Full Code Here

        User u = (User) uMgr.getAuthorizable(uID);
        if (u == null) {
            fail("User " +uID+ "hast not been removed and must be visible to the Session created with its credentials.");
        }

        u.setProperty("Email", new StringValue("tu@security.test"));
        assertEquals("tu@security.test", u.getProperty("Email")[0].getString());

        u.removeProperty("Email");
        assertNull(u.getProperty("Email"));
    }
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

                } 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

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

        restr = new HashMap();
        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();
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 restr = new HashMap();
        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

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.