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 /* 35 * IDataDAO.java 36 * 37 * Created on 24 octobre 2008, 15:00 38 * 39 * To change this template, choose Tools | Template Manager 40 * and open the template in the editor. 41 */ 42 package fr.paris.lutece.plugins.adminsql.business; 43 44 import fr.paris.lutece.plugins.adminsql.business.Field; 45 import fr.paris.lutece.portal.service.database.PluginConnectionService; 46 import fr.paris.lutece.portal.service.plugin.Plugin; 47 import fr.paris.lutece.util.ReferenceList; 48 49 import java.sql.SQLException; 50 51 import java.util.List; 52 53 54 /** 55 * Lists all methods which are in DataDAO 56 */ 57 public interface IDataDAO 58 { 59 /** 60 * Selects and loads into the Data object all the data from the database 61 * @param strTableName the name of the table 62 * @param connectionService PluginConnectionService object 63 * @return the list of data 64 */ 65 List<List<String>> selectDataList( String strTableName, PluginConnectionService connectionService ); 66 67 /** 68 * Creates a new instance of IDataDAO 69 * @param strPoolName the name of the pool 70 * @param strUserRequest user request 71 * @param connectionService PluginConnectionService object 72 * @return the list of data from user request 73 */ 74 List<List<String>> selectDataListUserRequest( String strPoolName, String strUserRequest, 75 PluginConnectionService connectionService ); 76 77 /** 78 * Insert into a table of a database 79 * @param strPoolName the name of the pool 80 * @param strTableName the name of the table 81 * @param listData the list of data 82 * @param listFieldsNames the list of field names 83 * @param connectionService PluginConnectionService object 84 */ 85 void insert( String strPoolName, String strTableName, List<String> listData, List<String> listFieldsNames, 86 PluginConnectionService connectionService ); 87 88 /** 89 * Insert into a table of a database with user request 90 * @param strUserRequest user request 91 * @param connectionService PluginConnectionService object 92 * @param strPoolName the name of the pool 93 */ 94 void insertWithUserRequest( String strUserRequest, PluginConnectionService connectionService, String strPoolName ); 95 96 /*List<String> load ( String strPoolName, String strTableName, PluginConnectionService connectionService );*/ 97 /** 98 * Find all data in a table 99 * @param strTableName the name of the table 100 * @param strContatFieldNameAndData the concatenation of the field name and the data 101 * @param listFields the list of the fields 102 * @param connectionService PluginConnectionService object 103 * @return the list of all data in a table 104 */ 105 public List<List<String>> load( String strTableName, String strContatFieldNameAndData, List<Field> listFields, 106 PluginConnectionService connectionService ); 107 108 /** 109 * Find all data from user request 110 * @param strUserRequest user request 111 * @param connectionService PluginConnectionService object 112 * @return list of data from user request 113 */ 114 List<List<String>> findResultOfUserRequest( String strUserRequest, PluginConnectionService connectionService ); 115 116 /** 117 * Find the names of the columns 118 * @param strUserRequest user request 119 * @param connectionService PluginConnectionService object 120 * @param strPoolName the name of the pool 121 * @return all names of the columns 122 */ 123 public List<String> selectColumnNames( String strUserRequest, PluginConnectionService connectionService, 124 String strPoolName ); 125 126 /** 127 * Store the row modified 128 * @param strPoolName the name of the pool 129 * @param strTableName the name of the table 130 * @param listFieldValues list of the fields values 131 * @param connectionService PluginConnectionService object 132 */ 133 void store( String strPoolName, String strTableName, List<FieldValues> listFieldValues, 134 PluginConnectionService connectionService ); 135 136 /** 137 * Delete a row 138 * @param strPoolName the name of the pool 139 * @param strTableName the name of the table 140 * @param listConcatFieldNameAndData the concatenation of the field name and the data 141 * @param connectionService PluginConnectionService object 142 */ 143 void delete( String strPoolName, String strTableName, List<String> listConcatFieldNameAndData, 144 PluginConnectionService connectionService ); 145 }