private static ThingBuilder createThingBuilder(ThingType thingType, ThingUID thingUID) { if (thingType instanceof BridgeType) { return BridgeBuilder.create(thingType.getUID(), thingUID); } return ThingBuilder.create(thingType.getUID(), thingUID); }
/** * Maps thing DTO into thing * * @param thingDTO the thingDTO * @param isBridge flag if the thing DTO identifies a bridge * @return the corresponding thing */ public static Thing map(ThingDTO thingDTO, boolean isBridge) { ThingUID thingUID = new ThingUID(thingDTO.UID); ThingTypeUID thingTypeUID = thingDTO.thingTypeUID == null ? new ThingTypeUID("") : new ThingTypeUID(thingDTO.thingTypeUID); final Thing thing; if (isBridge) { thing = BridgeBuilder.create(thingTypeUID, thingUID).build(); } else { thing = ThingBuilder.create(thingTypeUID, thingUID).build(); } return ThingHelper.merge(thing, thingDTO); }
/** * Creates a bridge builder, which allows to modify the bridge. The method * {@link BaseThingHandler#updateThing(Thing)} must be called to persist the changes. * * @return {@link BridgeBuilder} which builds an exact copy of the bridge (not null) */ @Override protected BridgeBuilder editThing() { return BridgeBuilder.create(this.thing.getThingTypeUID(), this.thing.getUID()) .withBridge(this.thing.getBridgeUID()).withChannels(this.thing.getChannels()) .withConfiguration(this.thing.getConfiguration()).withLabel(this.thing.getLabel()) .withLocation(this.thing.getLocation()).withProperties(this.thing.getProperties()); }
ThingBuilder _xifexpression_2 = null; if ((modelThing instanceof ModelBridge)) { _xifexpression_2 = BridgeBuilder.create(thingTypeUID, thingUID); } else { _xifexpression_2 = ThingBuilder.create(thingTypeUID, thingUID);
builder = BridgeBuilder.create(thing.getThingTypeUID(), thing.getUID()); } else { builder = ThingBuilder.create(thing.getThingTypeUID(), thing.getUID());