protected void mergeAttributes(Entitlement e1,Entitlement e2){
  Map<String,Set<String>> result=new HashMap<String,Set<String>>();
  Map<String,Set<String>> a1=e1.getAttributes();
  if (a1 == null) {
    a1=Collections.EMPTY_MAP;
  }
  Map<String,Set<String>> a2=e2.getAttributes();
  if (a2 == null) {
    a2=Collections.EMPTY_MAP;
  }
  Set<String> names=new HashSet<String>();
  names.addAll(a1.keySet());
  names.addAll(a2.keySet());
  for (  String n : names) {
    Set<String> attr1=a1.get(n);
    Set<String> attr2=a2.get(n);
    Set<String> r=result.get(n);
    if (r == null) {
      r=new HashSet<String>();
      result.put(n,r);
    }
    if ((attr1 != null) && !attr1.isEmpty()) {
      r.addAll(attr1);
    }
    if ((attr2 != null) && !attr2.isEmpty()) {
      r.addAll(attr2);
    }
  }
  e1.setAttributes(result);
}

protected void mergeAttributes ( Entitlement e1 , Entitlement e2 ) { Map < String , Set < String > > result = new HashMap < String , Set < String > > ( ) ; Map < String , Set < String > > a1 = e1 . getAttributes ( ) ; if ( a1 == null ) { a1 = Collections . EMPTY_MAP ; } Map < String , Set < String > > a2 = e2 . getAttributes ( ) ; if ( a2 == null ) { a2 = Collections . EMPTY_MAP ; } Set < String > names = new HashSet < String > ( ) ; names . addAll ( a1 . keySet ( ) ) ; names . addAll ( a2 . keySet ( ) ) ; for ( String n : names ) { Set < String > attr1 = a1 . get ( n ) ; Set < String > attr2 = a2 . get ( n ) ; Set < String > r = result . get ( n ) ; if ( r == null ) { r = new HashSet < String > ( ) ; result . put ( n , r ) ; } if ( ( attr1 != null ) && ! attr1 . isEmpty ( ) ) { r . addAll ( attr1 ) ; } if ( ( attr2 != null ) && ! attr2 . isEmpty ( ) ) { r . addAll ( attr2 ) ; } } e1 . setAttributes ( result ) ; }
sets the attributes of the first entitlement to be the union of all attributes from the first and second entitlements .
