|
19 | 19 | import org.eclipse.jdt.annotation.Nullable;
|
20 | 20 | import org.openhab.binding.smsmodem.internal.handler.SMSConversationHandler;
|
21 | 21 | import org.openhab.binding.smsmodem.internal.handler.SMSModemBridgeHandler;
|
22 |
| -import org.openhab.core.config.core.Configuration; |
23 | 22 | import org.openhab.core.io.transport.serial.SerialPortManager;
|
24 | 23 | import org.openhab.core.thing.Bridge;
|
25 | 24 | import org.openhab.core.thing.Thing;
|
26 | 25 | import org.openhab.core.thing.ThingTypeUID;
|
27 |
| -import org.openhab.core.thing.ThingUID; |
28 | 26 | import org.openhab.core.thing.binding.BaseThingHandlerFactory;
|
29 | 27 | import org.openhab.core.thing.binding.ThingHandler;
|
30 | 28 | import org.openhab.core.thing.binding.ThingHandlerFactory;
|
@@ -75,31 +73,4 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) {
|
75 | 73 |
|
76 | 74 | return null;
|
77 | 75 | }
|
78 |
| - |
79 |
| - @Override |
80 |
| - public @Nullable Thing createThing(ThingTypeUID thingTypeUID, Configuration configuration, |
81 |
| - @Nullable ThingUID thingUID, @Nullable ThingUID bridgeUID) { |
82 |
| - if (SMSModemBridgeHandler.SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) { |
83 |
| - return super.createThing(thingTypeUID, configuration, thingUID, null); |
84 |
| - } |
85 |
| - if (SMSConversationHandler.SUPPORTED_THING_TYPES_UIDS.equals(thingTypeUID)) { |
86 |
| - if (bridgeUID != null) { |
87 |
| - ThingUID safethingUID = thingUID == null |
88 |
| - ? getSMSConversationUID(thingTypeUID, |
89 |
| - (String) configuration |
90 |
| - .get(SMSModemBindingConstants.SMSCONVERSATION_PARAMETER_RECIPIENT), |
91 |
| - bridgeUID) |
92 |
| - : thingUID; |
93 |
| - return super.createThing(thingTypeUID, configuration, safethingUID, bridgeUID); |
94 |
| - } else { |
95 |
| - throw new IllegalArgumentException("Cannot create a SMSConversation without a SMSModem bridge"); |
96 |
| - } |
97 |
| - |
98 |
| - } |
99 |
| - throw new IllegalArgumentException("The thing type " + thingTypeUID + " is not supported by the binding."); |
100 |
| - } |
101 |
| - |
102 |
| - public static ThingUID getSMSConversationUID(ThingTypeUID thingTypeUID, String recipient, ThingUID bridgeUID) { |
103 |
| - return new ThingUID(thingTypeUID, recipient, bridgeUID.getId()); |
104 |
| - } |
105 | 76 | }
|
0 commit comments