X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fwamblee%2Fphotos%2Fmodel%2FAlbum.java;fp=src%2Fmain%2Fjava%2Forg%2Fwamblee%2Fphotos%2Fmodel%2FAlbum.java;h=126f16184a5f0b5b7bdb46246ad42a3d5bd4e656;hb=8845e7fe6141ccc98fd070ee4e653941f6e60508;hp=0000000000000000000000000000000000000000;hpb=b5dd7f771153492ebf5b70949dba8914af58a3cd;p=photos diff --git a/src/main/java/org/wamblee/photos/model/Album.java b/src/main/java/org/wamblee/photos/model/Album.java new file mode 100644 index 0000000..126f161 --- /dev/null +++ b/src/main/java/org/wamblee/photos/model/Album.java @@ -0,0 +1,100 @@ +/* + * Copyright 2005 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wamblee.photos.model; + +import java.io.IOException; +import java.io.InputStream; + + +/** + * Represents a collection of photo albums for one speci + */ +public interface Album extends PhotoEntry { + + /** + * Returns a photo entry with the given path. + * A path consists of a number of ids of photo entries + * separated by a forward slash. The path should wtart with + * a forward slash. The path is relative to the current + * album. + * @param aPath Photo entry path. + * @return PhotoEntry if found or null otherwise. + */ + PhotoEntry getEntry(String aPath); + + /** + * Returns a photo entry with the given path. + * A path consists of a number of ids of photo entries + * separated by a forward slash. The path should wtart with + * a forward slash. The path is relative to the current + * album. + * @param aPath Photo entry path. + * @return PhotoEntry if found or null otherwise. + */ + PhotoEntry getEntry(Path aPath); + + + /** + * Returns the photo entry with the given index. + * 0 <= index < size() + * @param aIndex Index of the photo. + * @return Photo at given index. + */ + PhotoEntry getEntry(int aIndex); + + /** + * Returns the number of entries in the album. + * @return Number of entries. + */ + int size(); + + /** + * Adds an image to the album with the given id. + * @param aId Id of the image (excluding file extension). + * @param aImage Image. + * @throws IOException In case the image cannot be added. + */ + void addImage(String aId, InputStream aImage) throws IOException; + + /** + * Adds a new album if this is allowed and no album with the + * given + * @param aId Album id. + * @throws IOException In case the album cannot be added. + */ + void addAlbum(String aId) throws IOException; + + /** + * Removes the given entry if it can be removed. + * @param aId Entry id. + * @throws IOException In case the entry cannot be removed. + */ + void removeEntry(String aId) throws IOException; + + /** + * Gets the first photo before the entry with the given id. + * @param aId Id of the given entry. + * @return Photo or null if no such photo exists. + */ + Photo findPhotoBefore(String aId); + + /** + * Gets the first photo after a given entry. + * @param aId Id of the given entry. + * @return Photo or null if no such photo exists. + */ + Photo findPhotoAfter(String aId); +}