Changeset 9392 for extensions


Ignore:
Timestamp:
Feb 27, 2011, 1:38:04 PM (13 years ago)
Author:
mlg
Message:

Changes function name (to english)
version changed to 0.13.1

Location:
extensions/jiwigo-ws-api
Files:
17 edited
1 moved

Legend:

Unmodified
Added
Removed
  • extensions/jiwigo-ws-api/.classpath

    r9387 r9392  
    77  <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/>
    88  <classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
     9  <classpathentry kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar"/>
    910  <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.2/commons-codec-1.2.jar"/>
    1011  <classpathentry kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar"/>
    1112  <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.5/commons-lang-2.5.jar"/>
    1213  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
    13   <classpathentry kind="var" path="M2_REPO/net/iharder/filedrop/1.0/filedrop-1.0.jar"/>
    14   <classpathentry kind="var" path="M2_REPO/com/jhlabs/filters/2.0.235/filters-2.0.235.jar"/>
    1514  <classpathentry kind="var" path="M2_REPO/org/jdom/jdom/1.1/jdom-1.1.jar"/>
    1615  <classpathentry kind="var" path="M2_REPO/junit/junit/4.8.1/junit-4.8.1.jar"/>
     
    1918  <classpathentry kind="var" path="M2_REPO/com/drew/metadata-extractor/2.3.1/metadata-extractor-2.3.1.jar"/>
    2019  <classpathentry kind="var" path="M2_REPO/org/apache/sanselan/sanselan/0.97-incubator/sanselan-0.97-incubator.jar"/>
    21   <classpathentry kind="var" path="M2_REPO/org/swinglabs/swing-worker/1.1/swing-worker-1.1.jar"/>
    22   <classpathentry kind="var" path="M2_REPO/org/swinglabs/swingx/1.6.1/swingx-1.6.1.jar"/>
    2320  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    2421</classpath>
  • extensions/jiwigo-ws-api/.project

    r9387 r9392  
    1 <?xml version="1.0" encoding="UTF-8"?>
    21<projectDescription>
    3         <name>jiwigo-ws-api</name>
    4         <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
    5         <projects>
    6         </projects>
    7         <buildSpec>
    8                 <buildCommand>
    9                         <name>org.eclipse.jdt.core.javabuilder</name>
    10                         <arguments>
    11                         </arguments>
    12                 </buildCommand>
    13                 <buildCommand>
    14                         <name>org.maven.ide.eclipse.maven2Builder</name>
    15                         <arguments>
    16                         </arguments>
    17                 </buildCommand>
    18         </buildSpec>
    19         <natures>
    20                 <nature>org.maven.ide.eclipse.maven2Nature</nature>
    21                 <nature>org.eclipse.jdt.core.javanature</nature>
    22         </natures>
     2  <name>jiwigo-ws-api</name>
     3  <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
     4  <projects/>
     5  <buildSpec>
     6    <buildCommand>
     7      <name>org.eclipse.jdt.core.javabuilder</name>
     8    </buildCommand>
     9    <buildCommand>
     10      <name>org.maven.ide.eclipse.maven2Builder</name>
     11    </buildCommand>
     12  </buildSpec>
     13  <natures>
     14    <nature>org.maven.ide.eclipse.maven2Nature</nature>
     15    <nature>org.eclipse.jdt.core.javanature</nature>
     16  </natures>
    2317</projectDescription>
  • extensions/jiwigo-ws-api/pom.xml

    r9387 r9392  
    33  <groupId>fr.mael.jiwigo</groupId>
    44  <artifactId>jiwigo-ws-api</artifactId>
    5   <version>0.13</version>
     5  <version>0.13.1</version>
    66
    77
     
    5050            <version>4.8.1</version>
    5151        </dependency>
     52        <dependency>
     53            <groupId>commons-beanutils</groupId>
     54            <artifactId>commons-beanutils</artifactId>
     55            <version>1.8.3</version>
     56        </dependency>
    5257
    5358  </dependencies>
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CategoryDao.java

    r9387 r9392  
    1212import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
    1313import fr.mael.jiwigo.transverse.session.SessionManager;
    14 import fr.mael.jiwigo.transverse.util.Outil;
     14import fr.mael.jiwigo.transverse.util.Tools;
    1515
    1616/*
     
    7878    /**
    7979     * Lists the categories
    80      * @param rafraichir true : uses the categories of the cache
    8180     * @param recursive true : recursive listing of the categories
    8281     * @return the list of categories
    8382     * @throws IOException
    8483     */
    85     public List<Category> lister(boolean recursive) throws IOException {
    86         Document doc = sessionManager.executerReturnDocument(MethodsEnum.LISTER_CATEGORIES.getLabel(), "recursive",
     84    public List<Category> list(boolean recursive) throws IOException {
     85        Document doc = sessionManager.executeReturnDocument(MethodsEnum.LISTER_CATEGORIES.getLabel(), "recursive",
    8786                String.valueOf(recursive));
    8887        Element element = doc.getRootElement().getChild("categories");
     
    9190        for (Element cat : listElement) {
    9291            Category myCat = new Category();
    93             myCat.setIdentifiant(Integer.valueOf(cat.getAttributeValue(CategoryEnum.ID.getLabel())));
     92            myCat.setIdentifier(Integer.valueOf(cat.getAttributeValue(CategoryEnum.ID.getLabel())));
    9493            myCat.setUrlCategory(cat.getAttributeValue(CategoryEnum.URL.getLabel()));
    9594            myCat.setNbImages(Integer.valueOf(cat.getAttributeValue(CategoryEnum.NB_IMAGES.getLabel())));
    9695            myCat.setNbTotalImages(Integer.valueOf(cat.getAttributeValue(CategoryEnum.NB_TOTAL_IMAGES.getLabel())));
    97             myCat.setNom(cat.getChildText(CategoryEnum.NAME.getLabel()));
     96            myCat.setName(cat.getChildText(CategoryEnum.NAME.getLabel()));
    9897            String catMeres = cat.getChildText(CategoryEnum.CAT_MERES.getLabel());
    9998            ArrayList<Integer> idCategoriesMeres = new ArrayList<Integer>();
     
    103102                }
    104103            }
    105             myCat.setIdCategoriesMeres(idCategoriesMeres);
     104            myCat.setIdParentCategories(idCategoriesMeres);
    106105            categories.add(myCat);
    107106        }
     
    114113     * @return true if the category is successfully created
    115114     */
    116     public boolean creer(Category category) {
     115    public boolean create(Category category) {
    117116        try {
    118             if (category.getParentDirect() != null) {
    119                 return Outil.checkOk(sessionManager.executerReturnDocument(MethodsEnum.AJOUTER_CATEGORIE.getLabel(),
    120                         "name", category.getNom(), "parent", String.valueOf(category.getParentDirect())));
     117            if (category.getDirectParent() != null) {
     118                return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.AJOUTER_CATEGORIE.getLabel(),
     119                        "name", category.getName(), "parent", String.valueOf(category.getDirectParent())));
    121120            } else {
    122                 return Outil.checkOk(sessionManager.executerReturnDocument(MethodsEnum.AJOUTER_CATEGORIE.getLabel(),
    123                         "name", category.getNom()));
     121                return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.AJOUTER_CATEGORIE.getLabel(),
     122                        "name", category.getName()));
    124123            }
    125124        } catch (IOException e) {
    126             LOG.error(Outil.getStackTrace(e));
     125            LOG.error(Tools.getStackTrace(e));
    127126        }
    128127        return false;
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/CommentDao.java

    r9387 r9392  
    1111import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
    1212import fr.mael.jiwigo.transverse.session.SessionManager;
    13 import fr.mael.jiwigo.transverse.util.Outil;
     13import fr.mael.jiwigo.transverse.util.Tools;
    1414
    1515/*
     
    8181     * @throws IOException
    8282     */
    83     public List<Comment> lister(Integer idImage) throws IOException {
    84         Document doc = (sessionManager.executerReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
     83    public List<Comment> list(Integer idImage) throws IOException {
     84        Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    8585                .valueOf(idImage)));
    8686        Element element = doc.getRootElement().getChild("image").getChild("comments");
     
    8989        for (Element com : listElement) {
    9090            Comment myCom = new Comment();
    91             myCom.setIdentifiant(Integer.valueOf(com.getAttributeValue("id")));
     91            myCom.setIdentifier(Integer.valueOf(com.getAttributeValue("id")));
    9292            myCom.setDate(com.getAttributeValue("date"));
    9393            myCom.setAuthor(com.getChildText("author"));
     
    105105     */
    106106    public String getKey(Integer idImage) throws IOException {
    107         Document doc = (sessionManager.executerReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
     107        Document doc = (sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    108108                .valueOf(idImage)));
    109109        String key = doc.getRootElement().getChild("image").getChild("comment_post").getAttributeValue("key");
     
    117117     * @throws IOException
    118118     */
    119     public boolean creer(Comment commentaire) throws IOException {
     119    public boolean create(Comment commentaire) throws IOException {
    120120        String key = getKey(commentaire.getImageId());
    121121        try {
     
    124124            e.printStackTrace();
    125125        }
    126         return Outil.checkOk(sessionManager.executerReturnDocument(MethodsEnum.AJOUTER_COMMENTAIRE.getLabel(),
     126        return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.AJOUTER_COMMENTAIRE.getLabel(),
    127127                "image_id", String.valueOf(commentaire.getImageId()), "author", commentaire.getAuthor(), "content",
    128128                commentaire.getContent(), "key", key));
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/ImageDao.java

    r9387 r9392  
    1515import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
    1616import fr.mael.jiwigo.transverse.session.SessionManager;
    17 import fr.mael.jiwigo.transverse.util.Outil;
     17import fr.mael.jiwigo.transverse.util.Tools;
    1818
    1919/*
     
    9797     * @throws IOException
    9898     */
    99     public List<Image> lister(boolean rafraichir) throws IOException {
    100         return listerParCategory(null, rafraichir);
     99    public List<Image> list(boolean refresh) throws IOException {
     100        return listByCategory(null, refresh);
    101101    }
    102102
     
    107107     * @throws IOException
    108108     */
    109     public List<Image> listerParCategory(Integer categoryId, boolean rafraichir) throws IOException {
    110         if (rafraichir || cache.get(categoryId) == null) {
     109    public List<Image> listByCategory(Integer categoryId, boolean refresh) throws IOException {
     110        if (refresh || cache.get(categoryId) == null) {
    111111            Document doc = null;
    112112
    113113            if (categoryId != null) {
    114                 doc = sessionManager.executerReturnDocument(MethodsEnum.LISTER_IMAGES.getLabel(), "cat_id", String
     114                doc = sessionManager.executeReturnDocument(MethodsEnum.LISTER_IMAGES.getLabel(), "cat_id", String
    115115                        .valueOf(categoryId));
    116116            } else {
    117                 doc = sessionManager.executerReturnDocument(MethodsEnum.LISTER_IMAGES.getLabel());
     117                doc = sessionManager.executeReturnDocument(MethodsEnum.LISTER_IMAGES.getLabel());
    118118            }
    119119            Element element = doc.getRootElement().getChild("images");
     
    140140     * Finally, the response of the webservice is checked
    141141     *
    142      * @param the image to create
     142     * @param image the image to create
    143143     * @return true if the creation of the image was the successful
    144144     * @throws Exception
    145145     */
    146     //TODO ne pas continuer si une des réponses précédentes est négative
    147     public boolean creer(Image image, Double chunkSize) throws Exception {
     146    //TODO ne pas continuer si une des reponses precedentes est negative
     147    public boolean create(Image image, Double chunkSize) throws Exception {
    148148        //thumbnail converted to base64
    149149        BASE64Encoder base64 = new BASE64Encoder();
    150150
    151         String thumbnailBase64 = base64.encode(Outil.getBytesFromFile(image.getThumbnail()));
     151        String thumbnailBase64 = base64.encode(Tools.getBytesFromFile(image.getThumbnail()));
    152152        //sends the thumbnail and gets the result
    153         Document reponseThumb = (sessionManager.executerReturnDocument("pwg.images.addChunk", "data", thumbnailBase64,
    154                 "type", "thumb", "position", "1", "original_sum", Outil.getMD5Checksum(image.getOriginale()
     153        Document reponseThumb = (sessionManager.executeReturnDocument("pwg.images.addChunk", "data", thumbnailBase64,
     154                "type", "thumb", "position", "1", "original_sum", Tools.getMD5Checksum(image.getOriginale()
    155155                        .getAbsolutePath())));
    156156
    157157        //begin feature:0001827
    158158        int chunk = chunkSize.intValue();
    159         ArrayList<File> fichiersAEnvoyer = Outil.splitFile(image.getOriginale(), chunk);
     159        ArrayList<File> fichiersAEnvoyer = Tools.splitFile(image.getOriginale(), chunk);
    160160        boolean echec = false;
    161161        for (int i = 0; i < fichiersAEnvoyer.size(); i++) {
    162162            File fichierAEnvoyer = fichiersAEnvoyer.get(i);
    163             String originaleBase64 = base64.encode(Outil.getBytesFromFile(fichierAEnvoyer));
    164             Document reponseOriginale = (sessionManager.executerReturnDocument("pwg.images.addChunk", "data",
    165                     originaleBase64, "type", "file", "position", String.valueOf(i), "original_sum", Outil
     163            String originaleBase64 = base64.encode(Tools.getBytesFromFile(fichierAEnvoyer));
     164            Document reponseOriginale = (sessionManager.executeReturnDocument("pwg.images.addChunk", "data",
     165                    originaleBase64, "type", "file", "position", String.valueOf(i), "original_sum", Tools
    166166                            .getMD5Checksum(image.getOriginale().getAbsolutePath())));
    167             if (!Outil.checkOk(reponseOriginale)) {
     167            if (!Tools.checkOk(reponseOriginale)) {
    168168                echec = true;
    169169                break;
     
    173173
    174174        //add the image in the database and get the result of the webservice
    175         Document reponseAjout = (sessionManager.executerReturnDocument("pwg.images.add", "file_sum", Outil
    176                 .getMD5Checksum(image.getOriginale().getAbsolutePath()), "thumbnail_sum", Outil.getMD5Checksum(image
    177                 .getThumbnail().getCanonicalPath()), "position", "1", "original_sum", Outil.getMD5Checksum(image
     175        Document reponseAjout = (sessionManager.executeReturnDocument("pwg.images.add", "file_sum", Tools
     176                .getMD5Checksum(image.getOriginale().getAbsolutePath()), "thumbnail_sum", Tools.getMD5Checksum(image
     177                .getThumbnail().getCanonicalPath()), "position", "1", "original_sum", Tools.getMD5Checksum(image
    178178                .getOriginale().getAbsolutePath()), "categories", String.valueOf(image.getIdCategory()), "name", image
    179179                .getName(), "author", sessionManager.getLogin(), "level", image.getPrivacyLevel()));
    180         LOG.debug("Response add : " + Outil.documentToString(reponseAjout));
     180        LOG.debug("Response add : " + Tools.documentToString(reponseAjout));
    181181        //      System.out.println(Main.sessionManager.executerReturnString("pwg.images.add", "file_sum", Outil
    182182        //              .getMD5Checksum(image.getOriginale().getAbsolutePath()), "thumbnail_sum", Outil.getMD5Checksum(image
     
    189189        //      }
    190190        boolean reussite = true;
    191         if (!Outil.checkOk(reponseThumb) || echec || !Outil.checkOk(reponseAjout)) {
     191        if (!Tools.checkOk(reponseThumb) || echec || !Tools.checkOk(reponseAjout)) {
    192192            reussite = false;
    193193        }
    194         suppressionFichierTemporaires();
     194        deleteTempFiles();
    195195        return reussite;
    196196
     
    204204     */
    205205    public boolean addTags(Integer imageId, String tagId) throws IOException {
    206         Document doc = sessionManager.executerReturnDocument(MethodsEnum.SET_INFO.getLabel(), "image_id", String
     206        Document doc = sessionManager.executeReturnDocument(MethodsEnum.SET_INFO.getLabel(), "image_id", String
    207207                .valueOf(imageId), "tag_ids", tagId);
    208         return Outil.checkOk(doc);
     208        return Tools.checkOk(doc);
    209209
    210210    }
     
    220220        for (Element im : listElement) {
    221221            Image myImage = new Image();
    222             myImage.setMiniature(im.getAttributeValue("tn_url"));
     222            myImage.setThumbnailUrl(im.getAttributeValue("tn_url"));
    223223            myImage.setUrl(im.getAttributeValue("element_url"));
    224224            myImage.setWidth(Integer.valueOf(im.getAttributeValue("width")));
    225225            myImage.setHeight(Integer.valueOf(im.getAttributeValue("height")));
    226226            myImage.setFile(im.getAttributeValue("file"));
    227             myImage.setVue(Integer.valueOf(im.getAttributeValue("hit")));
    228             myImage.setIdentifiant(Integer.valueOf(im.getAttributeValue("id")));
     227            myImage.setSeen(Integer.valueOf(im.getAttributeValue("hit")));
     228            myImage.setIdentifier(Integer.valueOf(im.getAttributeValue("id")));
    229229            myImage.setName(im.getChildText("name"));
    230230            System.out.println(new XMLOutputter().outputString(im));
     
    246246     */
    247247    public List<Image> search(String searchString) throws IOException {
    248         Document doc = sessionManager.executerReturnDocument(MethodsEnum.SEARCH.getLabel(), "query", searchString);
     248        Document doc = sessionManager.executeReturnDocument(MethodsEnum.SEARCH.getLabel(), "query", searchString);
    249249        LOG.debug(doc);
    250250        Element element = doc.getRootElement().getChild("images");
     
    253253    }
    254254
    255     private void suppressionFichierTemporaires() {
     255    private void deleteTempFiles() {
    256256        File file = new File(System.getProperty("java.io.tmpdir") + "/originale.jpg");
    257257        file.delete();
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/dao/TagDao.java

    r9387 r9392  
    1313import fr.mael.jiwigo.transverse.enumeration.TagEnum;
    1414import 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 
     15import fr.mael.jiwigo.transverse.util.Tools;
    4316
    4417/**
     
    8154     * @throws IOException
    8255     */
    83     public List<Tag> lister() throws IOException {
    84         Document doc = sessionManager.executerReturnDocument(MethodsEnum.TAGS_ADMIN_LIST.getLabel());
     56    public List<Tag> list() throws IOException {
     57        Document doc = sessionManager.executeReturnDocument(MethodsEnum.TAGS_ADMIN_LIST.getLabel());
    8558        //      System.out.println(Outil.documentToString(doc));
    8659        return getTagsFromDocument(doc.getRootElement().getChild("tags"));
     
    9972        for (Element tagElement : listElement) {
    10073            Tag tag = new Tag();
    101             tag.setId(Integer.valueOf(tagElement.getAttributeValue(TagEnum.ID.getLabel())));
    102             tag.setNom(tagElement.getAttributeValue(TagEnum.NAME.getLabel()));
     74            tag.setIdentifier(Integer.valueOf(tagElement.getAttributeValue(TagEnum.ID.getLabel())));
     75            tag.setName(tagElement.getAttributeValue(TagEnum.NAME.getLabel()));
    10376            tags.add(tag);
    10477        }
     
    11285     * @return true if the tag as been successfully created
    11386     */
    114     public boolean creer(Tag tag) {
     87    public boolean create(Tag tag) {
    11588        try {
    116             return Outil.checkOk(sessionManager.executerReturnDocument(MethodsEnum.ADD_TAG.getLabel(), "name", tag
    117                     .getNom()));
     89            return Tools.checkOk(sessionManager.executeReturnDocument(MethodsEnum.ADD_TAG.getLabel(), "name", tag
     90                    .getName()));
    11891        } catch (IOException e) {
    119             LOG.error(Outil.getStackTrace(e));
     92            LOG.error(Tools.getStackTrace(e));
    12093        }
    12194        return false;
     
    129102     */
    130103    public List<Tag> tagsForImage(Image image) throws IOException {
    131         Document doc = sessionManager.executerReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
    132                 .valueOf(image.getIdentifiant()));
     104        Document doc = sessionManager.executeReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
     105                .valueOf(image.getIdentifier()));
    133106        return getTagsFromDocument(doc.getRootElement().getChild("image").getChild("tags"));
    134107    }
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/om/Category.java

    r9387 r9392  
    3838public class Category {
    3939
    40     private ArrayList<Integer> idCategoriesMeres;
    41     private Integer identifiant;
     40    private ArrayList<Integer> idParentCategories;
     41    private Integer identifier;
    4242    private String urlCategory;
    4343    private Integer nbImages;
    4444    private Integer nbTotalImages;
    45     private ArrayList<Category> categoriesFilles;
    46     private ArrayList<Category> categoriesMeres;
    47     private String nom;
     45    private ArrayList<Category> childCategories;
     46    private ArrayList<Category> parentCategories;
     47    private String name;
    4848    private Element element;
    49     private Integer parentDirect;
     49    private Integer directParent;
    5050    private Integer level;
    5151
    5252    public Category() {
    53         categoriesFilles = new ArrayList<Category>();
    54         categoriesMeres = new ArrayList<Category>();
     53        childCategories = new ArrayList<Category>();
     54        parentCategories = new ArrayList<Category>();
    5555    }
    5656
    5757    @Override
    5858    public String toString() {
    59         return nom;
    60     }
    61 
    62     /**
    63      * @return the idCategoriesMeres
    64      */
    65     public ArrayList<Integer> getIdCategoriesMeres() {
    66         return idCategoriesMeres;
    67     }
    68 
    69     /**
    70      * @param idCategoriesMeres the idCategoriesMeres to set
    71      */
    72     public void setIdCategoriesMeres(ArrayList<Integer> idCategoriesMeres) {
    73         this.idCategoriesMeres = idCategoriesMeres;
    74     }
    75 
    76     /**
    77      * @return the identifiant
    78      */
    79     public Integer getIdentifiant() {
    80         return identifiant;
    81     }
    82 
    83     /**
    84      * @param identifiant the identifiant to set
    85      */
    86     public void setIdentifiant(Integer identifiant) {
    87         this.identifiant = identifiant;
     59        return name;
    8860    }
    8961
     
    131103
    132104    /**
    133      * @return the categoriesFilles
    134      */
    135     public ArrayList<Category> getCategoriesFilles() {
    136         return categoriesFilles;
    137     }
    138 
    139     /**
    140      * @param categoriesFilles the categoriesFilles to set
    141      */
    142     public void setCategoriesFilles(ArrayList<Category> categoriesFilles) {
    143         this.categoriesFilles = categoriesFilles;
    144     }
    145 
    146     /**
    147      * @return the categoriesMeres
    148      */
    149     public ArrayList<Category> getCategoriesMeres() {
    150         return categoriesMeres;
    151     }
    152 
    153     /**
    154      * @param categoriesMeres the categoriesMeres to set
    155      */
    156     public void setCategoriesMeres(ArrayList<Category> categoriesMeres) {
    157         this.categoriesMeres = categoriesMeres;
    158     }
    159 
    160     /**
    161      * @return the nom
    162      */
    163     public String getNom() {
    164         return nom;
    165     }
    166 
    167     /**
    168      * @param nom the nom to set
    169      */
    170     public void setNom(String nom) {
    171         this.nom = nom;
    172     }
    173 
    174     /**
    175105     * @return the element
    176106     */
     
    186116    }
    187117
    188     /**
    189      * @return the parentDirect
    190      */
    191     public Integer getParentDirect() {
    192         return parentDirect;
    193     }
    194 
    195     /**
    196      * @param parentDirect the parentDirect to set
    197      */
    198     public void setParentDirect(Integer parentDirect) {
    199         this.parentDirect = parentDirect;
    200     }
    201 
    202118    public Integer getLevel() {
    203119        return level;
     
    208124    }
    209125
     126    public ArrayList<Integer> getIdParentCategories() {
     127        return idParentCategories;
     128    }
     129
     130    public void setIdParentCategories(ArrayList<Integer> idParentCategories) {
     131        this.idParentCategories = idParentCategories;
     132    }
     133
     134    public Integer getIdentifier() {
     135        return identifier;
     136    }
     137
     138    public void setIdentifier(Integer identifier) {
     139        this.identifier = identifier;
     140    }
     141
     142    public ArrayList<Category> getChildCategories() {
     143        return childCategories;
     144    }
     145
     146    public void setChildCategories(ArrayList<Category> childCategories) {
     147        this.childCategories = childCategories;
     148    }
     149
     150    public ArrayList<Category> getParentCategories() {
     151        return parentCategories;
     152    }
     153
     154    public void setParentCategories(ArrayList<Category> parentCategories) {
     155        this.parentCategories = parentCategories;
     156    }
     157
     158    public String getName() {
     159        return name;
     160    }
     161
     162    public void setName(String name) {
     163        this.name = name;
     164    }
     165
     166    public Integer getDirectParent() {
     167        return directParent;
     168    }
     169
     170    public void setDirectParent(Integer directParent) {
     171        this.directParent = directParent;
     172    }
     173
    210174}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/om/Comment.java

    r9387 r9392  
    3737    private String content;
    3838    private String key;
    39     private Integer identifiant;
     39    private Integer identifier;
    4040    private String date;
    4141
     
    9696    }
    9797
    98     /**
    99      * @return the identifiant
    100      */
    101     public Integer getIdentifiant() {
    102         return identifiant;
     98    public Integer getIdentifier() {
     99        return identifier;
    103100    }
    104101
    105     /**
    106      * @param identifiant the identifiant to set
    107      */
    108     public void setIdentifiant(Integer identifiant) {
    109         this.identifiant = identifiant;
     102    public void setIdentifier(Integer identifier) {
     103        this.identifier = identifier;
    110104    }
    111105
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/om/Image.java

    r9387 r9392  
    3636 */
    3737public class Image {
    38     private String miniature;
     38    private String thumbnailUrl;
    3939    private String url;
    4040    private Integer width;
    4141    private Integer height;
    4242    private String file;
    43     private Integer identifiant;
    44     private Integer vue;
     43    private Integer identifier;
     44    private Integer seen;
    4545    private String name;
    4646    private Integer idCategory;
    47     private String auteur;
     47    private String author;
    4848    private File thumbnail;
    4949    private String privacyLevel;
     
    6363    }
    6464
    65     /**
    66      * @return the auteur
    67      */
    68     public String getAuteur() {
    69         return auteur;
    70     }
    71 
    72     /**
    73      * @param auteur the auteur to set
    74      */
    75     public void setAuteur(String auteur) {
    76         this.auteur = auteur;
     65    public Integer getSeen() {
     66        return seen;
     67    }
     68
     69    public void setSeen(Integer seen) {
     70        this.seen = seen;
     71    }
     72
     73    public String getAuthor() {
     74        return author;
     75    }
     76
     77    public void setAuthor(String author) {
     78        this.author = author;
    7779    }
    7880
     
    113115    }
    114116
    115     /**
    116      * @return the miniature
    117      */
    118     public String getMiniature() {
    119         return miniature;
    120     }
    121 
    122     /**
    123      * @param miniature the miniature to set
    124      */
    125     public void setMiniature(String miniature) {
    126         this.miniature = miniature;
     117    public String getThumbnailUrl() {
     118        return thumbnailUrl;
     119    }
     120
     121    public void setThumbnailUrl(String thumbnailUrl) {
     122        this.thumbnailUrl = thumbnailUrl;
    127123    }
    128124
     
    183179    }
    184180
    185     /**
    186      * @return the identifiant
    187      */
    188     public Integer getIdentifiant() {
    189         return identifiant;
    190     }
    191 
    192     /**
    193      * @param identifiant the identifiant to set
    194      */
    195     public void setIdentifiant(Integer identifiant) {
    196         this.identifiant = identifiant;
    197     }
    198 
    199     /**
    200      * @return the vue
    201      */
    202     public Integer getVue() {
    203         return vue;
    204     }
    205 
    206     /**
    207      * @param vue the vue to set
    208      */
    209     public void setVue(Integer vue) {
    210         this.vue = vue;
     181    public Integer getIdentifier() {
     182        return identifier;
     183    }
     184
     185    public void setIdentifier(Integer identifier) {
     186        this.identifier = identifier;
    211187    }
    212188
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/om/Tag.java

    r9387 r9392  
    3636     * Name of the tag
    3737     */
    38     private String nom;
     38    private String name;
    3939
    4040    /**
    4141     * Id of the tag
    4242     */
    43     private Integer identifiant;
     43    private Integer identifier;
    4444
    45     /**
    46      * @return the nom
    47      */
    48     public String getNom() {
    49         return nom;
     45    public String getName() {
     46        return name;
    5047    }
    5148
    52     /**
    53      * @param nom the nom to set
    54      */
    55     public void setNom(String nom) {
    56         this.nom = nom;
     49    public void setName(String name) {
     50        this.name = name;
    5751    }
    5852
    59     /**
    60      * @return the id
    61      */
    62     public Integer getId() {
    63         return identifiant;
     53    public Integer getIdentifier() {
     54        return identifier;
    6455    }
    6556
    66     /**
    67      * @param id the id to set
    68      */
    69     public void setId(Integer id) {
    70         this.identifiant = id;
     57    public void setIdentifier(Integer identifier) {
     58        this.identifier = identifier;
    7159    }
    7260
     
    7462    public String toString() {
    7563        // TODO Auto-generated method stub
    76         return nom;
     64        return name;
    7765    }
    7866}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CategoryService.java

    r9387 r9392  
    7373    /**
    7474     * Lists all categories
    75      * @param rafraichir true to refresh
    7675     * @param recursive true : recursive listing
    7776     * @return the list of categories
    7877     * @throws IOException
    7978     */
    80     public List<Category> lister(boolean recursive) throws IOException {
    81         return CategoryDao.getInstance(sessionManager).lister(recursive);
     79    public List<Category> list(boolean recursive) throws IOException {
     80        return CategoryDao.getInstance(sessionManager).list(recursive);
    8281    }
    8382
     
    8887     */
    8988    public List<Category> makeTree() throws IOException {
    90         List<Category> list = CategoryDao.getInstance(sessionManager).lister(true);
     89        List<Category> list = CategoryDao.getInstance(sessionManager).list(true);
    9190        for (Category category : list) {
    9291            for (Category category2 : list) {
    93                 if (category2.getIdCategoriesMeres().size() != 1
    94                         && category.getIdentifiant().equals(
    95                                 category2.getIdCategoriesMeres().get(category2.getIdCategoriesMeres().size() - 2))) {
    96                     category.getCategoriesFilles().add(category2);
    97                     category2.getCategoriesMeres().add(category);
     92                if (category2.getIdParentCategories().size() != 1
     93                        && category.getIdentifier().equals(
     94                                category2.getIdParentCategories().get(category2.getIdParentCategories().size() - 2))) {
     95                    category.getChildCategories().add(category2);
     96                    category2.getParentCategories().add(category);
    9897                }
    9998
     
    111110     * @return true if successful
    112111     */
    113     public boolean creer(String nom, Integer parent) {
     112    public boolean create(String nom, Integer parent) {
    114113        Category category = new Category();
    115         category.setParentDirect(parent);
    116         category.setNom(nom);
    117         return CategoryDao.getInstance(sessionManager).creer(category);
     114        category.setDirectParent(parent);
     115        category.setName(nom);
     116        return CategoryDao.getInstance(sessionManager).create(category);
    118117    }
    119118
     
    123122     * @return true if successful
    124123     */
    125     public boolean creer(String nom) {
     124    public boolean create(String nom) {
    126125        Category category = new Category();
    127         category.setNom(nom);
    128         return CategoryDao.getInstance(sessionManager).creer(category);
     126        category.setName(nom);
     127        return CategoryDao.getInstance(sessionManager).create(category);
    129128    }
    130129}
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/CommentService.java

    r9387 r9392  
    7676     * @throws IOException
    7777     */
    78     public List<Comment> lister(Integer imageId) throws IOException {
    79         return CommentDao.getInstance(sessionManager).lister(imageId);
     78    public List<Comment> list(Integer imageId) throws IOException {
     79        return CommentDao.getInstance(sessionManager).list(imageId);
    8080    }
    8181
     
    8888     * @throws IOException
    8989     */
    90     public boolean creer(String content, Integer imageId, String auteur) throws IOException {
    91         Comment commentaire = new Comment();
    92         commentaire.setContent(content);
    93         commentaire.setImageId(imageId);
    94         commentaire.setAuthor(auteur);
    95         return CommentDao.getInstance(sessionManager).creer(commentaire);
     90    public boolean create(String content, Integer imageId, String auteur) throws IOException {
     91        Comment comment = new Comment();
     92        comment.setContent(content);
     93        comment.setImageId(imageId);
     94        comment.setAuthor(auteur);
     95        return CommentDao.getInstance(sessionManager).create(comment);
    9696    }
    9797
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/ImageService.java

    r9387 r9392  
    99import fr.mael.jiwigo.transverse.session.SessionManager;
    1010import fr.mael.jiwigo.transverse.util.ImagesUtil;
    11 import fr.mael.jiwigo.transverse.util.Outil;
     11import fr.mael.jiwigo.transverse.util.Tools;
    1212
    1313/*
     
    7878     * Lists all images for a category
    7979     * @param categoryId the id of the category
    80      * @param rafraichir true : refresh the list of images
    8180     * @return the list of images
    8281     * @throws IOException
    8382     */
    84     public List<Image> listerParCategory(Integer categoryId, boolean rafraichir) throws IOException {
    85         return ImageDao.getInstance(sessionManager).listerParCategory(categoryId, rafraichir);
     83    public List<Image> listByCategory(Integer categoryId, boolean rafraichir) throws IOException {
     84        return ImageDao.getInstance(sessionManager).listByCategory(categoryId, rafraichir);
    8685    }
    8786
     
    9291     * @param originalWidth width for the original image
    9392     * @param originalHeight height for the original image
    94      * @return
     93     * @return true if the image is created
    9594     * @throws Exception
    9695     */
    97     public boolean creer(String filePath, Integer idCategory, Integer originalWidth, Integer originalHeight,
     96    public boolean create(String filePath, Integer idCategory, Integer originalWidth, Integer originalHeight,
    9897            Double chunckSize, Integer privacyLevel) throws Exception {
    9998        File originalFile = new File(filePath);
    10099        //get the byte array of the original file, to keep metadata
    101         byte[] bytesFichierOriginal = Outil.getBytesFromFile(originalFile);
     100        byte[] bytesFichierOriginal = Tools.getBytesFromFile(originalFile);
    102101
    103102        //resize the picture (or not)
     
    114113            //the methode Outil.enrich will fail, but the procedure has to continue
    115114            try {
    116                 byte[] fichierEnrichi = Outil.enrich(bytesFichierOriginal, Outil.getBytesFromFile(new File(System
     115                byte[] fichierEnrichi = Tools.enrich(bytesFichierOriginal, Tools.getBytesFromFile(new File(System
    117116                        .getProperty("java.io.tmpdir")
    118117                        + "/originale.jpg")));
    119                 Outil.byteToFile(System.getProperty("java.io.tmpdir") + "/originale.jpg", fichierEnrichi);
     118                Tools.byteToFile(System.getProperty("java.io.tmpdir") + "/originale.jpg", fichierEnrichi);
    120119            } catch (Exception e) {
    121120            }
     
    131130        image.setPrivacyLevel(String.valueOf(privacyLevel));
    132131        //now we call the dao to send the image to the webservice
    133         return ImageDao.getInstance(sessionManager).creer(image, chunckSize);
     132        return ImageDao.getInstance(sessionManager).create(image, chunckSize);
    134133    }
    135134
     
    142141     */
    143142    public boolean addTags(Image image, String tagId) throws IOException {
    144         return ImageDao.getInstance(sessionManager).addTags(image.getIdentifiant(), tagId);
     143        return ImageDao.getInstance(sessionManager).addTags(image.getIdentifier(), tagId);
    145144    }
    146145
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/service/TagService.java

    r9387 r9392  
    7777     * @throws IOException
    7878     */
    79     public List<Tag> lister() throws IOException {
    80         return TagDao.getInstance(sessionManager).lister();
     79    public List<Tag> list() throws IOException {
     80        return TagDao.getInstance(sessionManager).list();
    8181    }
    8282
     
    8787     * @throws IOException
    8888     */
    89     public boolean creer(String nom) throws IOException {
     89    public boolean create(String nom) throws IOException {
    9090        Tag tag = new Tag();
    91         tag.setNom(nom);
    92         return TagDao.getInstance(sessionManager).creer(tag);
     91        tag.setName(nom);
     92        return TagDao.getInstance(sessionManager).create(tag);
    9393    }
    9494
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java

    r9387 r9392  
    1818
    1919import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
    20 import fr.mael.jiwigo.transverse.util.Outil;
     20import fr.mael.jiwigo.transverse.util.Tools;
    2121
    2222/*
     
    6565     * the entered password
    6666     */
    67     private String motDePasse;
     67    private String password;
    6868    /**
    6969     * the url of the site
     
    103103     * true : an error was found for the proxy
    104104     */
    105     private boolean erreurProxy;
     105    private boolean proxyError;
    106106
    107107    /**
    108108     * Constructor
    109109     * @param login the login
    110      * @param motDePasse the password
     110     * @param password the password
    111111     * @param url the url of the site
    112112     */
    113     public SessionManager(String login, String motDePasse, String url) {
     113    public SessionManager(String login, String password, String url) {
    114114        this.login = login;
    115         this.motDePasse = motDePasse;
     115        this.password = password;
    116116        this.url = url + "/ws.php";
    117117        MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
     
    140140        }
    141141        try {
    142             doc = executerReturnDocument(MethodsEnum.LOGIN.getLabel(), "username", login, "password", motDePasse);
    143             return Outil.checkOk(doc);
     142            doc = executeReturnDocument(MethodsEnum.LOGIN.getLabel(), "username", login, "password", password);
     143            return Tools.checkOk(doc);
    144144        } catch (Exception e) {
    145             LOG.error(Outil.getStackTrace(e));
     145            LOG.error(Tools.getStackTrace(e));
    146146        }
    147147        return false;
     
    155155     * @throws UnsupportedEncodingException
    156156     */
    157     public String executerReturnString(String methode, String... parametres) throws UnsupportedEncodingException {
     157    public String executeReturnString(String methode, String... parametres) throws UnsupportedEncodingException {
    158158        if (parametres.length % 2 != 0 && !(parametres == null)) {
    159159            try {
    160160                throw new Exception("Le nombre de parametres doit etre pair");
    161161            } catch (Exception e) {
    162                 LOG.error(Outil.getStackTrace(e));
     162                LOG.error(Tools.getStackTrace(e));
    163163                return null;
    164164            }
     
    180180            //      System.out.println(Outil.readInputStreamAsString(streamResponse));
    181181            //      String toReturn = method.getResponseBodyAsString();
    182             String toReturn = Outil.readInputStreamAsString(streamResponse);
     182            String toReturn = Tools.readInputStreamAsString(streamResponse);
    183183            LOG.debug(toReturn);
    184184            return toReturn;
    185185        } catch (HttpException e) {
    186186            // TODO Auto-generated catch block
    187             LOG.error(Outil.getStackTrace(e));
     187            LOG.error(Tools.getStackTrace(e));
    188188        } catch (IOException e) {
    189189            // TODO Auto-generated catch block
    190             LOG.error(Outil.getStackTrace(e));
     190            LOG.error(Tools.getStackTrace(e));
    191191        } catch (IllegalArgumentException e) {
    192             LOG.error(Outil.getStackTrace(e));
     192            LOG.error(Tools.getStackTrace(e));
    193193        } finally {
    194194            method.releaseConnection();
     
    205205     * @throws IOException
    206206     */
    207     public Document executerReturnDocument(String methode, String... parametres) throws IOException {
     207    public Document executeReturnDocument(String methode, String... parametres) throws IOException {
    208208        try {
    209             return Outil.stringToDocument(executerReturnString(methode, parametres));
     209            return Tools.stringToDocument(executeReturnString(methode, parametres));
    210210        } catch (JDOMException e) {
    211211            // TODO Auto-generated catch block
    212             LOG.error(Outil.getStackTrace(e));
     212            LOG.error(Tools.getStackTrace(e));
    213213        }
    214214        return null;
     
    221221     * @return the result
    222222     */
    223     public Document executerReturnDocument(String methode) {
     223    public Document executeReturnDocument(String methode) {
    224224        try {
    225             return Outil.stringToDocument(executerReturnString(methode));
     225            return Tools.stringToDocument(executeReturnString(methode));
    226226        } catch (JDOMException e) {
    227227            // TODO Auto-generated catch block
    228             LOG.error(Outil.getStackTrace(e));
     228            LOG.error(Tools.getStackTrace(e));
    229229        } catch (IOException e) {
    230230            // TODO Auto-generated catch block
    231             LOG.error(Outil.getStackTrace(e));
     231            LOG.error(Tools.getStackTrace(e));
    232232        }
    233233        return null;
     
    250250
    251251    /**
    252      * @return the motDePasse
    253      */
    254     public String getMotDePasse() {
    255         return motDePasse;
    256     }
    257 
    258     /**
    259      * @param motDePasse the motDePasse to set
    260      */
    261     public void setMotDePasse(String motDePasse) {
    262         this.motDePasse = motDePasse;
    263     }
    264 
    265     /**
    266252     * @return the url
    267253     */
     
    312298    }
    313299
    314     /**
    315      * @return the erreurProxy
    316      */
    317     public boolean isErreurProxy() {
    318         return erreurProxy;
     300    public String getPassword() {
     301        return password;
     302    }
     303
     304    public void setPassword(String password) {
     305        this.password = password;
     306    }
     307
     308    public boolean isProxyError() {
     309        return proxyError;
     310    }
     311
     312    public void setProxyError(boolean proxyError) {
     313        this.proxyError = proxyError;
    319314    }
    320315
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/util/ImagesUtil.java

    r9387 r9392  
    8787
    8888    /**
    89      * @return
     89     * @return the graphics configuration
    9090     */
    9191    public static GraphicsConfiguration getDefaultConfiguration() {
  • extensions/jiwigo-ws-api/src/main/java/fr/mael/jiwigo/transverse/util/Tools.java

    r9387 r9392  
    6363 *
    6464 */
    65 public class Outil {
     65public class Tools {
    6666    /**
    6767     * Logger
    6868     */
    69     public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(Outil.class);
     69    public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(Tools.class);
    7070
    7171    /**
     
    129129     */
    130130    public static URL getURL(String fileName) {
    131         URLClassLoader urlLoader = (URLClassLoader) Outil.class.getClassLoader();
     131        URLClassLoader urlLoader = (URLClassLoader) Tools.class.getClassLoader();
    132132        URL fileLocation = urlLoader.findResource(fileName);
    133133        return fileLocation;
     
    205205        } else {
    206206            LOG.error("Resultat : " + doc.getRootElement().getAttributeValue("stat") + "\nDocument retourné : \n"
    207                     + Outil.documentToString(doc));
     207                    + Tools.documentToString(doc));
    208208            return false;
    209209        }
Note: See TracChangeset for help on using the changeset viewer.