net.shibboleth.metadata
Class DeduplicatingItemIdMergeStrategy

java.lang.Object
  extended by net.shibboleth.metadata.DeduplicatingItemIdMergeStrategy
All Implemented Interfaces:
CollectionMergeStrategy

public class DeduplicatingItemIdMergeStrategy
extends Object
implements CollectionMergeStrategy

A merge strategy that adds source items to the target collection if none of the Items in the target collection have the same ItemId as source item. If the source item does not contain a ItemId it is always added to the target collection.


Constructor Summary
DeduplicatingItemIdMergeStrategy()
           
 
Method Summary
private  void merge(HashSet<ItemId> presentItemIds, Collection<Item<?>> target, Collection<Item<?>> sourceItems)
          Adds source items to the target collection if none of the Items in the target collection have the same ItemId as source item.
 void mergeCollection(Collection<Item<?>> target, Collection<Item<?>>... sources)
          Merges the results of each child pipeline in to the collection of Item given to this stage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeduplicatingItemIdMergeStrategy

public DeduplicatingItemIdMergeStrategy()
Method Detail

mergeCollection

public void mergeCollection(@Nonnull@NonnullElements
                            Collection<Item<?>> target,
                            @Nonnull@NonnullElements
                            Collection<Item<?>>... sources)
Merges the results of each child pipeline in to the collection of Item given to this stage.

Specified by:
mergeCollection in interface CollectionMergeStrategy
Parameters:
target - collection in to which all the Items should be merged, never null
sources - collections of Items to be merged in to the target, never null not containing any null elements

merge

private void merge(@Nonnull@NonnullElements
                   HashSet<ItemId> presentItemIds,
                   @Nonnull@NonnullElements
                   Collection<Item<?>> target,
                   @Nonnull@NonnullElements
                   Collection<Item<?>> sourceItems)
Adds source items to the target collection if none of the Items in the target collection have the same ItemId as source item. If the source item does not contain a ItemId it is always added to the target collection.

Parameters:
presentItemIds - IDs that are already present in the target collection
target - the collection to which items will be merged in to
sourceItems - the collection of items to be merged in to the target


Copyright © 1999-2012. All Rights Reserved.