bunti/src/main/java/de/ctdo/bunti/model/Room.java

104 lines
2.0 KiB
Java

package de.ctdo.bunti.model;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Entity
@Table( name = "rooms" )
public final class Room {
private int id;
private String name;
private String floor;
private int xCord;
private int yCord;
// private List<BuntiDevice> devices = new ArrayList<BuntiDevice>();
@Id
@GeneratedValue(generator="increment")
@GenericGenerator(name="increment", strategy = "increment")
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column( name = "roomName")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getxCord() {
return xCord;
}
public void setxCord(int xCord) {
this.xCord = xCord;
}
public int getyCord() {
return yCord;
}
public void setyCord(int yCord) {
this.yCord = yCord;
}
public String getFloor() {
return floor;
}
public void setFloor(String floor) {
this.floor = floor;
}
// @OneToMany(mappedBy="room")
// public List<BuntiDevice> getDevices() {
// return devices;
// }
//
// public void setDevices(List<BuntiDevice> devices) {
// this.devices = devices;
// }
// @Transient
// public boolean addDevice(BuntiDevice device) {
// return getDevices().add(device);
// }
//
// @Transient
// public boolean removeDevice(BuntiDevice device) {
// return getDevices().remove(device);
// }
//
// @Transient
// public BuntiDevice getDevice(int id) {
// for (BuntiDevice device: getDevices()) {
// if( device.getId() == id) {
// return device;
// }
// }
// return null;
// }
//
// @Transient
// public List<BuntiDevice> getDeviceList() {
// return Collections.unmodifiableList(getDevices());
// }
}