1 | package fr.mael.jiwigo.service; |
---|
2 | |
---|
3 | import java.io.IOException; |
---|
4 | import java.util.List; |
---|
5 | |
---|
6 | import fr.mael.jiwigo.dao.TagDao; |
---|
7 | import fr.mael.jiwigo.om.Tag; |
---|
8 | |
---|
9 | /** |
---|
10 | * |
---|
11 | Copyright (c) 2010, Mael |
---|
12 | All rights reserved. |
---|
13 | |
---|
14 | Redistribution and use in source and binary forms, with or without |
---|
15 | modification, are permitted provided that the following conditions are met: |
---|
16 | * Redistributions of source code must retain the above copyright |
---|
17 | notice, this list of conditions and the following disclaimer. |
---|
18 | * Redistributions in binary form must reproduce the above copyright |
---|
19 | notice, this list of conditions and the following disclaimer in the |
---|
20 | documentation and/or other materials provided with the distribution. |
---|
21 | * Neither the name of jiwigo nor the |
---|
22 | names of its contributors may be used to endorse or promote products |
---|
23 | derived from this software without specific prior written permission. |
---|
24 | |
---|
25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
---|
26 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
---|
27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
---|
28 | DISCLAIMED. IN NO EVENT SHALL Mael BE LIABLE FOR ANY |
---|
29 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
---|
30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
---|
31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
---|
32 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
33 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
34 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
35 | |
---|
36 | * @author mael |
---|
37 | * |
---|
38 | */ |
---|
39 | public class TagService { |
---|
40 | /** |
---|
41 | * Logger |
---|
42 | */ |
---|
43 | public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory |
---|
44 | .getLog(TagService.class); |
---|
45 | |
---|
46 | private static TagService instance; |
---|
47 | |
---|
48 | public static TagService getInstance() { |
---|
49 | if (instance == null) { |
---|
50 | instance = new TagService(); |
---|
51 | } |
---|
52 | return instance; |
---|
53 | } |
---|
54 | |
---|
55 | private TagService() { |
---|
56 | |
---|
57 | } |
---|
58 | |
---|
59 | public List<Tag> lister() throws IOException { |
---|
60 | return TagDao.getInstance().lister(); |
---|
61 | } |
---|
62 | |
---|
63 | public boolean creer(String nom) throws IOException { |
---|
64 | Tag tag = new Tag(nom); |
---|
65 | return TagDao.getInstance().creer(tag); |
---|
66 | } |
---|
67 | |
---|
68 | } |
---|