import com.google.common.base.Function;
import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import com.google.common.hash.Hasher;
@Override
public Modifier modify() throws IllegalStateException {
- Preconditions.checkState(getSone().isLocal(), "album must belong to a local Sone");
+ // TODO: reenable check for local Sones
return new Modifier() {
private Optional<String> title = absent();
@Override
public Album update() throws IllegalStateException {
- checkState(!albumImage.isPresent(), "album image must belong to this album");
if (title.isPresent()) {
AlbumImpl.this.title = title.get();
}
}
public Modifier modify() throws IllegalStateException {
- checkState((sone == null) || sone.isLocal(), "only local images may be modified");
+ // TODO: reenable check for local images
return new Modifier() {
private Optional<Sone> sone = absent();
@Override
public Image update() throws IllegalStateException {
- checkState(!sone.isPresent() || sone.get().equals(ImageImpl.this.sone), "can not change Sone once set");
+ checkState(!sone.isPresent() || (ImageImpl.this.sone == null) || sone.get().equals(ImageImpl.this.sone), "can not change Sone once set");
checkState(!creationTime.isPresent() || (ImageImpl.this.creationTime == 0), "can not change creation time once set");
- checkState(!key.isPresent() || key.get().equals(ImageImpl.this.key), "can not change key once set");
- checkState(!width.isPresent() || width.get().equals(ImageImpl.this.width), "can not change width once set");
- checkState(!height.isPresent() || height.get().equals(ImageImpl.this.height), "can not change height once set");
-
+ checkState(!key.isPresent() || (ImageImpl.this.key == null) || key.get().equals(ImageImpl.this.key), "can not change key once set");
+ checkState(!width.isPresent() || (ImageImpl.this.width == 0) || width.get().equals(ImageImpl.this.width), "can not change width once set");
+ checkState(!height.isPresent() || (ImageImpl.this.height == 0) || height.get().equals(ImageImpl.this.height), "can not change height once set");
ImageImpl.this.sone = sone.or(ImageImpl.this.sone);
ImageImpl.this.creationTime = creationTime.or(ImageImpl.this.creationTime);
ImageImpl.this.key = key.or(ImageImpl.this.key);