View Javadoc
1   /*
2    * Copyright (c) 2002-2017, Mairie de 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.directory.business;
35  
36  import fr.paris.lutece.portal.service.plugin.Plugin;
37  
38  /*
39   * Copyright (c) 2002-2014, Mairie de Paris
40   * All rights reserved.
41   *
42   * Redistribution and use in source and binary forms, with or without
43   * modification, are permitted provided that the following conditions
44   * are met:
45   *
46   *  1. Redistributions of source code must retain the above copyright notice
47   *     and the following disclaimer.
48   *
49   *  2. Redistributions in binary form must reproduce the above copyright notice
50   *     and the following disclaimer in the documentation and/or other materials
51   *     provided with the distribution.
52   *
53   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
54   *     contributors may be used to endorse or promote products derived from
55   *     this software without specific prior written permission.
56   *
57   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
58   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
60   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
61   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
62   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
63   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
64   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
65   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
66   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
67   * POSSIBILITY OF SUCH DAMAGE.
68   *
69   * License 1.0
70   */
71  import java.util.List;
72  
73  /**
74   * IFormDAO Interface
75   */
76  public interface IFieldDAO
77  {
78      /**
79       * Insert a new record in the table.
80       *
81       * @param field
82       *            instance of the Field object to insert
83       * @param plugin
84       *            the plugin
85       * @return the new field create
86       */
87      int insert( Field field, Plugin plugin );
88  
89      /**
90       * Update the field in the table
91       *
92       * @param field
93       *            instance of the Field object to update
94       * @param plugin
95       *            the plugin
96       */
97      void store( Field field, Plugin plugin );
98  
99      /**
100      * Delete a record from the table
101      *
102      * @param nIdField
103      *            The identifier of the field
104      * @param plugin
105      *            the plugin
106      */
107     void delete( int nIdField, Plugin plugin );
108 
109     // /////////////////////////////////////////////////////////////////////////
110     // Finders
111 
112     /**
113      * Load the data of the Field from the table
114      *
115      * @param nIdField
116      *            The identifier of the field
117      * @param plugin
118      *            the plugin
119      * @return the instance of the Field
120      */
121     Field load( int nIdField, Plugin plugin );
122 
123     /**
124      * Load the data of the Field from the table by value
125      *
126      * @param nIdEntry
127      *            the entry id
128      * @param strValue
129      *            the field value
130      * @param plugin
131      *            the plugin
132      * @return the instance of the Field
133      */
134     Field loadByValue( int nIdEntry, String strValue, Plugin plugin );
135 
136     /**
137      * Load the data of all the field of the entry and returns them in a list
138      * 
139      * @param idEntry
140      *            the id of the entry
141      * @param plugin
142      *            the plugin
143      * @return the list of field
144      */
145     List<Field> selectFieldListByIdEntry( int idEntry, Plugin plugin );
146 
147     /**
148      * Delete an association between field and a regular expression
149      *
150      * @param nIdField
151      *            The identifier of the field
152      * @param nIdExpression
153      *            The identifier of the regular expression
154      * @param plugin
155      *            the plugin
156      */
157     void deleteVerifyBy( int nIdField, int nIdExpression, Plugin plugin );
158 
159     /**
160      * insert an association between field and a regular expression
161      *
162      * @param nIdField
163      *            The identifier of the field
164      * @param nIdExpression
165      *            The identifier of the regular expression
166      * @param plugin
167      *            the plugin
168      */
169     void insertVerifyBy( int nIdField, int nIdExpression, Plugin plugin );
170 
171     /**
172      * Load the key of all the regularExpression associate to the field and returns them in a list
173      * 
174      * @param nIdField
175      *            the id of the field
176      * @param plugin
177      *            the plugin
178      * @return the list of regular expression key
179      */
180     List<Integer> selectListRegularExpressionKeyByIdField( int nIdField, Plugin plugin );
181 
182     /**
183      * verify if the regular expresssion is use
184      *
185      * @param nIdExpression
186      *            The identifier of the expression
187      * @param plugin
188      *            the plugin
189      * @return true if the regular expression is use
190      */
191     boolean isRegularExpressionIsUse( int nIdExpression, Plugin plugin );
192 }