Package org.apache.jackrabbit.commons.flat

Examples of org.apache.jackrabbit.commons.flat.PropertySequence


                                            ? groupNode.getNode(UserConstants.N_MEMBERS)
                                            : groupNode.addNode(UserConstants.N_MEMBERS, UserConstants.NT_REP_MEMBERS, null));

                                    // Create N_MEMBERS node structure for holding member references
                                    for (Membership.Member member : nonExisting) {
                                        PropertySequence properties = GroupImpl.getPropertySequence(nMembers, userManager);
                                        String propName = member.name;
                                        if (propName == null) {
                                            log.debug("Ignoring unnamed user with id {}", member.id);
                                            continue;
                                        }
                                        if (properties.hasItem(propName)) {
                                            log.debug("Overwriting authorizable {} which is already member of {}.", propName, gr);
                                            properties.removeProperty(propName);
                                        }
                                        Value newMember = session.getValueFactory().createValue(member.id.toString(), PropertyType.WEAKREFERENCE);
                                        properties.addProperty(propName, newMember);
                                    }
                                    return null;
                                }
                            });
                        } else {
View Full Code Here


                    NodeImpl nMembers = (node.hasNode(N_MEMBERS)
                            ? node.getNode(N_MEMBERS)
                            : node.addNode(N_MEMBERS, NT_REP_MEMBERS, null));

                    try {
                        PropertySequence properties = getPropertySequence(nMembers, userManager);
                        String propName = Text.escapeIllegalJcrChars(authorizable.getID());
                        if (properties.hasItem(propName)) {
                            log.debug("Authorizable {} is already member of {}", authorizable, this);
                            return false;
                        } else {
                            Value newMember = getSession().getValueFactory().createValue(authorizable.getNode(), true);
                            properties.addProperty(propName, newMember);
                        }

                        if (userManager.isAutoSave()) {
                            node.save();
                        }
View Full Code Here

            return userManager.performProtectedOperation(getSession(), new SessionWriteOperation<Boolean>() {
                public Boolean perform(SessionContext context) throws RepositoryException {
                    NodeImpl nMembers = node.getNode(N_MEMBERS);
                    try {
                        PropertySequence properties = getPropertySequence(nMembers, userManager);
                        String propName = Text.escapeIllegalJcrChars(authorizable.getID());
                        if (properties.hasItem(propName)) {
                            properties.removeProperty(propName);
                            if (!properties.iterator().hasNext()) {
                                nMembers.remove();
                            }
                        } else {
                            log.debug("Authorizable {} was not member of {}", authorizable.getID(), getID());
                            return false;
View Full Code Here

            });
        }

        public Iterator<Authorizable> getMembers(boolean includeIndirect, int type) throws RepositoryException {
            if (node.hasNode(N_MEMBERS)) {
                PropertySequence members = getPropertySequence(node.getNode(N_MEMBERS), userManager);
                if (includeIndirect) {
                    return includeIndirect(toAuthorizables(members.iterator(), type), type);
                }
                else {
                    return toAuthorizables(members.iterator(), type);
                }
            }
            else {
                return Iterators.empty();
            }
View Full Code Here

            }
        }

        public boolean hasMember(AuthorizableImpl authorizable) throws RepositoryException {
            if (node.hasNode(N_MEMBERS)) {
                PropertySequence members = getPropertySequence(node.getNode(N_MEMBERS), userManager);
                return members.hasItem(authorizable.getID());
            }
            else {
                return false;
            }
        }
View Full Code Here

                                            ? groupNode.getNode(UserConstants.N_MEMBERS)
                                            : groupNode.addNode(UserConstants.N_MEMBERS, UserConstants.NT_REP_MEMBERS, null));

                                    // Create N_MEMBERS node structure for holding member references
                                    for (Membership.Member member : nonExisting) {
                                        PropertySequence properties = GroupImpl.getPropertySequence(nMembers, userManager);
                                        String propName = member.name;
                                        if (propName == null) {
                                            log.debug("Ignoring unnamed user with id {}", member.id);
                                            continue;
                                        }
                                        if (properties.hasItem(propName)) {
                                            log.debug("Overwriting authorizable {} which is already member of {}.", propName, gr);
                                            properties.removeProperty(propName);
                                        }
                                        Value newMember = session.getValueFactory().createValue(member.id.toString(), PropertyType.WEAKREFERENCE);
                                        properties.addProperty(propName, newMember);
                                    }
                                    return null;
                                }
                            });
                        } else {
View Full Code Here

                                            ? groupNode.getNode(UserConstants.N_MEMBERS)
                                            : groupNode.addNode(UserConstants.N_MEMBERS, UserConstants.NT_REP_MEMBERS, null));

                                    // Create N_MEMBERS node structure for holding member references
                                    for (Membership.Member member : nonExisting) {
                                        PropertySequence properties = GroupImpl.getPropertySequence(nMembers, userManager);
                                        String propName = member.name;
                                        if (propName == null) {
                                            log.debug("Ignoring unnamed user with id {}", member.id);
                                            continue;
                                        }
                                        if (properties.hasItem(propName)) {
                                            log.debug("Overwriting authorizable {} which is already member of {}.", propName, gr);
                                            properties.removeProperty(propName);
                                        }
                                        Value newMember = session.getValueFactory().createValue(member.id.toString(), PropertyType.WEAKREFERENCE);
                                        properties.addProperty(propName, newMember);
                                    }
                                    return null;
                                }
                            });
                        } else {
View Full Code Here

                    NodeImpl nMembers = (node.hasNode(N_MEMBERS)
                            ? node.getNode(N_MEMBERS)
                            : node.addNode(N_MEMBERS, NT_REP_MEMBERS, null));

                    try {
                        PropertySequence properties = getPropertySequence(nMembers, userManager);
                        String propName = Text.escapeIllegalJcrChars(authorizable.getID());
                        if (properties.hasItem(propName)) {
                            log.debug("Authorizable {} is already member of {}", authorizable, this);
                            return false;
                        } else {
                            Value newMember = getSession().getValueFactory().createValue(authorizable.getNode(), true);
                            properties.addProperty(propName, newMember);
                        }

                        if (userManager.isAutoSave()) {
                            node.save();
                        }
View Full Code Here

            return userManager.performProtectedOperation(getSession(), new SessionWriteOperation<Boolean>() {
                public Boolean perform(SessionContext context) throws RepositoryException {
                    NodeImpl nMembers = node.getNode(N_MEMBERS);
                    try {
                        PropertySequence properties = getPropertySequence(nMembers, userManager);
                        String propName = Text.escapeIllegalJcrChars(authorizable.getID());
                        if (properties.hasItem(propName)) {
                            properties.removeProperty(propName);
                            if (!properties.iterator().hasNext()) {
                                nMembers.remove();
                            }
                        } else {
                            log.debug("Authorizable {} was not member of {}", authorizable.getID(), getID());
                            return false;
View Full Code Here

            });
        }

        public Iterator<Authorizable> getMembers(boolean includeIndirect, int type) throws RepositoryException {
            if (node.hasNode(N_MEMBERS)) {
                PropertySequence members = getPropertySequence(node.getNode(N_MEMBERS), userManager);
                if (includeIndirect) {
                    return includeIndirect(toAuthorizables(members.iterator(), type), type);
                }
                else {
                    return toAuthorizables(members.iterator(), type);
                }
            }
            else {
                return Iterators.empty();
            }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.commons.flat.PropertySequence

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.