package net.pterodactylus.sone.database;
+import java.util.List;
+
+import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.Image;
import com.google.common.base.Optional;
Optional<Image> getImage(String imageId);
+ List<Image> getImages(Album parent);
+
}
}
}
+ @Override
+ public List<Image> getImages(Album parent) {
+ lock.readLock().lock();
+ try {
+ return from(albumImages.get(parent.getId())).transformAndConcat(getImage()).toList();
+ } finally {
+ lock.readLock().unlock();
+ }
+ }
+
//
// IMAGESTORE METHODS
//
};
}
+ private Function<String, Iterable<Image>> getImage() {
+ return new Function<String, Iterable<Image>>() {
+ @Override
+ public Iterable<Image> apply(String input) {
+ return (input == null) ? Collections.<Image>emptyList() : getImage(input).asSet();
+ }
+ };
+ }
+
}