/**
  * Sets collections.
  *
  * <p>Looks at merge actions when adding, so not all collections are added.
  *
  * @param collections list of data object collections or null
  */
 public void setCollections(List<DataObjectCollection> collections) {
   if (collections == null) {
     this.collections = null;
     return;
   }
   this.collections = Collections.unmodifiableList(collections);
   collectionMap = new HashMap<String, DataObjectCollection>(collections.size());
   removedCollectionNames = new ArrayList<String>();
   for (DataObjectCollection coll : collections) {
     // This is not quite correct - we really only want to not add the NO_OVERRIDE items if they
     // are
     // overriding something. However, at the point this is running, we don't know whether we will
     // be embedding
     // anything...
     if (coll.getMergeAction() != MetadataMergeAction.REMOVE
         && coll.getMergeAction() != MetadataMergeAction.NO_OVERRIDE) {
       collectionMap.put(coll.getName(), coll);
     }
     // since the attribute will still exist in the embedded metadata, we need to put a block in on
     // the standard
     // cascade
     if (coll.getMergeAction() == MetadataMergeAction.REMOVE) {
       removedCollectionNames.add(coll.getName());
     }
   }
 }
 /** {@inheritDoc} */
 @Override
 public DataObjectCollection getCollection(String collectionName) {
   if (collectionName == null) {
     return null;
   }
   DataObjectCollection collection = null;
   // attempt to get it from the local attribute map (if any attributed defined locally)
   if (collections != null) {
     collection = collectionMap.get(collectionName);
   }
   // if we don't find one, but we have an embedded metadata object, check it
   if (collection == null && embedded != null) {
     collection = embedded.getCollection(collectionName);
     // but, ensure it's not on the removed attribute list
     if (collection != null
         && removedCollectionNames != null
         && removedCollectionNames.contains(collection.getName())) {
       collection = null;
     }
   }
   return collection;
 }