loadAll() method loads metadata differently then load()
@@ -151,7 +151,13 @@ public class MultiMetadataSerializer<T extends IHopMetadata> implements IHopMeta
@Override
public List<T> loadAll() throws HopException {
Set<T> set = new HashSet<>();
- for (IHopMetadataProvider provider : multiProvider.getProviders()) {
+ // The methods add and addAll for a hash-set only do something if an element doesn't already exist.
+ // So we need to loop over the providers in reverse.
+ //
+ List<IHopMetadataProvider> providers = multiProvider.getProviders();
+ ListIterator<IHopMetadataProvider> iterator = providers.listIterator(providers.size());
+ while (iterator.hasPrevious()) {
+ IHopMetadataProvider provider = iterator.previous();
set.addAll(provider.getSerializer(managedClass).loadAll());
}
return new ArrayList<>(set);
