*/
@Override
public Collection<Sone> getSones() {
- synchronized (sones) {
- return ImmutableSet.copyOf(sones.values());
- }
+ return database.getSones();
}
/**
*/
@Override
public Optional<Sone> getSone(String id) {
- synchronized (sones) {
- return Optional.fromNullable(sones.get(id));
- }
+ return database.getSone(id);
}
/**
*/
@Override
public Collection<Sone> getLocalSones() {
- synchronized (sones) {
- return FluentIterable.from(sones.values()).filter(LOCAL_SONE_FILTER).toSet();
- }
+ return database.getLocalSones();
}
/**
*/
@Override
public Collection<Sone> getRemoteSones() {
- synchronized (sones) {
- return FluentIterable.from(sones.values()).filter(not(LOCAL_SONE_FILTER)).toSet();
- }
+ return database.getRemoteSones();
}
/**
}
});
soneChangeDetector.detectChanges(sone);
- /* store posts. */
- database.storePosts(sone, sone.getPosts());
- database.storePostReplies(sone, sone.getReplies());
- for (Album album : storedSone.get().getRootAlbum().getAlbums()) {
- database.removeAlbum(album);
- for (Image image : album.getImages()) {
- database.removeImage(image);
- }
- }
- for (Album album : toAllAlbums.apply(sone)) {
- database.storeAlbum(album);
- for (Image image : album.getImages()) {
- database.storeImage(image);
- }
- }
+ database.storeSone(sone);
synchronized (sones) {
sone.setOptions(storedSone.get().getOptions());
sone.setKnown(storedSone.get().isKnown());