// Path: app/src/main/java/com/paulds/simpleftp/data/entities/FtpServer.java
// public class FtpServer extends DatabaseEntity {
//     /**
//      * The named used to display the FTP server.
//      */
//     private String name;
// 
//     /**
//      * The FTP server host name.
//      */
//     private String host;
// 
//     /**
//      * A value indicating whether a login/password must be used for FTP connection.
//      */
//     private boolean isAnonymous;
// 
//     /**
//      * The login used for FTP connection.
//      */
//     private String login;
// 
//     /**
//      * The password used for FTP connection.
//      */
//     private String password;
// 
//     /**
//      * The port used for FTP connection.
//      */
//     private int port;
// 
//     /**
//      * Gets the name used to display the FTP server.
//      * @return The server name.
//      */
//     public String getName() {
//         return name;
//     }
// 
//     /**
//      * Sets the name used to display the FTP server.
//      * @param name The server name.
//      */
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     /**
//      * Gets the FTP server host name.
//      * @return The FTP server host name.
//      */
//     public String getHost() {
//         return host;
//     }
// 
//     /**
//      * Sets the FTP server host name.
//      * @param host The FTP server host name.
//      */
//     public void setHost(String host) {
//         this.host = host;
//     }
// 
//     /**
//      * Gets a value indicating whether a login/password must be used for FTP connection.
//      * @return A value indicating whether a login/password must be used for FTP connection.
//      */
//     public boolean isAnonymous() {
//         return isAnonymous;
//     }
// 
//     /**
//      * Sets a value indicating whether a login/password must be used for FTP connection.
//      * param isAnonymous A value indicating whether a login/password must be used for FTP connection.
//      */
//     public void setIsAnonymous(boolean isAnonymous) {
//         this.isAnonymous = isAnonymous;
//     }
// 
//     /**
//      * Gets the login used for FTP connection.
//      * @return The login used for FTP connection.
//      */
//     public String getLogin() {
//         return login;
//     }
// 
//     /**
//      * Sets the login used for FTP connection.
//      * @param login The login used for FTP connection.
//      */
//     public void setLogin(String login) {
//         this.login = login;
//     }
// 
//     /**
//      * Gets the password used for FTP connection.
//      * @return The password used for FTP connection.
//      */
//     public String getPassword() {
//         return password;
//     }
// 
//     /**
//      * Sets the password used for FTP connection.
//      * @param password The password used for FTP connection.
//      */
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     /**
//      * Gets the port used for FTP connection.
//      * @return The port used for FTP connection.
//      */
//     public int getPort() {
//         return port;
//     }
// 
//     /**
//      * Sets the port used for FTP connection.
//      * @param port The port used for FTP connection.
//      */
//     public void setPort(int port) {
//         this.port = port;
//     }
// }
// 
// Path: app/src/main/java/com/paulds/simpleftp/data/helpers/DatabaseHelper.java
// public class DatabaseHelper extends SQLiteOpenHelper  {
//     private static final String DATABASE_NAME = "simpleftp.db";
//     private static final int DATABASE_VERSION = 1;
// 
//     public static final String TABLE_SERVER = "server";
//     public static final String COLUMN_ID = "_id";
//     public static final String COLUMN_NAME = "name";
//     public static final String COLUMN_HOST = "host";
//     public static final String COLUMN_ANONYMOUS = "anonymous";
//     public static final String COLUMN_LOGIN = "login";
//     public static final String COLUMN_PASSWORD = "password";
//     public static final String COLUMN_PORT = "port";
// 
//     // Commande sql pour la création de la base de données
//     private static final String DATABASE_CREATE = "create table " + TABLE_SERVER + "("
//             + COLUMN_ID + " integer primary key autoincrement, "
//             + COLUMN_NAME + " text not null,"
//             + COLUMN_HOST + " text not null,"
//             + COLUMN_ANONYMOUS + " int not null,"
//             + COLUMN_LOGIN + " text null,"
//             + COLUMN_PASSWORD + " text null,"
//             + COLUMN_PORT + " int not null);";
// 
//     public DatabaseHelper(Context context) {
//         super(context, DATABASE_NAME, null, DATABASE_VERSION);
//     }
// 
//     @Override
//     public void onCreate(SQLiteDatabase database) {
//         database.execSQL(DATABASE_CREATE);
//     }
// 
//     @Override
//     public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//         Log.w(DatabaseHelper.class.getName(),
//                 "Upgrading database from version " + oldVersion + " to "
//                         + newVersion + ", which will destroy all old data");
//         db.execSQL("DROP TABLE IF EXISTS " + TABLE_SERVER);
//         onCreate(db);
//     }
// }


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.provider.ContactsContract;
import com.paulds.simpleftp.data.entities.FtpServer;
import com.paulds.simpleftp.data.helpers.DatabaseHelper;
import java.util.ArrayList;
import java.util.List;
package com.paulds.simpleftp.data.repository;




/**
 * This class provide an access to servers object.
 *
 * @author Paul-DS
 */
public class ServerRepository {

    /**
     * The database.
     */
    private SQLiteDatabase database;

    /**
     * The database helper used to access database.
     */
// Path: app/src/main/java/com/paulds/simpleftp/data/entities/FtpServer.java
// public class FtpServer extends DatabaseEntity {
//     /**
//      * The named used to display the FTP server.
//      */
//     private String name;
// 
//     /**
//      * The FTP server host name.
//      */
//     private String host;
// 
//     /**
//      * A value indicating whether a login/password must be used for FTP connection.
//      */
//     private boolean isAnonymous;
// 
//     /**
//      * The login used for FTP connection.
//      */
//     private String login;
// 
//     /**
//      * The password used for FTP connection.
//      */
//     private String password;
// 
//     /**
//      * The port used for FTP connection.
//      */
//     private int port;
// 
//     /**
//      * Gets the name used to display the FTP server.
//      * @return The server name.
//      */
//     public String getName() {
//         return name;
//     }
// 
//     /**
//      * Sets the name used to display the FTP server.
//      * @param name The server name.
//      */
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     /**
//      * Gets the FTP server host name.
//      * @return The FTP server host name.
//      */
//     public String getHost() {
//         return host;
//     }
// 
//     /**
//      * Sets the FTP server host name.
//      * @param host The FTP server host name.
//      */
//     public void setHost(String host) {
//         this.host = host;
//     }
// 
//     /**
//      * Gets a value indicating whether a login/password must be used for FTP connection.
//      * @return A value indicating whether a login/password must be used for FTP connection.
//      */
//     public boolean isAnonymous() {
//         return isAnonymous;
//     }
// 
//     /**
//      * Sets a value indicating whether a login/password must be used for FTP connection.
//      * param isAnonymous A value indicating whether a login/password must be used for FTP connection.
//      */
//     public void setIsAnonymous(boolean isAnonymous) {
//         this.isAnonymous = isAnonymous;
//     }
// 
//     /**
//      * Gets the login used for FTP connection.
//      * @return The login used for FTP connection.
//      */
//     public String getLogin() {
//         return login;
//     }
// 
//     /**
//      * Sets the login used for FTP connection.
//      * @param login The login used for FTP connection.
//      */
//     public void setLogin(String login) {
//         this.login = login;
//     }
// 
//     /**
//      * Gets the password used for FTP connection.
//      * @return The password used for FTP connection.
//      */
//     public String getPassword() {
//         return password;
//     }
// 
//     /**
//      * Sets the password used for FTP connection.
//      * @param password The password used for FTP connection.
//      */
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     /**
//      * Gets the port used for FTP connection.
//      * @return The port used for FTP connection.
//      */
//     public int getPort() {
//         return port;
//     }
// 
//     /**
//      * Sets the port used for FTP connection.
//      * @param port The port used for FTP connection.
//      */
//     public void setPort(int port) {
//         this.port = port;
//     }
// }
// 
// Path: app/src/main/java/com/paulds/simpleftp/data/helpers/DatabaseHelper.java
// public class DatabaseHelper extends SQLiteOpenHelper  {
//     private static final String DATABASE_NAME = "simpleftp.db";
//     private static final int DATABASE_VERSION = 1;
// 
//     public static final String TABLE_SERVER = "server";
//     public static final String COLUMN_ID = "_id";
//     public static final String COLUMN_NAME = "name";
//     public static final String COLUMN_HOST = "host";
//     public static final String COLUMN_ANONYMOUS = "anonymous";
//     public static final String COLUMN_LOGIN = "login";
//     public static final String COLUMN_PASSWORD = "password";
//     public static final String COLUMN_PORT = "port";
// 
//     // Commande sql pour la création de la base de données
//     private static final String DATABASE_CREATE = "create table " + TABLE_SERVER + "("
//             + COLUMN_ID + " integer primary key autoincrement, "
//             + COLUMN_NAME + " text not null,"
//             + COLUMN_HOST + " text not null,"
//             + COLUMN_ANONYMOUS + " int not null,"
//             + COLUMN_LOGIN + " text null,"
//             + COLUMN_PASSWORD + " text null,"
//             + COLUMN_PORT + " int not null);";
// 
//     public DatabaseHelper(Context context) {
//         super(context, DATABASE_NAME, null, DATABASE_VERSION);
//     }
// 
//     @Override
//     public void onCreate(SQLiteDatabase database) {
//         database.execSQL(DATABASE_CREATE);
//     }
// 
//     @Override
//     public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//         Log.w(DatabaseHelper.class.getName(),
//                 "Upgrading database from version " + oldVersion + " to "
//                         + newVersion + ", which will destroy all old data");
//         db.execSQL("DROP TABLE IF EXISTS " + TABLE_SERVER);
//         onCreate(db);
//     }
// }


// Path: app/src/main/java/com/paulds/simpleftp/data/repository/ServerRepository.java
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.provider.ContactsContract;
import com.paulds.simpleftp.data.entities.FtpServer;
import com.paulds.simpleftp.data.helpers.DatabaseHelper;
import java.util.ArrayList;
import java.util.List;

package com.paulds.simpleftp.data.repository;




/**
 * This class provide an access to servers object.
 *
 * @author Paul-DS
 */
public class ServerRepository {

    /**
     * The database.
     */
    private SQLiteDatabase database;

    /**
     * The database helper used to access database.
     */
    private DatabaseHelper dbHelper;