Changeset 9919 for extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CommentService.java
- Timestamp:
- Mar 29, 2011, 8:21:25 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CommentService.java
r9879 r9919 4 4 import java.util.List; 5 5 6 import fr.mael.jiwigo.dao.CommentDao;7 6 import fr.mael.jiwigo.om.Comment; 8 7 import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException; 9 import fr.mael.jiwigo.transverse.session.SessionManager;10 8 11 /* 12 * jiwigo-ws-api Piwigo webservice access Api 13 * Copyright (c) 2010-2011 Mael mael@le-guevel.com 14 * All Rights Reserved 15 * 16 * This library is free software. It comes without any warranty, to 17 * the extent permitted by applicable law. You can redistribute it 18 * and/or modify it under the terms of the Do What The Fuck You Want 19 * To Public License, Version 2, as published by Sam Hocevar. See 20 * http://sam.zoy.org/wtfpl/COPYING for more details. 21 */ 22 /** 23 24 * @author mael 25 * 26 */ 27 public class CommentService { 28 /** 29 * Logger 30 */ 31 public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory 32 .getLog(CommentService.class); 33 34 /** 35 * singleton 36 */ 37 private static CommentService instance; 38 39 private SessionManager sessionManager; 40 41 /** 42 * @return the singleton 43 */ 44 public static CommentService getInstance(SessionManager sessionManager) { 45 if (instance == null) { 46 instance = new CommentService(sessionManager); 47 } 48 return instance; 49 } 50 51 /** 52 * private constructor, to use a singleton 53 */ 54 private CommentService(SessionManager sessionManager) { 55 this.sessionManager = sessionManager; 56 } 57 9 public interface CommentService { 58 10 /** 59 11 * Lists all comments for an image … … 63 15 * @throws ProxyAuthenticationException 64 16 */ 65 public List<Comment> list(Integer imageId) throws IOException, ProxyAuthenticationException { 66 return CommentDao.getInstance(sessionManager).list(imageId); 67 } 17 public List<Comment> list(Integer imageId) throws IOException, ProxyAuthenticationException; 68 18 69 19 /** … … 77 27 */ 78 28 public boolean create(String content, Integer imageId, String auteur) throws IOException, 79 ProxyAuthenticationException { 80 Comment comment = new Comment(); 81 comment.setContent(content); 82 comment.setImageId(imageId); 83 comment.setAuthor(auteur); 84 return CommentDao.getInstance(sessionManager).create(comment); 85 } 29 ProxyAuthenticationException; 86 30 87 31 }
Note: See TracChangeset
for help on using the changeset viewer.