diff --git a/src/main/java/de/ctdo/bunti/devices/DeviceMixer.java b/src/main/java/de/ctdo/bunti/devices/DeviceMixer.java deleted file mode 100644 index 71af194..0000000 --- a/src/main/java/de/ctdo/bunti/devices/DeviceMixer.java +++ /dev/null @@ -1,9 +0,0 @@ -package de.ctdo.bunti.devices; - - - -public interface DeviceMixer { - - - -} diff --git a/src/main/java/de/ctdo/bunti/devices/DeviceMixerImpl.java b/src/main/java/de/ctdo/bunti/devices/DeviceMixerImpl.java deleted file mode 100644 index a1345c6..0000000 --- a/src/main/java/de/ctdo/bunti/devices/DeviceMixerImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package de.ctdo.bunti.devices; - -import de.ctdo.bunti.control.DeviceChangedEvent; -import org.springframework.context.ApplicationListener; -import org.springframework.stereotype.Component; - -import de.ctdo.bunti.model.BuntiSwitchingDevice; - - -@Component -public class DeviceMixerImpl implements DeviceMixer, ApplicationListener { - - @Override - public final void onApplicationEvent(DeviceChangedEvent arg0) { - - if( arg0.getDevice() instanceof BuntiSwitchingDevice) { - - BuntiSwitchingDevice switchDev = (BuntiSwitchingDevice)arg0.getDevice(); - switchDev.setValuesFromOptions(arg0.getOptions()); - - } - - } - -} diff --git a/src/main/java/de/ctdo/bunti/model/BuntiSwitchingDevice.java b/src/main/java/de/ctdo/bunti/model/BuntiSwitchingDevice.java deleted file mode 100644 index 293269d..0000000 --- a/src/main/java/de/ctdo/bunti/model/BuntiSwitchingDevice.java +++ /dev/null @@ -1,41 +0,0 @@ -package de.ctdo.bunti.model; - -import javax.persistence.Entity; -import javax.persistence.Transient; -import java.util.Map; - -@Entity -public abstract class BuntiSwitchingDevice extends BuntiDevice { - private static final String OPTION_STATE = "state"; - private boolean state = false; - - public BuntiSwitchingDevice() { - - } - - @Override - public final boolean setValuesFromOptions(Map options) { - - 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; - } - - @Transient - public boolean isState() { - return state; - } - - public void setState(boolean state) { - this.state = state; - } -}