Ignore:
Timestamp:
Apr 20, 2011, 5:17:02 AM (13 years ago)
Author:
anthony43
Message:

huge refactoring to introduce JiwigoException : a generic exception encapsulating low level exceptions (IOException, ProxyAuthentication, etc...)
The aim is to have, on the consumer side, just one exception to catch them all.
this refactoring may need a code review to check the changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/impl/TagDaoImpl.java

    r9919 r10505  
    1818import fr.mael.jiwigo.transverse.enumeration.TagEnum;
    1919import fr.mael.jiwigo.transverse.exception.FileAlreadyExistsException;
     20import fr.mael.jiwigo.transverse.exception.JiwigoException;
    2021import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException;
    2122import fr.mael.jiwigo.transverse.session.SessionManager;
     
    5253     * @throws ProxyAuthenticationException
    5354     */
    54     public List<Tag> list() throws IOException, ProxyAuthenticationException {
     55    public List<Tag> list() throws JiwigoException {
    5556        Document doc = sessionManager.executeReturnDocument(MethodsEnum.TAGS_ADMIN_LIST.getLabel());
    5657        //      System.out.println(Outil.documentToString(doc));
     
    9091     * @throws ProxyAuthenticationException
    9192     */
    92     public boolean create(Tag tag) throws ProxyAuthenticationException {
     93    public boolean create(Tag tag) throws JiwigoException {
    9394        try {
    94             return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.ADD_TAG.getLabel(), "name", tag
    95                     .getName()));
    96         } catch (IOException e) {
     95            return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.ADD_TAG.getLabel(), "name",
     96                    tag.getName()));
     97        } catch (FileAlreadyExistsException e) {
    9798            LOG.error(Tools.getStackTrace(e));
    98         } catch (FileAlreadyExistsException e) {
    99             e.printStackTrace();
     99            throw new JiwigoException(e);
    100100        }
    101         return false;
    102101    }
    103102
     
    107106     * @return the tags list
    108107     * @throws IOException
    109      * @throws ProxyAuthenticationException
     108     * @throws JiwigoException
    110109     */
    111     public List<Tag> tagsForImage(Image image) throws IOException, ProxyAuthenticationException {
    112         Document doc = sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    113                 .valueOf(image.getIdentifier()));
     110    public List<Tag> tagsForImage(Image image) throws JiwigoException {
     111        Document doc = sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id",
     112                String.valueOf(image.getIdentifier()));
    114113        Element elementImage = (Element) doc.getDocumentElement().getElementsByTagName("image").item(0);
    115114        Element elementTag = (Element) elementImage.getElementsByTagName("tags").item(0);
Note: See TracChangeset for help on using the changeset viewer.