public void add(List<Entitlement> entitlements){
  if (!isRecursive) {
    for (    Entitlement e : entitlements) {
      mergeActionValues(rootE,e);
      mergeAdvices(rootE,e);
      mergeAttributes(rootE,e);
      mergeTimeToLiveValue(rootE,e);
    }
  }
 else {
    boolean isRegExComparator=(resourceComparator instanceof RegExResourceName);
    for (    Entitlement e : entitlements) {
      boolean toAdd=true;
      for (      Entitlement existing : results) {
        ResourceMatch match=resourceComparator.compare(e.getResourceName(),existing.getResourceName(),true);
        if (match.equals(ResourceMatch.EXACT_MATCH)) {
          mergeActionValues(existing,e);
          mergeAdvices(existing,e);
          mergeAttributes(existing,e);
          mergeTimeToLiveValue(existing,e);
          toAdd=false;
        }
 else         if (match.equals(ResourceMatch.SUB_RESOURCE_MATCH)) {
          mergeActionValues(existing,e);
          mergeAdvices(existing,e);
          mergeAttributes(existing,e);
          mergeTimeToLiveValue(existing,e);
        }
 else         if (match.equals(ResourceMatch.SUPER_RESOURCE_MATCH)) {
          mergeActionValues(e,existing);
          mergeAdvices(e,existing);
          mergeAttributes(e,existing);
          mergeTimeToLiveValue(existing,e);
        }
 else         if (!isRegExComparator && match.equals(ResourceMatch.WILDCARD_MATCH)) {
          mergeActionValues(e,existing);
          mergeAdvices(e,existing);
          mergeAttributes(e,existing);
          mergeTimeToLiveValue(existing,e);
        }
      }
      if (toAdd) {
        Entitlement tmp=new Entitlement(e.getApplicationName(),e.getResourceName(),e.getActionValues());
        tmp.setAttributes(e.getAttributes());
        tmp.setAdvices(e.getAdvices());
        tmp.setTTL(e.getTTL());
        results.add(tmp);
      }
    }
  }
}

public void add ( List < Entitlement > entitlements ) { if ( ! isRecursive ) { for ( Entitlement e : entitlements ) { mergeActionValues ( rootE , e ) ; mergeAdvices ( rootE , e ) ; mergeAttributes ( rootE , e ) ; mergeTimeToLiveValue ( rootE , e ) ; } } else { boolean isRegExComparator = ( resourceComparator instanceof RegExResourceName ) ; for ( Entitlement e : entitlements ) { boolean toAdd = true ; for ( Entitlement existing : results ) { ResourceMatch match = resourceComparator . compare ( e . getResourceName ( ) , existing . getResourceName ( ) , true ) ; if ( match . equals ( ResourceMatch . EXACT_MATCH ) ) { mergeActionValues ( existing , e ) ; mergeAdvices ( existing , e ) ; mergeAttributes ( existing , e ) ; mergeTimeToLiveValue ( existing , e ) ; toAdd = false ; } else if ( match . equals ( ResourceMatch . SUB_RESOURCE_MATCH ) ) { mergeActionValues ( existing , e ) ; mergeAdvices ( existing , e ) ; mergeAttributes ( existing , e ) ; mergeTimeToLiveValue ( existing , e ) ; } else if ( match . equals ( ResourceMatch . SUPER_RESOURCE_MATCH ) ) { mergeActionValues ( e , existing ) ; mergeAdvices ( e , existing ) ; mergeAttributes ( e , existing ) ; mergeTimeToLiveValue ( existing , e ) ; } else if ( ! isRegExComparator && match . equals ( ResourceMatch . WILDCARD_MATCH ) ) { mergeActionValues ( e , existing ) ; mergeAdvices ( e , existing ) ; mergeAttributes ( e , existing ) ; mergeTimeToLiveValue ( existing , e ) ; } } if ( toAdd ) { Entitlement tmp = new Entitlement ( e . getApplicationName ( ) , e . getResourceName ( ) , e . getActionValues ( ) ) ; tmp . setAttributes ( e . getAttributes ( ) ) ; tmp . setAdvices ( e . getAdvices ( ) ) ; tmp . setTTL ( e . getTTL ( ) ) ; results . add ( tmp ) ; } } } }
adds a set of entitlements to the overall entitlement decision . these entitlements will be combined with existing decision .
