2 * Copyright 2005 the original author or authors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.wamblee.photos.model;
18 import java.io.IOException;
19 import java.io.InputStream;
23 * Represents a collection of photo albums for one speci
25 public interface Album extends PhotoEntry {
28 * Returns a photo entry with the given path.
29 * A path consists of a number of ids of photo entries
30 * separated by a forward slash. The path should wtart with
31 * a forward slash. The path is relative to the current
33 * @param aPath Photo entry path.
34 * @return PhotoEntry if found or null otherwise.
36 PhotoEntry getEntry(String aPath);
39 * Returns a photo entry with the given path.
40 * A path consists of a number of ids of photo entries
41 * separated by a forward slash. The path should wtart with
42 * a forward slash. The path is relative to the current
44 * @param aPath Photo entry path.
45 * @return PhotoEntry if found or null otherwise.
47 PhotoEntry getEntry(Path aPath);
51 * Returns the photo entry with the given index.
53 * @param aIndex Index of the photo.
54 * @return Photo at given index.
56 PhotoEntry getEntry(int aIndex);
59 * Returns the number of entries in the album.
60 * @return Number of entries.
65 * Adds an image to the album with the given id.
66 * @param aId Id of the image (excluding file extension).
67 * @param aImage Image.
68 * @throws IOException In case the image cannot be added.
70 void addImage(String aId, InputStream aImage) throws IOException;
73 * Adds a new album if this is allowed and no album with the
75 * @param aId Album id.
76 * @throws IOException In case the album cannot be added.
78 void addAlbum(String aId) throws IOException;
81 * Removes the given entry if it can be removed.
82 * @param aId Entry id.
83 * @throws IOException In case the entry cannot be removed.
85 void removeEntry(String aId) throws IOException;
88 * Gets the first photo before the entry with the given id.
89 * @param aId Id of the given entry.
90 * @return Photo or null if no such photo exists.
92 Photo findPhotoBefore(String aId);
95 * Gets the first photo after a given entry.
96 * @param aId Id of the given entry.
97 * @return Photo or null if no such photo exists.
99 Photo findPhotoAfter(String aId);