Package org.apache.jackrabbit.core

Examples of org.apache.jackrabbit.core.PropertyImpl


            // traverse the tree below groups-path and collect membership manually.
            log.info("Traversing groups tree to collect membership.");
            ItemVisitor visitor = new TraversingItemVisitor.Default() {
                @Override
                protected void entering(Property property, int level) throws RepositoryException {
                    PropertyImpl pImpl = (PropertyImpl) property;
                    NodeImpl n = (NodeImpl) pImpl.getParent();
                    if (P_MEMBERS.equals(pImpl.getQName()) && n.isNodeType(NT_REP_GROUP)) {
                        for (Value value : property.getValues()) {
                            if (value.getString().equals(node.getIdentifier())) {
                                Group gr = (Group) userManager.getAuthorizable(n);
                                groups.add(gr);
                            }
View Full Code Here


                node.getSession()
        ));

        PropertyIterator iter = node.getProperties();
        while (iter.hasNext()) {
            PropertyImpl prop = (PropertyImpl) iter.nextProperty();
            events.add(EventState.propertyAdded(
                    (NodeId) node.getId(),
                    node.getPrimaryPath(),
                    prop.getPrimaryPath().getNameElement(),
                    ((NodeTypeImpl) node.getPrimaryNodeType()).getQName(),
                    node.getMixinTypeNames(),
                    node.getSession()
            ));
        }
View Full Code Here

                        case Event.PROPERTY_ADDED:
                        case Event.PROPERTY_CHANGED:
                            // test if the added/changed prop belongs to an ACe
                            // node and affects the permission of any of the
                            // principals listed in principalNames.
                            PropertyImpl p = (PropertyImpl) session.getProperty(path);
                            NodeImpl parent = (NodeImpl) p.getParent();
                            if (parent.isNodeType(NT_REP_ACE)) {
                                String principalName = null;
                                if (P_PRIVILEGES.equals(p.getQName())) {
                                    // test if principal-name sibling-prop matches
                                    principalName = parent.getProperty(P_PRINCIPAL_NAME).getString();
                                } else if (P_PRINCIPAL_NAME.equals(p.getQName())) {
                                    // a new ace or an ace change its principal-name.
                                    principalName = p.getString();
                                }
                                if (principalName != null &&
                                        principalNames.contains(principalName)) {
                                    clearCache = true;
                                }
View Full Code Here

    private void updateImpersonatorNames(Set<String> principalNames) throws RepositoryException {
        NodeImpl userNode = user.getNode();
        try {
            String[] pNames = principalNames.toArray(new String[principalNames.size()]);
            if (pNames.length == 0) {
                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]);
View Full Code Here

            throw new RepositoryException("The administrator user cannot be disabled.");
        }
        if (reason == null) {
            if (isDisabled()) {
                // enable the user again.
                PropertyImpl disableProp = getNode().getProperty(P_DISABLED);
                userManager.removeProtectedItem(disableProp, getNode());
            } // else: nothing to do.
        } else {
            Value v = getSession().getValueFactory().createValue(reason);
            userManager.setProtectedProperty(getNode(), P_DISABLED, v);
View Full Code Here

                    try {
                        NodeImpl node = (NodeImpl) session.getItemManager().getItem(nodeId);
                        Path nodePath = node.getPrimaryPath();

                        if (node.hasProperty(RetentionManagerImpl.REP_HOLD)) {
                            PropertyImpl prop = node.getProperty(RetentionManagerImpl.REP_HOLD);
                            addHolds(nodePath, prop);
                        }
                        if (node.hasProperty(RetentionManagerImpl.REP_RETENTION_POLICY)) {
                            PropertyImpl prop = node.getProperty(RetentionManagerImpl.REP_RETENTION_POLICY);
                            addRetentionPolicy(nodePath, prop);
                        }
                    } catch (RepositoryException e) {
                        // node doesn't exist any more or hold/retention has been removed.
                        // ignore. upon close() the file will not contain the given nodeId
View Full Code Here

                    switch (ev.getType()) {
                        case Event.PROPERTY_ADDED:
                        case Event.PROPERTY_CHANGED:
                            // build the Hold objects from the rep:hold property
                            // and put them into the hold map.
                            PropertyImpl p = (PropertyImpl) session.getProperty(ev.getPath());
                            addHolds(nodePath, p);
                            break;
                        case Event.PROPERTY_REMOVED:
                            // all holds present on this node were remove
                            // -> remove the corresponding entry in the holdMap.
                            removeHolds(nodePath);
                            break;
                    }
                } else if (RetentionManagerImpl.REP_RETENTION_POLICY.equals(propName)) {
                    // retention policy changes
                    switch (ev.getType()) {
                        case Event.PROPERTY_ADDED:
                        case Event.PROPERTY_CHANGED:
                            // build the RetentionPolicy objects from the rep:retentionPolicy property
                            // and put it into the retentionMap.
                            PropertyImpl p = (PropertyImpl) session.getProperty(ev.getPath());
                            addRetentionPolicy(nodePath, p);
                            break;
                        case Event.PROPERTY_REMOVED:
                            // retention policy present on this node was remove
                            // -> remove the corresponding entry in the retentionMap.
View Full Code Here

        if (hold instanceof HoldImpl
                && n.getNodeId().equals(((HoldImpl) hold).getNodeId())
                && n.isNodeType(REP_RETENTION_MANAGEABLE)
                && n.hasProperty(REP_HOLD)) {

            PropertyImpl p = n.getProperty(REP_HOLD);
            Value[] vls = p.getValues();

            List<Value> newValues = new ArrayList<Value>(vls.length - 1);
            for (Value v : vls) {
                if (!hold.equals(HoldImpl.createFromValue(v, n.getNodeId(), session))) {
                    newValues.add(v);
View Full Code Here

            throw new RepositoryException("The administrator user cannot be disabled.");
        }
        if (reason == null) {
            if (isDisabled()) {
                // enable the user again.
                PropertyImpl disableProp = getNode().getProperty(P_DISABLED);
                userManager.removeProtectedItem(disableProp, getNode());
            } // else: nothing to do.
        } else {
            Value v = getSession().getValueFactory().createValue(reason);
            userManager.setProtectedProperty(getNode(), P_DISABLED, v);
View Full Code Here

    public void testCanReadNewId() throws Exception {
        Session s = getHelper().getReadOnlySession();
        try {
            NodeImpl n = (NodeImpl) testRootNode.addNode(nodeName1);
            PropertyImpl p = (PropertyImpl) n.setProperty(propertyName1, "somevalue");
            try {
                AccessManager acMgr = getAccessManager(s);
                acMgr.canRead(null, n.getId());
                fail("expected repositoryexception");
            } catch (RepositoryException e) {
                // success
            }
            try {
                AccessManager acMgr = getAccessManager(s);
                acMgr.canRead(null, p.getId());
                fail("expected repositoryexception");
            } catch (RepositoryException e) {
                // success
            }
        } finally {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.PropertyImpl

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.