aboutsummaryrefslogtreecommitdiff
path: root/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java')
-rw-r--r--id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java
index 24d93f9bb..c59109092 100644
--- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java
+++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/AttributeProvidersMap.java
@@ -91,4 +91,22 @@ public class AttributeProvidersMap extends LinkedHashMap<AttributeSource, IPerso
}
LOG.trace("END\n=======================");
}
+
+ public void mergeWith(IAttributeProvidersMap aPMap) {
+ Iterator<AttributeSource> maKeys = aPMap.keyIterator();
+ while (maKeys.hasNext()) {
+ AttributeSource key = maKeys.next();
+ IPersonalAttributeList l2 = aPMap.get(key);
+ if (containsKey(key)) {
+ IPersonalAttributeList l1 = get(key);
+ for (PersonalAttribute pa : l2) {
+ if (!l1.containsKey(pa.getName())) {
+ l1.add(pa);
+ }
+ }
+ } else {
+ put(key, l2);
+ }
+ }
+ }
}