package cz.hsrs.db.model.composite;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

import cz.hsrs.db.DBObject;
import cz.hsrs.db.model.Phenomenon;

/**
 * Sensor generated by hbm2java
 */
public class RealSensor implements DBObject{

	private long sensorId;
	private String sensorName;
	private String sensorType;
	private Phenomenon phenomenon;
	private final Date fromTime;
	private final Date toTime;	
	
	public RealSensor(long sensorId, String sensorName, String sensorType,
			Phenomenon phenomenon) {
		super();
		this.sensorId = sensorId;
		this.sensorName = sensorName;
		this.sensorType = sensorType;
		this.phenomenon = phenomenon;
		this.fromTime = null;
		this.toTime = null;
	}
	
	public RealSensor(long sensorId, String sensorName, String sensorType,
			Phenomenon phenomenon, Date from, Date to) {
		super();
		this.sensorId = sensorId;
		this.sensorName = sensorName;
		this.sensorType = sensorType;
		this.phenomenon = phenomenon;
		this.fromTime = null;
		this.toTime = null;
	}
	
	public RealSensor(ResultSet set) throws SQLException{
		super();		
		this.sensorId = set.getLong("sensor_id");
		this.sensorName = set.getString("sensor_name");
		this.sensorType = set.getString("sensor_type");			
		this.fromTime = set.getDate("fromTime");
		this.toTime = set.getDate("toTime");
	
	}
	
	
	@Override
	public DBObject getDBObject(ResultSet set) throws SQLException {	
		return new RealSensor(set);
	}

	public long getSensorId() {
		return sensorId;
	}
	public void setSensorId(long sensorId) {
		this.sensorId = sensorId;
	}
	public String getSensorName() {
		return sensorName;
	}
	public void setSensorName(String sensorName) {
		this.sensorName = sensorName;
	}
	public String getSensorType() {
		return sensorType;
	}
	public void setSensorType(String sensorType) {
		this.sensorType = sensorType;
	}
	public Phenomenon getPhenomenon() {
		return phenomenon;
	}
	public void setPhenomenon(Phenomenon phenomenon) {
		this.phenomenon = phenomenon;
	}
}
