[9387] | 1 | package fr.mael.jiwigo.dao; |
---|
| 2 | |
---|
[10494] | 3 | import java.io.File; |
---|
[9387] | 4 | import java.io.IOException; |
---|
[9893] | 5 | import java.security.NoSuchAlgorithmException; |
---|
[9387] | 6 | import java.util.List; |
---|
| 7 | |
---|
| 8 | import fr.mael.jiwigo.om.Image; |
---|
[9893] | 9 | import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException; |
---|
[10505] | 10 | import fr.mael.jiwigo.transverse.exception.JiwigoException; |
---|
[9430] | 11 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException; |
---|
[9394] | 12 | import fr.mael.jiwigo.transverse.exception.WrongChunkSizeException; |
---|
[9387] | 13 | |
---|
[9919] | 14 | public interface ImageDao { |
---|
[9387] | 15 | /** |
---|
| 16 | * Lists all images |
---|
| 17 | * @return the list of images |
---|
| 18 | * @throws IOException |
---|
[9430] | 19 | * @throws ProxyAuthenticationException |
---|
[9387] | 20 | */ |
---|
[10505] | 21 | public List<Image> list(boolean refresh) throws JiwigoException; |
---|
[9387] | 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 |
---|
[9430] | 28 | * @throws ProxyAuthenticationException |
---|
[9387] | 29 | */ |
---|
[10505] | 30 | public List<Image> listByCategory(Integer categoryId, boolean refresh) throws JiwigoException; |
---|
[9387] | 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 | * |
---|
[9392] | 42 | * @param image the image to create |
---|
[9387] | 43 | * @return true if the creation of the image was the successful |
---|
[9893] | 44 | * @throws IOException |
---|
| 45 | * @throws NoSuchAlgorithmException |
---|
| 46 | * @throws WrongChunkSizeException |
---|
[10505] | 47 | * @throws JiwigoException |
---|
[9387] | 48 | * @throws Exception |
---|
| 49 | */ |
---|
[9392] | 50 | //TODO ne pas continuer si une des reponses precedentes est negative |
---|
[9893] | 51 | public boolean create(Image image, Double chunkSize) throws FileAlreadyExistsException, IOException, |
---|
[10505] | 52 | ProxyAuthenticationException, NoSuchAlgorithmException, WrongChunkSizeException, JiwigoException; |
---|
[9387] | 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 |
---|
[9430] | 59 | * @throws ProxyAuthenticationException |
---|
[9387] | 60 | */ |
---|
[10505] | 61 | public boolean addTags(Integer imageId, String tagId) throws JiwigoException; |
---|
[9387] | 62 | |
---|
| 63 | /** |
---|
| 64 | * Search images |
---|
| 65 | * @param searchString the string to search |
---|
| 66 | * @return the list of images matching the string |
---|
| 67 | * @throws IOException |
---|
[9430] | 68 | * @throws ProxyAuthenticationException |
---|
[9387] | 69 | */ |
---|
[10505] | 70 | public List<Image> search(String searchString) throws JiwigoException; |
---|
[9387] | 71 | |
---|
[10494] | 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 |
---|
[10505] | 80 | * @throws JiwigoException |
---|
[10494] | 81 | */ |
---|
[10505] | 82 | public void addSimple(File file, Integer category, String title) throws JiwigoException; |
---|
[10494] | 83 | |
---|
[10716] | 84 | /** |
---|
| 85 | * Deletes an image |
---|
| 86 | * @param image the image to delete |
---|
| 87 | * @throws JiwigoException |
---|
| 88 | */ |
---|
| 89 | public boolean delete(Image image) throws JiwigoException; |
---|
| 90 | |
---|
[9387] | 91 | } |
---|