import static java.lang.String.format;
import static java.util.logging.Level.WARNING;
import static net.pterodactylus.sone.data.Sone.LOCAL_SONE_FILTER;
+import static net.pterodactylus.sone.data.Sone.toAllAlbums;
import java.net.MalformedURLException;
import java.util.ArrayList;
sone.getRootAlbum().addAlbum(album);
}
soneInserters.get(sone).setLastInsertFingerprint(lastInsertFingerprint);
+ for (Album album : toAllAlbums.apply(sone)) {
+ database.storeAlbum(album);
+ for (Image image : album.getImages()) {
+ database.storeImage(image);
+ }
+ }
}
synchronized (knownSones) {
for (String friend : friends) {
import static net.pterodactylus.sone.data.Album.IMAGES;
import java.util.Collection;
+import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
}
};
+ public static final Function<Sone, List<Album>> toAllAlbums = new Function<Sone, List<Album>>() {
+ @Override
+ public List<Album> apply(@Nullable Sone sone) {
+ return (sone == null) ? Collections.<Album>emptyList() : FLATTENER.apply(
+ sone.getRootAlbum());
+ }
+ };
+
/**
* Returns the identity of this Sone.
*