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 import java.util.List; 39 40 /** 41 * 42 * interface IRecordFieldDAO 43 * 44 */ 45 public interface IRecordFieldDAO 46 { 47 /** 48 * Insert a new record field in the table. 49 * 50 * @param recordField 51 * instance of the RecordField object to insert 52 * @param plugin 53 * the plugin 54 */ 55 void insert( RecordField recordField, Plugin plugin ); 56 57 /** 58 * Load the data of the record field from the table 59 * 60 * @param nIdRecordField 61 * The identifier of the entry 62 * @param plugin 63 * the plugin 64 * @return the instance of the Record Field 65 */ 66 RecordField load( int nIdRecordField, Plugin plugin ); 67 68 /** 69 * Delete the record field whose identifier is specified in parameter 70 * 71 * @param nIdRecordField 72 * The identifier of the record field 73 * @param plugin 74 * the plugin 75 */ 76 void delete( int nIdRecordField, Plugin plugin ); 77 78 /** 79 * Delete list of record fields by list of record id 80 * 81 * @param lListRecordId 82 * list of record id 83 * @param plugin 84 * the plugin 85 */ 86 void deleteByListRecordId( List<Integer> lListRecordId, Plugin plugin ); 87 88 /** 89 * Update the record field in the table 90 * 91 * @param recordField 92 * instance of the record field object to update 93 * @param plugin 94 * the plugin 95 */ 96 void store( RecordField recordField, Plugin plugin ); 97 98 /** 99 * Load the data of all the record field who verify the filter and returns them in a list 100 * 101 * @param filter 102 * the filter 103 * @param plugin 104 * the plugin 105 * @return the list of record field 106 */ 107 List<RecordField> selectListByFilter( RecordFieldFilter filter, Plugin plugin ); 108 109 /** 110 * Load full record field data (except binary file data) of given list of Record id * /!\ include record data 111 * 112 * @param lIdRecordList 113 * the list of record id 114 * @param plugin 115 * the plugin 116 * @return list of record 117 */ 118 List<RecordField> getRecordFieldListByRecordIdList( List<Integer> lIdRecordList, Plugin plugin ); 119 120 /** 121 * Load full record field data (except binary file data) /!\ record data is NOT load, only the id 122 * 123 * @param lEntryId 124 * List entry to load 125 * @param nIdRecord 126 * the record Id 127 * @param plugin 128 * the plugin 129 * @return list of record 130 */ 131 List<RecordField> selectSpecificList( List<Integer> lEntryId, Integer nIdRecord, Plugin plugin ); 132 133 /** 134 * return the number of record field who verify the filter 135 * 136 * @param filter 137 * the filter 138 * @param plugin 139 * the plugin 140 * @return the number of record field who verify the filter 141 */ 142 int getCountByFilter( RecordFieldFilter filter, Plugin plugin ); 143 144 /** 145 * Get the max number from a given id directory 146 * 147 * @param nIdEntry 148 * the id of the entry 149 * @param nIdDirectory 150 * the id directory 151 * @param plugin 152 * {@link Plugin} 153 * @return the max number 154 */ 155 int getMaxNumber( int nIdEntry, int nIdDirectory, Plugin plugin ); 156 157 /** 158 * Check if the given number is already on a record field or not. <br> 159 * In other words, this method serves the purpose of checking the given number before creating a new record field since the entry type numbering should have 160 * unique number. 161 * 162 * @param nIdEntry 163 * the id entry 164 * @param nIdDirectory 165 * the id directory 166 * @param nNumber 167 * the number to check 168 * @param plugin 169 * {@link Plugin} 170 * @return true if it is already on, false otherwise 171 */ 172 boolean isNumberOnARecordField( int nIdEntry, int nIdDirectory, int nNumber, Plugin plugin ); 173 174 /** 175 * Load values of record field 176 * 177 * @param lEntryId 178 * List entry to load 179 * @param nIdRecord 180 * The record Id 181 * @param plugin 182 * The plugin 183 * @return list of record 184 */ 185 List<RecordField> selectValuesList( List<Integer> lEntryId, Integer nIdRecord, Plugin plugin ); 186 187 /** 188 * Update the value of a record field 189 * 190 * @param strNewValue 191 * The new value 192 * @param nIdRecordField 193 * The id of the record field to update 194 * @param plugin 195 * The plugin 196 */ 197 void updateValue( String strNewValue, Integer nIdRecordField, Plugin plugin ); 198 199 /** 200 * Load the data of the record field from the table 201 * 202 * @param nIdFile 203 * the filter 204 * @param plugin 205 * the plugin 206 * @return the list of record field 207 */ 208 RecordField loadByFile( int nIdFile, Plugin plugin ); 209 }