just before adding authorization service.
[photos] / src / main / java / org / wamblee / photos / model / Album.java
1 /*
2  * Copyright 2005 the original author or authors.
3  * 
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
7  * 
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  * 
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.
15  */ 
16 package org.wamblee.photos.model;
17
18 import java.io.IOException;
19 import java.io.InputStream;
20
21
22 /**
23  * Represents a collection of photo albums for one speci 
24  */
25 public interface Album extends PhotoEntry {
26
27         /**
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 
32          * album. 
33          * @param aPath Photo entry path. 
34          * @return PhotoEntry if found or null otherwise.  
35          */
36         PhotoEntry getEntry(String aPath);
37         
38         /**
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 
43          * album. 
44          * @param aPath Photo entry path. 
45          * @return PhotoEntry if found or null otherwise.  
46          */
47         PhotoEntry getEntry(Path aPath);
48         
49         
50         /**
51          * Returns the photo entry with the given index. 
52          * 0 <= index < size()
53          * @param aIndex Index of the photo. 
54          * @return Photo at given index. 
55          */
56         PhotoEntry getEntry(int aIndex); 
57         
58         /**
59          * Returns the number of entries in the album. 
60          * @return Number of entries. 
61          */
62         int size(); 
63         
64         /**
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.  
69          */
70         void addImage(String aId, InputStream aImage) throws IOException;
71         
72         /**
73          * Adds a new album if this is allowed and no album with the
74          * given 
75          * @param aId Album id. 
76          * @throws IOException In case the album cannot be added. 
77          */
78         void addAlbum(String aId) throws IOException;
79         
80         /**
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. 
84          */
85         void removeEntry(String aId) throws IOException;
86         
87         /**
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. 
91          */
92         Photo findPhotoBefore(String aId); 
93         
94         /**
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. 
98          */
99         Photo findPhotoAfter(String aId);
100 }