- Timestamp:
- Feb 27, 2011, 1:38:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/TagDao.java
r9387 r9392 13 13 import fr.mael.jiwigo.transverse.enumeration.TagEnum; 14 14 import fr.mael.jiwigo.transverse.session.SessionManager; 15 import fr.mael.jiwigo.transverse.util.Outil; 16 /* 17 Copyright (c) 2010, Mael 18 All rights reserved. 19 20 Redistribution and use in source and binary forms, with or without 21 modification, are permitted provided that the following conditions are met: 22 * Redistributions of source code must retain the above copyright 23 notice, this list of conditions and the following disclaimer. 24 * Redistributions in binary form must reproduce the above copyright 25 notice, this list of conditions and the following disclaimer in the 26 documentation and/or other materials provided with the distribution. 27 * Neither the name of jiwigo nor the 28 names of its contributors may be used to endorse or promote products 29 derived from this software without specific prior written permission. 30 31 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 32 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 33 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 34 DISCLAIMED. IN NO EVENT SHALL Mael BE LIABLE FOR ANY 35 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 36 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 37 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 38 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 40 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 */ 42 15 import fr.mael.jiwigo.transverse.util.Tools; 43 16 44 17 /** … … 81 54 * @throws IOException 82 55 */ 83 public List<Tag> list er() throws IOException {84 Document doc = sessionManager.execute rReturnDocument(MethodsEnum.TAGS_ADMIN_LIST.getLabel());56 public List<Tag> list() throws IOException { 57 Document doc = sessionManager.executeReturnDocument(MethodsEnum.TAGS_ADMIN_LIST.getLabel()); 85 58 // System.out.println(Outil.documentToString(doc)); 86 59 return getTagsFromDocument(doc.getRootElement().getChild("tags")); … … 99 72 for (Element tagElement : listElement) { 100 73 Tag tag = new Tag(); 101 tag.setId (Integer.valueOf(tagElement.getAttributeValue(TagEnum.ID.getLabel())));102 tag.setN om(tagElement.getAttributeValue(TagEnum.NAME.getLabel()));74 tag.setIdentifier(Integer.valueOf(tagElement.getAttributeValue(TagEnum.ID.getLabel()))); 75 tag.setName(tagElement.getAttributeValue(TagEnum.NAME.getLabel())); 103 76 tags.add(tag); 104 77 } … … 112 85 * @return true if the tag as been successfully created 113 86 */ 114 public boolean cre er(Tag tag) {87 public boolean create(Tag tag) { 115 88 try { 116 return Outil.checkOk(sessionManager.executerReturnDocument(MethodsEnum.ADD_TAG.getLabel(), "name", tag117 .getN om()));89 return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.ADD_TAG.getLabel(), "name", tag 90 .getName())); 118 91 } catch (IOException e) { 119 LOG.error( Outil.getStackTrace(e));92 LOG.error(Tools.getStackTrace(e)); 120 93 } 121 94 return false; … … 129 102 */ 130 103 public List<Tag> tagsForImage(Image image) throws IOException { 131 Document doc = sessionManager.execute rReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String132 .valueOf(image.getIdentifi ant()));104 Document doc = sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String 105 .valueOf(image.getIdentifier())); 133 106 return getTagsFromDocument(doc.getRootElement().getChild("image").getChild("tags")); 134 107 }
Note: See TracChangeset
for help on using the changeset viewer.