// Path: Eru/src/main/java/org/assemblits/eru/exception/ConnectException.java
// public class ConnectException extends java.net.ConnectException {
//     public ConnectException(String localizedMessage) {
//         super(localizedMessage);
//     }
// }


import javafx.beans.property.*;
import org.assemblits.eru.exception.ConnectException;
import javax.persistence.*;
/******************************************************************************
 * Copyright (c) 2017 Assemblits contributors                                 *
 *                                                                            *
 * This file is part of Eru The open JavaFX SCADA by Assemblits Organization. *
 *                                                                            *
 * Eru The open JavaFX SCADA is free software: you can redistribute it        *
 * and/or modify it under the terms of the GNU General Public License         *
 *  as published by the Free Software Foundation, either version 3            *
 *  of the License, or (at your option) any later version.                    *
 *                                                                            *
 * Eru is distributed in the hope that it will be useful,                     *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU General Public License for more details.                               *
 *                                                                            *
 * You should have received a copy of the GNU General Public License          *
 * along with Foobar.  If not, see <http://www.gnu.org/licenses/>.            *
 ******************************************************************************/
package org.assemblits.eru.entities;



@Entity
@Table(name = "connection", schema = "public")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "connection_type", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue(value = "CONNECTION")
public abstract class Connection {

    private IntegerProperty id;
    private StringProperty  name;
    private BooleanProperty enabled;
    private IntegerProperty timeout;
    private IntegerProperty samplingTime;
    private BooleanProperty connected;
    private StringProperty  status;
    private StringProperty  groupName;

    public Connection() {
        this.id             = new SimpleIntegerProperty();
        this.name           = new SimpleStringProperty("");
        this.enabled        = new SimpleBooleanProperty(false);
        this.timeout        = new SimpleIntegerProperty(3000);
        this.samplingTime   = new SimpleIntegerProperty(500);
        this.connected      = new SimpleBooleanProperty(false);
        this.status         = new SimpleStringProperty("");
        this.groupName      = new SimpleStringProperty("");
    }

    @Transient
// Path: Eru/src/main/java/org/assemblits/eru/exception/ConnectException.java
// public class ConnectException extends java.net.ConnectException {
//     public ConnectException(String localizedMessage) {
//         super(localizedMessage);
//     }
// }


// Path: Eru/src/main/java/org/assemblits/eru/entities/Connection.java
import javafx.beans.property.*;
import org.assemblits.eru.exception.ConnectException;
import javax.persistence.*;

/******************************************************************************
 * Copyright (c) 2017 Assemblits contributors                                 *
 *                                                                            *
 * This file is part of Eru The open JavaFX SCADA by Assemblits Organization. *
 *                                                                            *
 * Eru The open JavaFX SCADA is free software: you can redistribute it        *
 * and/or modify it under the terms of the GNU General Public License         *
 *  as published by the Free Software Foundation, either version 3            *
 *  of the License, or (at your option) any later version.                    *
 *                                                                            *
 * Eru is distributed in the hope that it will be useful,                     *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU General Public License for more details.                               *
 *                                                                            *
 * You should have received a copy of the GNU General Public License          *
 * along with Foobar.  If not, see <http://www.gnu.org/licenses/>.            *
 ******************************************************************************/
package org.assemblits.eru.entities;



@Entity
@Table(name = "connection", schema = "public")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "connection_type", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue(value = "CONNECTION")
public abstract class Connection {

    private IntegerProperty id;
    private StringProperty  name;
    private BooleanProperty enabled;
    private IntegerProperty timeout;
    private IntegerProperty samplingTime;
    private BooleanProperty connected;
    private StringProperty  status;
    private StringProperty  groupName;

    public Connection() {
        this.id             = new SimpleIntegerProperty();
        this.name           = new SimpleStringProperty("");
        this.enabled        = new SimpleBooleanProperty(false);
        this.timeout        = new SimpleIntegerProperty(3000);
        this.samplingTime   = new SimpleIntegerProperty(500);
        this.connected      = new SimpleBooleanProperty(false);
        this.status         = new SimpleStringProperty("");
        this.groupName      = new SimpleStringProperty("");
    }

    @Transient
    public abstract void connect() throws ConnectException;