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