View Javadoc
1   /*
2    * Copyright (c) 2002-2020, City of Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.blog.business;
35  
36  import java.util.List;
37  
38  import fr.paris.lutece.portal.service.plugin.Plugin;
39  import fr.paris.lutece.util.ReferenceList;
40  
41  public interface ITagDAO
42  {
43  
44      /**
45       * Create an instance of the tag class
46       * 
47       * @param tag
48       *            The instance of the tag which contains the informations to store
49       * @param plugin
50       *            the plugin
51       */
52      void insert( Tag tag, Plugin plugin );
53  
54      /**
55       * Returns an instance of a tag whose identifier is specified in parameter
56       * 
57       * @param nIdTag
58       *            The tag primary key
59       * @param plugin
60       *            the plugin
61       * @return an instance of Tag
62       */
63      Tag load( int nIdTag, Plugin plugin );
64  
65      /**
66       * Returns an instance of a tag whose name is specified in parameter
67       * 
68       * @param strName
69       *            The tag name
70       * @param plugin
71       *            the plugin
72       * @return an instance of Tag
73       */
74      Tag loadByName( String strName, Plugin plugin );
75  
76      /**
77       * Load the data of all the tag objects and returns them as a list
78       * 
79       * @param plugin
80       *            the plugin
81       * @return the list which contains the data of all the tag objects
82       */
83      List<Tag> loadAllTag( Plugin plugin );
84  
85      /**
86       * Remove the tag whose identifier is specified in parameter
87       * 
88       * @param nIdTag
89       *            The tag Id
90       * @param plugin
91       *            the plugin
92       */
93      void delete( int nIdTag, Plugin plugin );
94  
95      /**
96       * Update of the tag which is specified in parameter
97       * 
98       * @param tag
99       *            The instance of the tag which contains the data to store
100      * @param plugin
101      *            the plugin
102      */
103     void store( Tag tag, Plugin plugin );
104 
105     /**
106      * Associating a tag with a document
107      * 
108      * @param nIdTag
109      *            the Tag id
110      * @param nIdDocument
111      *            The document identifiant
112      * @param plugin
113      *            the plugin
114      * @param nPriority
115      *            The priority of the document
116      */
117     void insert( int nIdTag, int nIdDocument, int nPriority, Plugin plugin );
118 
119     /**
120      * Delete Association a tag with a document whose identifier is specified in parameter
121      * 
122      * @param nIdTag
123      *            Id Tag
124      * @param nIdDocument
125      *            Id Document
126      * @param plugin
127      *            the plugin
128      */
129     void deleteByTAG( int nIdTag, int nIdDocument, Plugin plugin );
130 
131     /**
132      * Delete Association a tag with a document whose identifier is specified in parameter
133      * 
134      * @param nIdDocument
135      *            The Id Document
136      * @param plugin
137      *            the plugin
138      */
139     void deleteByDoc( int nIdDocument, Plugin plugin );
140 
141     /**
142      * Load the data of the tag objects whose identifier is specified in parameter and returns them as a list
143      * 
144      * @param nIdDocument
145      *            The document identifiant
146      * @param plugin
147      *            the plugin
148      * @return returns them as a list of the tag objects
149      */
150     List<Tag> loadByDoc( int nIdDocument, Plugin plugin );
151 
152     /**
153      * Load the Tags associated with the document whose identifier is specified in parameter
154      * 
155      * @param nIdDocument
156      *            Id Document
157      * @param plugin
158      *            the plugin
159      * @return list of Tag
160      */
161     List<Tag> loadListTagByIdDoc( int nIdDocument, Plugin plugin );
162 
163     /**
164      * Load the data of all the tag objects and returns them as a list
165      * 
166      * @param plugin
167      *            the plugin
168      * @return the list which contains the data of all the tag objects
169      */
170     ReferenceList selectTagsReferenceList( Plugin plugin );
171 
172 }