1 | package fr.mael.jiwigo.dao; |
---|
2 | |
---|
3 | import java.io.IOException; |
---|
4 | import java.security.NoSuchAlgorithmException; |
---|
5 | import java.util.List; |
---|
6 | |
---|
7 | import fr.mael.jiwigo.om.Image; |
---|
8 | import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException; |
---|
9 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException; |
---|
10 | import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException; |
---|
11 | |
---|
12 | public interface ImageDao { |
---|
13 | /** |
---|
14 | * Lists all images |
---|
15 | * @return the list of images |
---|
16 | * @throws IOException |
---|
17 | * @throws ProxyAuthenticationException |
---|
18 | */ |
---|
19 | public List<Image> list(boolean refresh) throws IOException, ProxyAuthenticationException; |
---|
20 | |
---|
21 | /** |
---|
22 | * Listing of the images for a category |
---|
23 | * @param categoryId the id of the category |
---|
24 | * @return the list of images |
---|
25 | * @throws IOException |
---|
26 | * @throws ProxyAuthenticationException |
---|
27 | */ |
---|
28 | public List<Image> listByCategory(Integer categoryId, boolean refresh) throws IOException, |
---|
29 | ProxyAuthenticationException; |
---|
30 | |
---|
31 | /** |
---|
32 | * Creation of an image<br/> |
---|
33 | * Sequence : <br/> |
---|
34 | * <li> |
---|
35 | * <ul>sending of the thumbnail in base64, thanks to the method addchunk.</ul> |
---|
36 | * <ul>sending of the image in base64, thanks to the method addchunk</ul> |
---|
37 | * <ul>using of the add method to add the image to the database<ul> |
---|
38 | * </li> |
---|
39 | * Finally, the response of the webservice is checked |
---|
40 | * |
---|
41 | * @param image the image to create |
---|
42 | * @return true if the creation of the image was the successful |
---|
43 | * @throws IOException |
---|
44 | * @throws NoSuchAlgorithmException |
---|
45 | * @throws WrongChunkSizeException |
---|
46 | * @throws Exception |
---|
47 | */ |
---|
48 | //TODO ne pas continuer si une des reponses precedentes est negative |
---|
49 | public boolean create(Image image, Double chunkSize) throws FileAlreadyExistsException, IOException, |
---|
50 | ProxyAuthenticationException, NoSuchAlgorithmException, WrongChunkSizeException; |
---|
51 | |
---|
52 | /** |
---|
53 | * Add tags to an image |
---|
54 | * @param imageId id of the image |
---|
55 | * @param tagId ids of the tags |
---|
56 | * @throws IOException |
---|
57 | * @throws ProxyAuthenticationException |
---|
58 | */ |
---|
59 | public boolean addTags(Integer imageId, String tagId) throws IOException, ProxyAuthenticationException; |
---|
60 | |
---|
61 | /** |
---|
62 | * Search images |
---|
63 | * @param searchString the string to search |
---|
64 | * @return the list of images matching the string |
---|
65 | * @throws IOException |
---|
66 | * @throws ProxyAuthenticationException |
---|
67 | */ |
---|
68 | public List<Image> search(String searchString) throws IOException, ProxyAuthenticationException; |
---|
69 | |
---|
70 | } |
---|