Package org.apache.syncope.common.mod

Examples of org.apache.syncope.common.mod.MembershipMod


        // 3. memberships
        Map<Long, MembershipTO> updatedMembs = updated.getMembershipMap();
        Map<Long, MembershipTO> originalMembs = original.getMembershipMap();

        for (Map.Entry<Long, MembershipTO> entry : updatedMembs.entrySet()) {
            MembershipMod membMod = new MembershipMod();
            membMod.setRole(entry.getValue().getRoleId());

            if (originalMembs.containsKey(entry.getKey())) {
                // if memberships are actually same, just make the isEmpty() call below succeed
                if (entry.getValue().equals(originalMembs.get(entry.getKey()))) {
                    membMod.setRole(0);
                } else {
                    diff(entry.getValue(), originalMembs.get(entry.getKey()), membMod, false);
                }
            } else {
                for (AttributeTO attr : entry.getValue().getAttrs()) {
                    AttributeMod attrMod = new AttributeMod();
                    attrMod.setSchema(attr.getSchema());
                    attrMod.getValuesToBeAdded().addAll(attr.getValues());

                    if (!attrMod.isEmpty()) {
                        membMod.getAttrsToUpdate().add(attrMod);
                        membMod.getAttrsToRemove().add(attrMod.getSchema());
                    }
                }
                for (AttributeTO attr : entry.getValue().getDerAttrs()) {
                    membMod.getDerAttrsToAdd().add(attr.getSchema());
                }
                for (AttributeTO attr : entry.getValue().getVirAttrs()) {
                    AttributeMod attrMod = new AttributeMod();
                    attrMod.setSchema(attr.getSchema());
                    attrMod.getValuesToBeAdded().addAll(attr.getValues());

                    if (!attrMod.isEmpty()) {
                        membMod.getVirAttrsToUpdate().add(attrMod);
                        membMod.getAttrsToRemove().add(attrMod.getSchema());
                    }
                }
            }

            if (!membMod.isEmpty()) {
                result.getMembershipsToAdd().add(membMod);
            }
        }

        if (!incremental) {
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.mod.MembershipMod

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.