1 | package fr.mael.jiwigo.service; |
---|
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.ProxyAuthenticationException; |
---|
11 | import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException; |
---|
12 | |
---|
13 | public interface ImageService { |
---|
14 | |
---|
15 | /** |
---|
16 | * Lists all images for a category |
---|
17 | * @param categoryId the id of the category |
---|
18 | * @return the list of images |
---|
19 | * @throws IOException |
---|
20 | * @throws ProxyAuthenticationException |
---|
21 | */ |
---|
22 | public List<Image> listByCategory(Integer categoryId, boolean rafraichir) throws IOException, |
---|
23 | ProxyAuthenticationException; |
---|
24 | |
---|
25 | /** |
---|
26 | * Method called to send an image to the server. |
---|
27 | * @param filePath |
---|
28 | * @param idCategory |
---|
29 | * @param originalWidth width for the original image |
---|
30 | * @param originalHeight height for the original image |
---|
31 | * @return true if the image is created |
---|
32 | * @throws IOException |
---|
33 | * @throws WrongChunkSizeException |
---|
34 | * @throws ProxyAuthenticationException |
---|
35 | * @throws FileAlreadyExistsException |
---|
36 | * @throws NoSuchAlgorithmException |
---|
37 | * @throws Exception |
---|
38 | */ |
---|
39 | public boolean create(String filePath, Integer idCategory, Integer originalWidth, Integer originalHeight, |
---|
40 | Double chunckSize, Integer privacyLevel) throws IOException, NoSuchAlgorithmException, |
---|
41 | FileAlreadyExistsException, ProxyAuthenticationException, WrongChunkSizeException; |
---|
42 | |
---|
43 | /** |
---|
44 | * Add tags to an existing image |
---|
45 | * @param image the image |
---|
46 | * @param tagId the ids of the tags |
---|
47 | * @return true if successful |
---|
48 | * @throws IOException |
---|
49 | * @throws ProxyAuthenticationException |
---|
50 | */ |
---|
51 | public boolean addTags(Image image, String tagId) throws IOException, ProxyAuthenticationException; |
---|
52 | |
---|
53 | /** |
---|
54 | * Search images from a string |
---|
55 | * @param queryString the string |
---|
56 | * @return images matching the string |
---|
57 | * @throws IOException |
---|
58 | * @throws ProxyAuthenticationException |
---|
59 | */ |
---|
60 | public List<Image> search(String queryString) throws IOException, ProxyAuthenticationException; |
---|
61 | |
---|
62 | /** |
---|
63 | * Uses the pwg.images.addsimple web API to add a new picture |
---|
64 | * http://piwigo.org/doc/doku.php?id=en:dev:webapi:pwg.images.addsimple |
---|
65 | * |
---|
66 | * @param file |
---|
67 | * @param category |
---|
68 | * @param title |
---|
69 | * @throws IOException |
---|
70 | */ |
---|
71 | public void addSimple(File file, Integer category, String title) throws IOException; |
---|
72 | |
---|
73 | } |
---|