Merge branch 'master' of git.ctdo.de:bunti

This commit is contained in:
Hendrik Fellerhoff 2012-03-21 03:26:21 +01:00
commit e0cd2112ed
3 changed files with 23 additions and 10 deletions

View File

@ -9,14 +9,10 @@ import java.util.List;
public final class RoomsDAOImpl extends HibernateDaoSupport implements RoomsDAO { public final class RoomsDAOImpl extends HibernateDaoSupport implements RoomsDAO {
public RoomsDAOImpl() { public RoomsDAOImpl() {
addDummyRooms();
}
private void addDummyRooms() {
} }
@Override @Override
public List<Room> getRooms() { public List<Room> getRooms() {
return getHibernateTemplate().loadAll(Room.class); return getHibernateTemplate().loadAll(Room.class);

View File

@ -3,17 +3,38 @@ package de.ctdo.bunti.model;
import java.util.Map; import java.util.Map;
public abstract class BuntiSwitchingDevice extends BuntiDevice { public abstract class BuntiSwitchingDevice extends BuntiDevice {
private static final String OPTION_STATE = "state";
private boolean state = false;
public BuntiSwitchingDevice(int deviceId, String deviceName) { public BuntiSwitchingDevice(int deviceId, String deviceName) {
super(deviceId, deviceName); super(deviceId, deviceName);
} }
@Override @Override
public final boolean setValuesFromOptions(Map<String, Object> options) { public final boolean setValuesFromOptions(Map<String, Object> options) {
// TODO Auto-generated method stub
if(options.containsKey(OPTION_STATE)) {
try {
boolean value = Boolean.parseBoolean(options.get(OPTION_STATE).toString());
setState(value);
return true;
} catch (Exception e) {
return false; return false;
} }
} }
return false;
}
public boolean isState() {
return state;
}
public void setState(boolean state) {
this.state = state;
}
}

View File

@ -5,10 +5,6 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
/**
* @author: lucas
* @date: 15.03.12 21:51
*/
public final class Room { public final class Room {
private int id; private int id;