From f86635fe96c87f240d5fd2235f0f870c9196e308 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Fri, 16 Jun 2023 16:38:03 +0200 Subject: [PATCH] [rest] Add semantic tag registry + API to manage user tags (#3646) * Add semantic tag registry + REST API to manage user tags Related to #3619 New registry for semantic tags. New default semantic tags provider for all built-in semantic tags. New managed provider to add/remove/update user semantic tags. Storage of user semantic tags in a JSON DB file. New REST API to add/remove/update user tags in the semantic model. New REST API to get a sub-tree of the semantic tags. Semantic tag class annotations are removed. Semantic tag classes are now created at runtime. Classes Locations, Equipments, Points and Properties are removed Static methods SemanticTags.add removed The adding of semantic tag classes is now managed only by the tag registry. Avoids calling static method SemanticTags.getById when possible SemanticsMetadataProvider service now requires semanticTagRegistry to start. Signed-off-by: Laurent Garnier --- .../rest/core/internal/item/ItemResource.java | 10 +- .../internal/tag/EnrichedSemanticTagDTO.java | 41 +++ .../io/rest/core/internal/tag/TagDTO.java | 38 --- .../rest/core/internal/tag/TagResource.java | 175 +++++++++- .../model/script/actions/SemanticsTest.java | 38 ++- .../model/generateTagClasses.groovy | 224 +++---------- .../org/openhab/core/semantics/Equipment.java | 1 - .../org/openhab/core/semantics/Location.java | 1 - .../semantics/ManagedSemanticTagProvider.java | 72 ++++ .../org/openhab/core/semantics/Point.java | 1 - .../org/openhab/core/semantics/Property.java | 1 - .../openhab/core/semantics/SemanticTag.java | 71 ++++ .../core/semantics/SemanticTagImpl.java | 133 ++++++++ .../Tilt.java => SemanticTagProvider.java} | 12 +- .../core/semantics/SemanticTagRegistry.java | 80 +++++ .../openhab/core/semantics/SemanticTags.java | 244 +------------- .../core/semantics/SemanticsService.java | 33 ++ .../org/openhab/core/semantics/TagInfo.java | 37 --- .../core/semantics/dto/SemanticTagDTO.java | 31 ++ .../semantics/dto/SemanticTagDTOMapper.java | 60 ++++ .../internal/SemanticTagRegistryImpl.java | 285 ++++++++++++++++ .../internal/SemanticsMetadataProvider.java | 9 +- .../internal/SemanticsServiceImpl.java | 52 ++- .../model/DefaultSemanticTagProvider.java | 311 ++++++++++++++++++ .../model/equipment/AlarmSystem.java | 27 -- .../semantics/model/equipment/BackDoor.java | 26 -- .../semantics/model/equipment/Battery.java | 27 -- .../semantics/model/equipment/Blinds.java | 27 -- .../semantics/model/equipment/Boiler.java | 27 -- .../semantics/model/equipment/Camera.java | 27 -- .../core/semantics/model/equipment/Car.java | 27 -- .../semantics/model/equipment/CeilingFan.java | 26 -- .../semantics/model/equipment/CellarDoor.java | 26 -- .../model/equipment/CleaningRobot.java | 27 -- .../semantics/model/equipment/Dishwasher.java | 26 -- .../core/semantics/model/equipment/Door.java | 27 -- .../semantics/model/equipment/Doorbell.java | 27 -- .../core/semantics/model/equipment/Dryer.java | 26 -- .../semantics/model/equipment/Equipments.java | 96 ------ .../core/semantics/model/equipment/Fan.java | 27 -- .../semantics/model/equipment/Freezer.java | 26 -- .../semantics/model/equipment/FrontDoor.java | 26 -- .../semantics/model/equipment/GarageDoor.java | 26 -- .../core/semantics/model/equipment/Gate.java | 26 -- .../core/semantics/model/equipment/HVAC.java | 27 -- .../semantics/model/equipment/InnerDoor.java | 26 -- .../semantics/model/equipment/Inverter.java | 27 -- .../model/equipment/KitchenHood.java | 26 -- .../semantics/model/equipment/LawnMower.java | 27 -- .../model/equipment/LightStripe.java | 26 -- .../semantics/model/equipment/Lightbulb.java | 27 -- .../core/semantics/model/equipment/Lock.java | 27 -- .../model/equipment/MotionDetector.java | 26 -- .../model/equipment/NetworkAppliance.java | 27 -- .../core/semantics/model/equipment/Oven.java | 26 -- .../model/equipment/PowerOutlet.java | 27 -- .../semantics/model/equipment/Projector.java | 27 -- .../core/semantics/model/equipment/Pump.java | 27 -- .../model/equipment/RadiatorControl.java | 27 -- .../semantics/model/equipment/Receiver.java | 27 -- .../model/equipment/Refrigerator.java | 26 -- .../model/equipment/RemoteControl.java | 27 -- .../semantics/model/equipment/Screen.java | 27 -- .../semantics/model/equipment/Sensor.java | 27 -- .../semantics/model/equipment/SideDoor.java | 26 -- .../core/semantics/model/equipment/Siren.java | 27 -- .../semantics/model/equipment/Smartphone.java | 27 -- .../model/equipment/SmokeDetector.java | 26 -- .../semantics/model/equipment/Speaker.java | 27 -- .../semantics/model/equipment/Television.java | 26 -- .../core/semantics/model/equipment/Valve.java | 27 -- .../model/equipment/VoiceAssistant.java | 27 -- .../semantics/model/equipment/WallSwitch.java | 27 -- .../model/equipment/WashingMachine.java | 26 -- .../model/equipment/WeatherService.java | 26 -- .../semantics/model/equipment/WebService.java | 27 -- .../semantics/model/equipment/WhiteGood.java | 27 -- .../semantics/model/equipment/Window.java | 27 -- .../semantics/model/location/Apartment.java | 26 -- .../core/semantics/model/location/Attic.java | 26 -- .../semantics/model/location/Basement.java | 26 -- .../semantics/model/location/Bathroom.java | 26 -- .../semantics/model/location/Bedroom.java | 26 -- .../semantics/model/location/BoilerRoom.java | 26 -- .../semantics/model/location/Building.java | 26 -- .../semantics/model/location/Carport.java | 26 -- .../core/semantics/model/location/Cellar.java | 26 -- .../semantics/model/location/Corridor.java | 26 -- .../semantics/model/location/DiningRoom.java | 26 -- .../semantics/model/location/Driveway.java | 26 -- .../core/semantics/model/location/Entry.java | 26 -- .../semantics/model/location/FamilyRoom.java | 26 -- .../semantics/model/location/FirstFloor.java | 26 -- .../core/semantics/model/location/Floor.java | 26 -- .../core/semantics/model/location/Garage.java | 26 -- .../core/semantics/model/location/Garden.java | 26 -- .../semantics/model/location/GroundFloor.java | 26 -- .../semantics/model/location/GuestRoom.java | 26 -- .../core/semantics/model/location/House.java | 26 -- .../core/semantics/model/location/Indoor.java | 27 -- .../semantics/model/location/Kitchen.java | 26 -- .../semantics/model/location/LaundryRoom.java | 26 -- .../semantics/model/location/LivingRoom.java | 26 -- .../semantics/model/location/Locations.java | 79 ----- .../core/semantics/model/location/Office.java | 26 -- .../semantics/model/location/Outdoor.java | 27 -- .../core/semantics/model/location/Patio.java | 26 -- .../core/semantics/model/location/Porch.java | 26 -- .../core/semantics/model/location/Room.java | 26 -- .../semantics/model/location/SecondFloor.java | 26 -- .../core/semantics/model/location/Shed.java | 26 -- .../semantics/model/location/SummerHouse.java | 26 -- .../semantics/model/location/Terrace.java | 26 -- .../semantics/model/location/ThirdFloor.java | 26 -- .../semantics/model/location/Veranda.java | 26 -- .../core/semantics/model/point/Alarm.java | 27 -- .../core/semantics/model/point/Control.java | 27 -- .../semantics/model/point/LowBattery.java | 26 -- .../semantics/model/point/Measurement.java | 27 -- .../core/semantics/model/point/OpenLevel.java | 26 -- .../core/semantics/model/point/OpenState.java | 26 -- .../core/semantics/model/point/Points.java | 54 --- .../core/semantics/model/point/Setpoint.java | 27 -- .../core/semantics/model/point/Status.java | 27 -- .../core/semantics/model/point/Switch.java | 26 -- .../core/semantics/model/point/Tampered.java | 26 -- .../core/semantics/model/property/CO.java | 27 -- .../core/semantics/model/property/CO2.java | 27 -- .../model/property/ColorTemperature.java | 27 -- .../semantics/model/property/Current.java | 27 -- .../semantics/model/property/Duration.java | 27 -- .../core/semantics/model/property/Energy.java | 27 -- .../semantics/model/property/Frequency.java | 27 -- .../core/semantics/model/property/Gas.java | 27 -- .../semantics/model/property/Humidity.java | 27 -- .../core/semantics/model/property/Level.java | 27 -- .../core/semantics/model/property/Light.java | 27 -- .../core/semantics/model/property/Noise.java | 27 -- .../core/semantics/model/property/Oil.java | 27 -- .../semantics/model/property/Opening.java | 27 -- .../core/semantics/model/property/Power.java | 27 -- .../semantics/model/property/Presence.java | 27 -- .../semantics/model/property/Pressure.java | 27 -- .../semantics/model/property/Properties.java | 70 ---- .../core/semantics/model/property/Rain.java | 27 -- .../core/semantics/model/property/Smoke.java | 27 -- .../semantics/model/property/SoundVolume.java | 27 -- .../semantics/model/property/Temperature.java | 27 -- .../semantics/model/property/Timestamp.java | 27 -- .../semantics/model/property/Ultraviolet.java | 27 -- .../semantics/model/property/Vibration.java | 27 -- .../semantics/model/property/Voltage.java | 27 -- .../core/semantics/model/property/Water.java | 27 -- .../core/semantics/model/property/Wind.java | 27 -- .../core/semantics/SemanticTagsTest.java | 195 ++++------- .../semantics/SemanticsPredicatesTest.java | 30 +- .../internal/SemanticTagRegistryImplTest.java | 120 +++++++ .../SemanticsMetadataProviderTest.java | 15 +- .../internal/SemanticsServiceImplTest.java | 156 ++++++++- 159 files changed, 1784 insertions(+), 4334 deletions(-) create mode 100644 bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/EnrichedSemanticTagDTO.java delete mode 100644 bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagDTO.java create mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/ManagedSemanticTagProvider.java create mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTag.java create mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagImpl.java rename bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/{model/point/Tilt.java => SemanticTagProvider.java} (59%) create mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagRegistry.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/TagInfo.java create mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/dto/SemanticTagDTO.java create mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/dto/SemanticTagDTOMapper.java create mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticTagRegistryImpl.java create mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/DefaultSemanticTagProvider.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/AlarmSystem.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/BackDoor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Battery.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Blinds.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Boiler.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Camera.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Car.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CeilingFan.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CellarDoor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CleaningRobot.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Dishwasher.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Door.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Doorbell.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Dryer.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Equipments.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Fan.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Freezer.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/FrontDoor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/GarageDoor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Gate.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/HVAC.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/InnerDoor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Inverter.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/KitchenHood.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/LawnMower.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/LightStripe.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Lightbulb.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Lock.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/MotionDetector.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/NetworkAppliance.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Oven.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/PowerOutlet.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Projector.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Pump.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/RadiatorControl.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Receiver.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Refrigerator.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/RemoteControl.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Screen.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Sensor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/SideDoor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Siren.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Smartphone.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/SmokeDetector.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Speaker.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Television.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Valve.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/VoiceAssistant.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WallSwitch.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WashingMachine.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WeatherService.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WebService.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WhiteGood.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Window.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Apartment.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Attic.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Basement.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Bathroom.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Bedroom.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/BoilerRoom.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Building.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Carport.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Cellar.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Corridor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/DiningRoom.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Driveway.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Entry.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/FamilyRoom.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/FirstFloor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Floor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Garage.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Garden.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/GroundFloor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/GuestRoom.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/House.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Indoor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Kitchen.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/LaundryRoom.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/LivingRoom.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Locations.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Office.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Outdoor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Patio.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Porch.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Room.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/SecondFloor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Shed.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/SummerHouse.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Terrace.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/ThirdFloor.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Veranda.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Alarm.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Control.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/LowBattery.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Measurement.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/OpenLevel.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/OpenState.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Points.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Setpoint.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Status.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Switch.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Tampered.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/CO.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/CO2.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/ColorTemperature.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Current.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Duration.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Energy.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Frequency.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Gas.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Humidity.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Level.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Light.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Noise.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Oil.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Opening.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Power.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Presence.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Pressure.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Properties.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Rain.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Smoke.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/SoundVolume.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Temperature.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Timestamp.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Ultraviolet.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Vibration.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Voltage.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Water.java delete mode 100644 bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Wind.java create mode 100644 bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticTagRegistryImplTest.java diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java index 28e1b6e5ef0..59f8e4c465c 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java @@ -88,7 +88,7 @@ import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.RawType; import org.openhab.core.library.types.UpDownType; -import org.openhab.core.semantics.SemanticTags; +import org.openhab.core.semantics.SemanticTagRegistry; import org.openhab.core.semantics.SemanticsPredicates; import org.openhab.core.types.Command; import org.openhab.core.types.State; @@ -182,6 +182,7 @@ private static void respectForwarded(final UriBuilder uriBuilder, final @Context private final ManagedItemProvider managedItemProvider; private final MetadataRegistry metadataRegistry; private final MetadataSelectorMatcher metadataSelectorMatcher; + private final SemanticTagRegistry semanticTagRegistry; private final ItemRegistryChangeListener resetLastModifiedItemChangeListener = new ResetLastModifiedItemChangeListener(); private final RegistryChangeListener resetLastModifiedMetadataChangeListener = new ResetLastModifiedMetadataChangeListener(); @@ -196,7 +197,8 @@ public ItemResource(// final @Reference LocaleService localeService, // final @Reference ManagedItemProvider managedItemProvider, final @Reference MetadataRegistry metadataRegistry, - final @Reference MetadataSelectorMatcher metadataSelectorMatcher) { + final @Reference MetadataSelectorMatcher metadataSelectorMatcher, + final @Reference SemanticTagRegistry semanticTagRegistry) { this.dtoMapper = dtoMapper; this.eventPublisher = eventPublisher; this.itemBuilderFactory = itemBuilderFactory; @@ -205,6 +207,7 @@ public ItemResource(// this.managedItemProvider = managedItemProvider; this.metadataRegistry = metadataRegistry; this.metadataSelectorMatcher = metadataSelectorMatcher; + this.semanticTagRegistry = semanticTagRegistry; this.itemRegistry.addRegistryChangeListener(resetLastModifiedItemChangeListener); this.metadataRegistry.addRegistryChangeListener(resetLastModifiedMetadataChangeListener); @@ -865,7 +868,8 @@ public Response getSemanticItem(final @Context UriInfo uriInfo, final @Context H @PathParam("semanticClass") @Parameter(description = "semantic class") String semanticClassName) { Locale locale = localeService.getLocale(language); - Class semanticClass = SemanticTags.getById(semanticClassName); + Class semanticClass = semanticTagRegistry + .getTagClassById(semanticClassName); if (semanticClass == null) { return Response.status(Status.NOT_FOUND).build(); } diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/EnrichedSemanticTagDTO.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/EnrichedSemanticTagDTO.java new file mode 100644 index 00000000000..f19d33f6802 --- /dev/null +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/EnrichedSemanticTagDTO.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.io.rest.core.internal.tag; + +import java.util.List; + +import org.openhab.core.semantics.SemanticTag; + +/** + * A DTO representing a {@link SemanticTag}. + * + * @author Jimmy Tanagra - initial contribution + * @author Laurent Garnier - Class renamed and members uid, description and editable added + */ +public class EnrichedSemanticTagDTO { + String uid; + String name; + String label; + String description; + List synonyms; + boolean editable; + + public EnrichedSemanticTagDTO(SemanticTag tag, boolean editable) { + this.uid = tag.getUID(); + this.name = tag.getUID().substring(tag.getUID().lastIndexOf("_") + 1); + this.label = tag.getLabel(); + this.description = tag.getDescription(); + this.synonyms = tag.getSynonyms(); + this.editable = editable; + } +} diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagDTO.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagDTO.java deleted file mode 100644 index 37d68f17cec..00000000000 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagDTO.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.io.rest.core.internal.tag; - -import java.util.List; -import java.util.Locale; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.SemanticTags; -import org.openhab.core.semantics.Tag; - -/** - * A DTO representing a Semantic {@link Tag}. - * - * @author Jimmy Tanagra - initial contribution - */ -@NonNullByDefault -public class TagDTO { - String name; - String label; - List synonyms; - - public TagDTO(Class tag, Locale locale) { - this.name = tag.getSimpleName(); - this.label = SemanticTags.getLabel(tag, locale); - this.synonyms = SemanticTags.getSynonyms(tag, locale); - } -} diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java index be55ca2d26c..b3d954f3d3c 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/tag/TagResource.java @@ -12,14 +12,19 @@ */ package org.openhab.core.io.rest.core.internal.tag; +import java.util.Comparator; import java.util.List; import java.util.Locale; -import java.util.Map; import javax.annotation.security.RolesAllowed; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; @@ -35,10 +40,10 @@ import org.openhab.core.io.rest.LocaleService; import org.openhab.core.io.rest.RESTConstants; import org.openhab.core.io.rest.RESTResource; -import org.openhab.core.semantics.model.equipment.Equipments; -import org.openhab.core.semantics.model.location.Locations; -import org.openhab.core.semantics.model.point.Points; -import org.openhab.core.semantics.model.property.Properties; +import org.openhab.core.semantics.ManagedSemanticTagProvider; +import org.openhab.core.semantics.SemanticTag; +import org.openhab.core.semantics.SemanticTagImpl; +import org.openhab.core.semantics.SemanticTagRegistry; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; @@ -54,11 +59,13 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; /** * This class acts as a REST resource for retrieving a list of tags. * * @author Jimmy Tanagra - Initial contribution + * @author Laurent Garnier - Extend REST API to allow adding/updating/removing user tags */ @Component @JaxrsResource @@ -74,28 +81,166 @@ public class TagResource implements RESTResource { public static final String PATH_TAGS = "tags"; private final LocaleService localeService; + private final SemanticTagRegistry semanticTagRegistry; + private final ManagedSemanticTagProvider managedSemanticTagProvider; + + // TODO pattern in @Path @Activate - public TagResource(final @Reference LocaleService localeService) { + public TagResource(final @Reference LocaleService localeService, + final @Reference SemanticTagRegistry semanticTagRegistry, + final @Reference ManagedSemanticTagProvider managedSemanticTagProvider) { this.localeService = localeService; + this.semanticTagRegistry = semanticTagRegistry; + this.managedSemanticTagProvider = managedSemanticTagProvider; } @GET @RolesAllowed({ Role.USER, Role.ADMIN }) @Produces(MediaType.APPLICATION_JSON) - @Operation(operationId = "getTags", summary = "Get all available tags.", responses = { - @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = TagDTO.class)))) }) + @Operation(operationId = "getSemanticTags", summary = "Get all available semantic tags.", responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = EnrichedSemanticTagDTO.class)))) }) public Response getTags(final @Context UriInfo uriInfo, final @Context HttpHeaders httpHeaders, @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language) { final Locale locale = localeService.getLocale(language); - Map> tags = Map.of( // - Locations.class.getSimpleName(), Locations.stream().map(tag -> new TagDTO(tag, locale)).toList(), // - Equipments.class.getSimpleName(), Equipments.stream().map(tag -> new TagDTO(tag, locale)).toList(), // - Points.class.getSimpleName(), Points.stream().map(tag -> new TagDTO(tag, locale)).toList(), // - Properties.class.getSimpleName(), Properties.stream().map(tag -> new TagDTO(tag, locale)).toList() // - ); + List tagsDTO = semanticTagRegistry.getAll().stream() + .sorted(Comparator.comparing(SemanticTag::getUID)) + .map(t -> new EnrichedSemanticTagDTO(t.localized(locale), semanticTagRegistry.isEditable(t))).toList(); + return JSONResponse.createResponse(Status.OK, tagsDTO, null); + } + + @GET + @RolesAllowed({ Role.USER, Role.ADMIN }) + @Path("/{tagId}") + @Produces(MediaType.APPLICATION_JSON) + @Operation(operationId = "getSemanticTagAndSubTags", summary = "Gets a semantic tag and its sub tags.", responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = EnrichedSemanticTagDTO.class)))), + @ApiResponse(responseCode = "404", description = "Semantic tag not found.") }) + public Response getTagAndSubTags( + @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language, + @PathParam("tagId") @Parameter(description = "tag id") String tagId) { + final Locale locale = localeService.getLocale(language); + String uid = tagId.trim(); + + SemanticTag tag = semanticTagRegistry.get(uid); + if (tag != null) { + List tagsDTO = semanticTagRegistry.getSubTree(tag).stream() + .sorted(Comparator.comparing(SemanticTag::getUID)) + .map(t -> new EnrichedSemanticTagDTO(t.localized(locale), semanticTagRegistry.isEditable(t))) + .toList(); + return JSONResponse.createResponse(Status.OK, tagsDTO, null); + } else { + return JSONResponse.createErrorResponse(Status.NOT_FOUND, "Tag " + uid + " does not exist!"); + } + } + + @POST + @RolesAllowed({ Role.ADMIN }) + @Consumes(MediaType.APPLICATION_JSON) + @Operation(operationId = "createSemanticTag", summary = "Creates a new semantic tag and adds it to the registry.", security = { + @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { + @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = EnrichedSemanticTagDTO.class))), + @ApiResponse(responseCode = "400", description = "The tag identifier is invalid."), + @ApiResponse(responseCode = "409", description = "A tag with the same identifier already exists.") }) + public Response create( + @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language, + @Parameter(description = "tag data", required = true) EnrichedSemanticTagDTO data) { + final Locale locale = localeService.getLocale(language); + + if (data.uid == null) { + return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Tag identifier is required!"); + } + + String uid = data.uid.trim(); + + // check if a tag with this UID already exists + SemanticTag tag = semanticTagRegistry.get(uid); + if (tag != null) { + // report a conflict + return JSONResponse.createResponse(Status.CONFLICT, + new EnrichedSemanticTagDTO(tag.localized(locale), semanticTagRegistry.isEditable(tag)), + "Tag " + uid + " already exists!"); + } + + tag = new SemanticTagImpl(uid, data.label, data.description, data.synonyms); + + // Check that a tag with this uid can be added to the registry + if (!semanticTagRegistry.canBeAdded(tag)) { + return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Invalid tag identifier " + uid); + } + + managedSemanticTagProvider.add(tag); + + return JSONResponse.createResponse(Status.CREATED, + new EnrichedSemanticTagDTO(tag.localized(locale), semanticTagRegistry.isEditable(tag)), null); + } + + @DELETE + @RolesAllowed({ Role.ADMIN }) + @Path("/{tagId}") + @Operation(operationId = "removeSemanticTag", summary = "Removes a semantic tag and its sub tags from the registry.", security = { + @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { + @ApiResponse(responseCode = "200", description = "OK, was deleted."), + @ApiResponse(responseCode = "404", description = "Semantic tag not found."), + @ApiResponse(responseCode = "405", description = "Semantic tag not removable.") }) + public Response remove( + @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language, + @PathParam("tagId") @Parameter(description = "tag id") String tagId) { + final Locale locale = localeService.getLocale(language); + + String uid = tagId.trim(); + + // check whether tag exists and throw 404 if not + SemanticTag tag = semanticTagRegistry.get(uid); + if (tag == null) { + return JSONResponse.createErrorResponse(Status.NOT_FOUND, "Tag " + uid + " does not exist!"); + } + + // Check that tag is removable, 405 otherwise + if (!semanticTagRegistry.isEditable(tag)) { + return JSONResponse.createErrorResponse(Status.METHOD_NOT_ALLOWED, "Tag " + uid + " is not removable."); + } + + semanticTagRegistry.removeSubTree(tag); + + return Response.ok(null, MediaType.TEXT_PLAIN).build(); + } + + @PUT + @RolesAllowed({ Role.ADMIN }) + @Path("/{tagId}") + @Consumes(MediaType.APPLICATION_JSON) + @Operation(operationId = "updateSemanticTag", summary = "Updates a semantic tag.", security = { + @SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = EnrichedSemanticTagDTO.class))), + @ApiResponse(responseCode = "404", description = "Semantic tag not found."), + @ApiResponse(responseCode = "405", description = "Semantic tag not editable.") }) + public Response update( + @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language, + @PathParam("tagId") @Parameter(description = "tag id") String tagId, + @Parameter(description = "tag data", required = true) EnrichedSemanticTagDTO data) { + final Locale locale = localeService.getLocale(language); + + String uid = tagId.trim(); + + // check whether tag exists and throw 404 if not + SemanticTag tag = semanticTagRegistry.get(uid); + if (tag == null) { + return JSONResponse.createErrorResponse(Status.NOT_FOUND, "Tag " + uid + " does not exist!"); + } + + // Check that tag is editable, 405 otherwise + if (!semanticTagRegistry.isEditable(tag)) { + return JSONResponse.createErrorResponse(Status.METHOD_NOT_ALLOWED, "Tag " + uid + " is not editable."); + } + + tag = new SemanticTagImpl(uid, data.label != null ? data.label : tag.getLabel(), + data.description != null ? data.description : tag.getDescription(), + data.synonyms != null ? data.synonyms : tag.getSynonyms()); + managedSemanticTagProvider.update(tag); - return JSONResponse.createResponse(Status.OK, tags, null); + return JSONResponse.createResponse(Status.OK, + new EnrichedSemanticTagDTO(tag.localized(locale), semanticTagRegistry.isEditable(tag)), null); } } diff --git a/bundles/org.openhab.core.model.script/src.moved/test/java/org/openhab/core/model/script/actions/SemanticsTest.java b/bundles/org.openhab.core.model.script/src.moved/test/java/org/openhab/core/model/script/actions/SemanticsTest.java index cfd575d6fa6..be07ec03be5 100644 --- a/bundles/org.openhab.core.model.script/src.moved/test/java/org/openhab/core/model/script/actions/SemanticsTest.java +++ b/bundles/org.openhab.core.model.script/src.moved/test/java/org/openhab/core/model/script/actions/SemanticsTest.java @@ -12,12 +12,13 @@ */ package org.openhab.core.model.script.actions; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.Mockito.when; +import java.util.List; + import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -33,10 +34,10 @@ import org.openhab.core.items.ItemRegistry; import org.openhab.core.library.CoreItemFactory; import org.openhab.core.model.script.internal.engine.action.SemanticsActionService; -import org.openhab.core.semantics.model.equipment.Battery; -import org.openhab.core.semantics.model.equipment.CleaningRobot; -import org.openhab.core.semantics.model.location.Bathroom; -import org.openhab.core.semantics.model.location.Indoor; +import org.openhab.core.semantics.ManagedSemanticTagProvider; +import org.openhab.core.semantics.Tag; +import org.openhab.core.semantics.internal.SemanticTagRegistryImpl; +import org.openhab.core.semantics.model.DefaultSemanticTagProvider; /** * This are tests for {@link Semantics} actions. @@ -50,6 +51,7 @@ public class SemanticsTest { private @Mock @NonNullByDefault({}) ItemRegistry itemRegistryMock; private @Mock @NonNullByDefault({}) UnitProvider unitProviderMock; + private @Mock @NonNullByDefault({}) ManagedSemanticTagProvider managedSemanticTagProviderMock; private @NonNullByDefault({}) GroupItem indoorLocationItem; private @NonNullByDefault({}) GroupItem bathroomLocationItem; @@ -58,6 +60,11 @@ public class SemanticsTest { private @NonNullByDefault({}) GenericItem humidityPointItem; private @NonNullByDefault({}) GenericItem subEquipmentItem; + private @NonNullByDefault({}) Class indoorTagClass; + private @NonNullByDefault({}) Class bathroomTagClass; + private @NonNullByDefault({}) Class cleaningRobotTagClass; + private @NonNullByDefault({}) Class batteryTagClass; + @BeforeEach public void setup() throws ItemNotFoundException { CoreItemFactory itemFactory = new CoreItemFactory(unitProviderMock); @@ -98,6 +105,15 @@ public void setup() throws ItemNotFoundException { equipmentItem.addMember(subEquipmentItem); subEquipmentItem.addGroupName(equipmentItem.getName()); + when(managedSemanticTagProviderMock.getAll()).thenReturn(List.of()); + SemanticTagRegistryImpl semanticTagRegistryImpl = new SemanticTagRegistryImpl(new DefaultSemanticTagProvider(), + managedSemanticTagProviderMock); + + indoorTagClass = semanticTagRegistryImpl.getTagClassById("Location_Indoor"); + bathroomTagClass = semanticTagRegistryImpl.getTagClassById("Location_Indoor_Room_Bathroom"); + cleaningRobotTagClass = semanticTagRegistryImpl.getTagClassById("Equipment_CleaningRobot"); + batteryTagClass = semanticTagRegistryImpl.getTagClassById("Equipment_Battery"); + when(itemRegistryMock.getItem("TestHouse")).thenReturn(indoorLocationItem); when(itemRegistryMock.getItem("TestBathRoom")).thenReturn(bathroomLocationItem); when(itemRegistryMock.getItem("Test08")).thenReturn(equipmentItem); @@ -122,9 +138,9 @@ public void testGetLocation() { @Test public void testGetLocationType() { - assertThat(Semantics.getLocationType(indoorLocationItem), is(Indoor.class)); + assertThat(Semantics.getLocationType(indoorLocationItem), is(indoorTagClass)); - assertThat(Semantics.getLocationType(bathroomLocationItem), is(Bathroom.class)); + assertThat(Semantics.getLocationType(bathroomLocationItem), is(bathroomTagClass)); assertNull(Semantics.getLocationType(humidityPointItem)); } @@ -142,11 +158,11 @@ public void testGetEquipment() { @Test public void testGetEquipmentType() { - assertThat(Semantics.getEquipmentType(equipmentItem), is(CleaningRobot.class)); + assertThat(Semantics.getEquipmentType(equipmentItem), is(cleaningRobotTagClass)); - assertThat(Semantics.getEquipmentType(temperaturePointItem), is(CleaningRobot.class)); + assertThat(Semantics.getEquipmentType(temperaturePointItem), is(cleaningRobotTagClass)); - assertThat(Semantics.getEquipmentType(subEquipmentItem), is(Battery.class)); + assertThat(Semantics.getEquipmentType(subEquipmentItem), is(batteryTagClass)); assertNull(Semantics.getEquipmentType(humidityPointItem)); } diff --git a/bundles/org.openhab.core.semantics/model/generateTagClasses.groovy b/bundles/org.openhab.core.semantics/model/generateTagClasses.groovy index 20f9cb58e79..0012ff6be0b 100755 --- a/bundles/org.openhab.core.semantics/model/generateTagClasses.groovy +++ b/bundles/org.openhab.core.semantics/model/generateTagClasses.groovy @@ -22,10 +22,6 @@ baseDir = Paths.get(getClass().protectionDomain.codeSource.location.toURI()).get header = header() def tagSets = new TreeMap() -def locations = new TreeSet() -def equipments = new TreeSet() -def points = new TreeSet() -def properties = new TreeSet() def labelsFile = new FileWriter("${baseDir}/src/main/resources/tags.properties") labelsFile.write("# Generated content - do not edit!\n") @@ -36,63 +32,26 @@ for (line in parseCsv(new FileReader("${baseDir}/model/SemanticTags.csv"), separ def tagSet = (line.Parent ? tagSets.get(line.Parent) : line.Type) + "_" + line.Tag tagSets.put(line.Tag,tagSet) - createTagSetClass(line, tagSet) appendLabelsFile(labelsFile, line, tagSet) switch(line.Type) { - case "Location" : locations.add(line.Tag); break; - case "Equipment" : equipments.add(line.Tag); break; - case "Point" : points.add(line.Tag); break; - case "Property" : properties.add(line.Tag); break; + case "Location" : break; + case "Equipment" : break; + case "Point" : break; + case "Property" : break; default : println "Unrecognized type " + line.Type } } labelsFile.close() -createLocationsFile(locations) -createEquipmentsFile(equipments) -createPointsFile(points) -createPropertiesFile(properties) +createDefaultProviderFile(tagSets) println "\n\nTagSets:" for (String tagSet : tagSets) { println tagSet } -def createTagSetClass(def line, String tagSet) { - def tag = line.Tag - def type = line.Type - def label = line.Label - def synonyms = line.Synonyms - def desc = line.Description - def parent = line.Parent - def parentClass = parent ? parent : type - def pkg = type.toLowerCase() - def ch = label.toLowerCase().charAt(0) - def article = ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' ? "an" : "a" - def file = new FileWriter("${baseDir}/src/main/java/org/openhab/core/semantics/model/${pkg}/${tag}.java") - file.write(header) - file.write("package org.openhab.core.semantics.model." + pkg + ";\n\n") - file.write("import org.eclipse.jdt.annotation.NonNullByDefault;\n") - if (!parent) { - file.write("import org.openhab.core.semantics." + type + ";\n") - } - file.write("""import org.openhab.core.semantics.TagInfo; - -/** - * This class defines ${article} ${label}. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "${tagSet}", label = "${label}", synonyms = "${synonyms}", description = "${desc}") -public interface ${tag} extends ${parentClass} { -} -""") - file.close() -} - def appendLabelsFile(FileWriter file, def line, String tagSet) { file.write(tagSet + "=" + line.Label) if (line.Synonyms) { @@ -101,168 +60,59 @@ def appendLabelsFile(FileWriter file, def line, String tagSet) { file.write("\n") } -def createLocationsFile(Set locations) { - def file = new FileWriter("${baseDir}/src/main/java/org/openhab/core/semantics/model/location/Locations.java") +def createDefaultProviderFile(def tagSets) { + def file = new FileWriter("${baseDir}/src/main/java/org/openhab/core/semantics/model/DefaultSemanticTagProvider.java") file.write(header) - file.write("""package org.openhab.core.semantics.model.location; + file.write("""package org.openhab.core.semantics.model; -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Stream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Location; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.semantics.SemanticTag; +import org.openhab.core.semantics.SemanticTagImpl; +import org.openhab.core.semantics.SemanticTagProvider; +import org.osgi.service.component.annotations.Component; /** - * This class provides a stream of all defined locations. + * This class defines a provider of all default semantic tags. * * @author Generated from generateTagClasses.groovy - Initial contribution */ @NonNullByDefault -public class Locations { +@Component(immediate = true, service = { SemanticTagProvider.class, DefaultSemanticTagProvider.class }) +public class DefaultSemanticTagProvider implements SemanticTagProvider { - static final Set> LOCATIONS = new HashSet<>(); + private List defaultTags; - static { - LOCATIONS.add(Location.class); + public DefaultSemanticTagProvider() { + this.defaultTags = new ArrayList<>(); + defaultTags.add(new SemanticTagImpl("Equipment", "", "", "")); + defaultTags.add(new SemanticTagImpl("Location", "", "", "")); + defaultTags.add(new SemanticTagImpl("Point", "", "", "")); + defaultTags.add(new SemanticTagImpl("Property", "", "", "")); """) - for (String location : locations) { - file.write(" LOCATIONS.add(${location}.class);\n") - } - file.write(""" } - - public static Stream> stream() { - return LOCATIONS.stream(); - } - - public static boolean add(Class tag) { - return LOCATIONS.add(tag); - } -} -""") - file.close() -} - -def createEquipmentsFile(Set equipments) { - def file = new FileWriter("${baseDir}/src/main/java/org/openhab/core/semantics/model/equipment/Equipments.java") - file.write(header) - file.write("""package org.openhab.core.semantics.model.equipment; - -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Stream; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; - -/** - * This class provides a stream of all defined equipments. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -public class Equipments { - - static final Set> EQUIPMENTS = new HashSet<>(); - - static { - EQUIPMENTS.add(Equipment.class); -""") - for (String equipment : equipments) { - file.write(" EQUIPMENTS.add(${equipment}.class);\n") - } - file.write(""" } - - public static Stream> stream() { - return EQUIPMENTS.stream(); - } - - public static boolean add(Class tag) { - return EQUIPMENTS.add(tag); - } -} + for (line in parseCsv(new FileReader("${baseDir}/model/SemanticTags.csv"), separator: ',')) { + def tagId = (line.Parent ? tagSets.get(line.Parent) : line.Type) + "_" + line.Tag + file.write(""" defaultTags.add(new SemanticTagImpl("${tagId}", // + "${line.Label}", "${line.Description}", "${line.Synonyms}")); """) - file.close() -} - -def createPointsFile(Set points) { - def file = new FileWriter("${baseDir}/src/main/java/org/openhab/core/semantics/model/point/Points.java") - file.write(header) - file.write("""package org.openhab.core.semantics.model.point; - -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Stream; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Point; - -/** - * This class provides a stream of all defined points. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -public class Points { - - static final Set> POINTS = new HashSet<>(); - - static { - POINTS.add(Point.class); -""") - for (String point : points) { - file.write(" POINTS.add(${point}.class);\n") } file.write(""" } - public static Stream> stream() { - return POINTS.stream(); - } - - public static boolean add(Class tag) { - return POINTS.add(tag); + @Override + public Collection getAll() { + return defaultTags; } -} -""") - file.close() -} - -def createPropertiesFile(Set properties) { - def file = new FileWriter("${baseDir}/src/main/java/org/openhab/core/semantics/model/property/Properties.java") - file.write(header) - file.write("""package org.openhab.core.semantics.model.property; - -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Stream; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; - -/** - * This class provides a stream of all defined properties. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -public class Properties { - - static final Set> PROPERTIES = new HashSet<>(); - - static { - PROPERTIES.add(Property.class); -""") - for (String property : properties) { - file.write(" PROPERTIES.add(${property}.class);\n") - } - file.write(""" } - public static Stream> stream() { - return PROPERTIES.stream(); + @Override + public void addProviderChangeListener(ProviderChangeListener listener) { } - public static boolean add(Class tag) { - return PROPERTIES.add(tag); + @Override + public void removeProviderChangeListener(ProviderChangeListener listener) { } } """) diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Equipment.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Equipment.java index f3de8702dc0..096093cfa31 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Equipment.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Equipment.java @@ -22,7 +22,6 @@ * @author Kai Kreuzer - Initial contribution */ @NonNullByDefault -@TagInfo(id = "Equipment") public interface Equipment extends Tag { @Nullable diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Location.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Location.java index cc4497205e1..cc5a890dfb3 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Location.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Location.java @@ -22,7 +22,6 @@ * @author Kai Kreuzer - Initial contribution */ @NonNullByDefault -@TagInfo(id = "Location") public interface Location extends Tag { static String name() { diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/ManagedSemanticTagProvider.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/ManagedSemanticTagProvider.java new file mode 100644 index 00000000000..fbb7be82559 --- /dev/null +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/ManagedSemanticTagProvider.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.semantics; + +import java.util.Collection; +import java.util.Comparator; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.common.registry.AbstractManagedProvider; +import org.openhab.core.semantics.dto.SemanticTagDTO; +import org.openhab.core.semantics.dto.SemanticTagDTOMapper; +import org.openhab.core.storage.StorageService; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; + +/** + * {@link ManagedSemanticTagProvider} is an OSGi service, that allows to add or remove + * semantic tags at runtime by calling {@link ManagedSemanticTagProvider#add(SemanticTag)} + * or {@link ManagedSemanticTagProvider#remove(String)}. + * An added semantic tag is automatically exposed to the {@link SemanticTagRegistry}. + * Persistence of added semantic tags is handled by a {@link StorageService}. + * + * @author Laurent Garnier - Initial contribution + */ +@NonNullByDefault +@Component(immediate = true, service = { SemanticTagProvider.class, ManagedSemanticTagProvider.class }) +public class ManagedSemanticTagProvider extends AbstractManagedProvider + implements SemanticTagProvider { + + @Activate + public ManagedSemanticTagProvider(final @Reference StorageService storageService) { + super(storageService); + } + + @Override + protected String getStorageName() { + return SemanticTag.class.getName(); + } + + @Override + protected String keyToString(String key) { + return key; + } + + @Override + public Collection getAll() { + // Sort tags by uid to be sure that tag classes will be created in the right order + return super.getAll().stream().sorted(Comparator.comparing(SemanticTag::getUID)).toList(); + } + + @Override + protected @Nullable SemanticTag toElement(String uid, SemanticTagDTO persistedTag) { + return SemanticTagDTOMapper.map(persistedTag); + } + + @Override + protected SemanticTagDTO toPersistableElement(SemanticTag tag) { + return SemanticTagDTOMapper.map(tag); + } +} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Point.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Point.java index a707ae9976d..8971feb32ce 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Point.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Point.java @@ -22,7 +22,6 @@ * @author Kai Kreuzer - Initial contribution */ @NonNullByDefault -@TagInfo(id = "Point") public interface Point extends Tag { @Nullable diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Property.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Property.java index b2a003023a7..d119925c14d 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Property.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/Property.java @@ -20,6 +20,5 @@ * @author Kai Kreuzer - Initial contribution */ @NonNullByDefault -@TagInfo(id = "Property") public interface Property extends Tag { } diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTag.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTag.java new file mode 100644 index 00000000000..d1782911521 --- /dev/null +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTag.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.semantics; + +import java.util.List; +import java.util.Locale; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.common.registry.Identifiable; + +/** + * This interface defines the core features of an openHAB semantic tag. + * + * @author Laurent Garnier - Initial contribution + */ +@NonNullByDefault +public interface SemanticTag extends Identifiable { + + /** + * Returns the name of the semantic tag. + * + * @return the name of the semantic tag + */ + String getName(); + + /** + * Returns the UID of the parent tag. + * + * @return the UID of the parent tag + */ + String getParentUID(); + + /** + * Returns the label of the semantic tag. + * + * @return semantic tag label or an empty string if undefined + */ + String getLabel(); + + /** + * Returns the description of the semantic tag. + * + * @return semantic tag description or an empty string if undefined + */ + String getDescription(); + + /** + * Returns the synonyms of the semantic tag. + * + * @return semantic tag synonyms as a List + */ + List getSynonyms(); + + /** + * Returns the localized semantic tag. + * + * @param locale the locale to be used + * @return the localized semantic tag + */ + SemanticTag localized(Locale locale); +} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagImpl.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagImpl.java new file mode 100644 index 00000000000..37c7cd0381d --- /dev/null +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagImpl.java @@ -0,0 +1,133 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.semantics; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.ResourceBundle.Control; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; + +/** + * This is the main implementing class of the {@link SemanticTag} interface. + * + * @author Laurent Garnier - Initial contribution + */ +@NonNullByDefault +public class SemanticTagImpl implements SemanticTag { + + private static final String TAGS_BUNDLE_NAME = "tags"; + + private String uid; + private String name; + private String parent; + private String label; + private String description; + private List synonyms; + + public SemanticTagImpl(String uid, @Nullable String label, @Nullable String description, + @Nullable List synonyms) { + this(uid, label, description); + if (synonyms != null) { + this.synonyms = new ArrayList<>(); + for (String synonym : synonyms) { + this.synonyms.add(synonym.trim()); + } + } + } + + public SemanticTagImpl(String uid, @Nullable String label, @Nullable String description, + @Nullable String synonyms) { + this(uid, label, description); + if (synonyms != null && !synonyms.isBlank()) { + this.synonyms = new ArrayList<>(); + for (String synonym : synonyms.split(",")) { + this.synonyms.add(synonym.trim()); + } + } + } + + private SemanticTagImpl(String uid, @Nullable String label, @Nullable String description) { + this.uid = uid; + int idx = uid.lastIndexOf("_"); + if (idx < 0) { + this.name = uid.trim(); + this.parent = ""; + } else { + this.name = uid.substring(idx + 1).trim(); + this.parent = uid.substring(0, idx).trim(); + } + this.label = label == null ? "" : label.trim(); + this.description = description == null ? "" : description.trim(); + this.synonyms = List.of(); + } + + @Override + public String getUID() { + return uid; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getParentUID() { + return parent; + } + + @Override + public String getLabel() { + return label; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public List getSynonyms() { + return synonyms; + } + + @Override + public SemanticTag localized(Locale locale) { + ResourceBundle rb = ResourceBundle.getBundle(TAGS_BUNDLE_NAME, locale, + Control.getNoFallbackControl(Control.FORMAT_PROPERTIES)); + String label; + List synonyms; + try { + String entry = rb.getString(uid); + int idx = entry.indexOf(","); + if (idx >= 0) { + label = entry.substring(0, idx); + String synonymsCsv = entry.substring(idx + 1); + synonyms = synonymsCsv.isBlank() ? null : List.of(synonymsCsv.split(",")); + } else { + label = entry; + synonyms = null; + } + } catch (MissingResourceException e) { + label = getLabel(); + synonyms = getSynonyms(); + } + + return new SemanticTagImpl(uid, label, getDescription(), synonyms); + } +} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Tilt.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagProvider.java similarity index 59% rename from bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Tilt.java rename to bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagProvider.java index 23a86709233..3d4c0a5a14f 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Tilt.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagProvider.java @@ -10,17 +10,17 @@ * * SPDX-License-Identifier: EPL-2.0 */ -package org.openhab.core.semantics.model.point; +package org.openhab.core.semantics; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; +import org.openhab.core.common.registry.Provider; /** - * This class defines a Tilt. + * The {@link SemanticTagProvider} is responsible for providing semantic tags. * - * @author Generated from generateTagClasses.groovy - Initial contribution + * @author Laurent Garnier - Initial contribution */ @NonNullByDefault -@TagInfo(id = "Point_Status_Tilt", label = "Tilt", synonyms = "", description = "") -public interface Tilt extends Status { +public interface SemanticTagProvider extends Provider { + } diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagRegistry.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagRegistry.java new file mode 100644 index 00000000000..7c84ab65c2c --- /dev/null +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTagRegistry.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.semantics; + +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.common.registry.Registry; + +/** + * {@link SemanticTagRegistry} tracks all {@link SemanticTag}s from different {@link SemanticTagProvider}s + * and provides access to them. + * + * @author Laurent Garnier - Initial contribution + */ +@NonNullByDefault +public interface SemanticTagRegistry extends Registry { + + /** + * Retrieves the class for a given id. + * + * @param tagId the id of the tag. The id can be fully qualified (e.g. "Location_Room_Bedroom") or a segment, if + * this uniquely identifies the tag + * (e.g. "Bedroom"). + * @return the class for the id or null, if non exists. + */ + @Nullable + Class getTagClassById(String tagId); + + /** + * Checks if a tag with a given id can be added to the registry. + * + * To be added, no tag with this id must already exist in the registry, the tag name extracted from this id + * must have a valid syntax, the parent tag extracted from this id must already exists in the registry and + * should be either a default semantic tag or a managed semantic tag, and no tag with a same name must already + * exist in the registry. + * + * @param tag a tag to be added to the registry + * @return true if the tag can be added, false if not + */ + boolean canBeAdded(SemanticTag tag); + + /** + * Returns the provided tag + all tags having the provided tag as ancestor. + * + * @param tag a tag in the registry + * @return a list of all tags having the provided tag as ancestor, including the provided tag itself + */ + List getSubTree(SemanticTag tag); + + /** + * Indicates if a tag is editable. + * + * To be editable, a tag must be managed. + * + * @param tag a tag in the registry + * @return true if the provided tag is editable, false if not + */ + boolean isEditable(SemanticTag tag); + + /** + * Removes the provided tag and all tags having the provided tag as ancestor. + * + * Only removable (managed) tags are removed. + * + * @param tag a tag in the registry + */ + void removeSubTree(SemanticTag tag); +} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTags.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTags.java index 58982dab6ce..fecebc542ab 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTags.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticTags.java @@ -12,32 +12,15 @@ */ package org.openhab.core.semantics; -import java.util.List; -import java.util.Locale; +import java.util.Collections; import java.util.Map; -import java.util.MissingResourceException; -import java.util.Optional; -import java.util.ResourceBundle; -import java.util.ResourceBundle.Control; import java.util.Set; import java.util.TreeMap; -import java.util.stream.Collectors; -import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Opcodes; import org.openhab.core.items.Item; -import org.openhab.core.semantics.model.equipment.Equipments; -import org.openhab.core.semantics.model.location.Locations; -import org.openhab.core.semantics.model.point.Measurement; -import org.openhab.core.semantics.model.point.Points; -import org.openhab.core.semantics.model.property.Properties; import org.openhab.core.types.StateDescription; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * This is a class that gives static access to the semantic tag library. @@ -45,22 +28,18 @@ * * @author Kai Kreuzer - Initial contribution * @author Jimmy Tanagra - Add the ability to add new tags at runtime + * @author Laurent Garnier - Several methods moved into class SemanticsService or SemanticTagRegistry */ @NonNullByDefault public class SemanticTags { - private static final String TAGS_BUNDLE_NAME = "tags"; - - private static final Map> TAGS = new TreeMap<>(); - - private static final Logger LOGGER = LoggerFactory.getLogger(SemanticTags.class); - private static final SemanticClassLoader CLASS_LOADER = new SemanticClassLoader(); + private static final Map> TAGS = Collections.synchronizedMap(new TreeMap<>()); static { - Locations.stream().forEach(location -> addTagSet(location)); - Equipments.stream().forEach(equipment -> addTagSet(equipment)); - Points.stream().forEach(point -> addTagSet(point)); - Properties.stream().forEach(property -> addTagSet(property)); + addTagSet("Location", Location.class); + addTagSet("Equipment", Equipment.class); + addTagSet("Point", Point.class); + addTagSet("Property", Property.class); } /** @@ -75,69 +54,6 @@ public class SemanticTags { return TAGS.get(tagId); } - public static @Nullable Class getByLabel(String tagLabel, Locale locale) { - Optional> tag = TAGS.values().stream().distinct() - .filter(t -> getLabel(t, locale).equalsIgnoreCase(tagLabel)).findFirst(); - return tag.isPresent() ? tag.get() : null; - } - - public static List> getByLabelOrSynonym(String tagLabelOrSynonym, Locale locale) { - return TAGS.values().stream().distinct() - .filter(t -> getLabelAndSynonyms(t, locale).contains(tagLabelOrSynonym.toLowerCase(locale))) - .collect(Collectors.toList()); - } - - public static List getLabelAndSynonyms(Class tag, Locale locale) { - ResourceBundle rb = ResourceBundle.getBundle(TAGS_BUNDLE_NAME, locale, - Control.getNoFallbackControl(Control.FORMAT_PROPERTIES)); - TagInfo tagInfo = tag.getAnnotation(TagInfo.class); - try { - String entry = rb.getString(tagInfo.id()); - return List.of(entry.toLowerCase(locale).split(",")); - } catch (MissingResourceException e) { - Stream label = Stream.of(tagInfo.label()); - Stream synonyms = Stream.of(tagInfo.synonyms().split(",")).map(String::trim); - return Stream.concat(label, synonyms).map(s -> s.toLowerCase(locale)).distinct().toList(); - } - } - - public static String getLabel(Class tag, Locale locale) { - ResourceBundle rb = ResourceBundle.getBundle(TAGS_BUNDLE_NAME, locale, - Control.getNoFallbackControl(Control.FORMAT_PROPERTIES)); - TagInfo tagInfo = tag.getAnnotation(TagInfo.class); - try { - String entry = rb.getString(tagInfo.id()); - if (entry.contains(",")) { - return entry.substring(0, entry.indexOf(",")); - } else { - return entry; - } - } catch (MissingResourceException e) { - return tagInfo.label(); - } - } - - public static List getSynonyms(Class tag, Locale locale) { - ResourceBundle rb = ResourceBundle.getBundle(TAGS_BUNDLE_NAME, locale, - Control.getNoFallbackControl(Control.FORMAT_PROPERTIES)); - String synonyms = ""; - TagInfo tagInfo = tag.getAnnotation(TagInfo.class); - try { - String entry = rb.getString(tagInfo.id()); - int start = entry.indexOf(",") + 1; - if (start > 0 && entry.length() > start) { - synonyms = entry.substring(start); - } - } catch (MissingResourceException e) { - synonyms = tagInfo.synonyms(); - } - return Stream.of(synonyms.split(",")).map(String::trim).toList(); - } - - public static String getDescription(Class tag, Locale locale) { - return tag.getAnnotation(TagInfo.class).description(); - } - /** * Determines the semantic type of an {@link Item} i.e. a sub-type of {@link Location}, {@link Equipment} or * {@link Point}. @@ -156,9 +72,9 @@ public static String getDescription(Class tag, Locale locale) { if (getProperty(item) != null) { StateDescription stateDescription = item.getStateDescription(); if (stateDescription != null && stateDescription.isReadOnly()) { - return Measurement.class; + return getById("Point_Measurement"); } else { - return org.openhab.core.semantics.model.point.Control.class; + return getById("Point_Control"); } } else { return null; @@ -234,147 +150,11 @@ public static String getDescription(Class tag, Locale locale) { return null; } - /** - * Adds a new semantic tag with inferred label, empty synonyms and description. - * - * The label will be inferred from the tag name by splitting the CamelCase with a space. - * - * @param name the tag name to add - * @param parent the parent tag that the new tag should belong to - * @return the created semantic tag class, or null if it was already added. - */ - public static @Nullable Class add(String name, String parent) { - return add(name, parent, null, null, null); - } - - /** - * Adds a new semantic tag. - * - * @param name the tag name to add - * @param parent the parent tag that the new tag should belong to - * @param label an optional label. When null, the label will be inferred from the tag name, - * splitting the CamelCase with a space. - * @param synonyms a comma separated list of synonyms - * @param description the tag description - * @return the created semantic tag class, or null if it was already added. - */ - public static @Nullable Class add(String name, String parent, @Nullable String label, - @Nullable String synonyms, @Nullable String description) { - Class parentClass = getById(parent); - if (parentClass == null) { - LOGGER.warn("Adding semantic tag '{}' failed because parent tag '{}' is not found.", name, parent); - return null; - } - return add(name, parentClass, label, synonyms, description); - } - - /** - * Adds a new semantic tag with inferred label, empty synonyms and description. - * - * The label will be inferred from the tag name by splitting the CamelCase with a space. - * - * @param name the tag name to add - * @param parent the parent tag that the new tag should belong to - * @return the created semantic tag class, or null if it was already added. - */ - public static @Nullable Class add(String name, Class parent) { - return add(name, parent, null, null, null); - } - - /** - * Adds a new semantic tag. - * - * @param name the tag name to add - * @param parent the parent tag that the new tag should belong to - * @param label an optional label. When null, the label will be inferred from the tag name, - * splitting the CamelCase with a space. - * @param synonyms a comma separated list of synonyms - * @param description the tag description - * @return the created semantic tag class, or null if it was already added. - */ - public static @Nullable Class add(String name, Class parent, @Nullable String label, - @Nullable String synonyms, @Nullable String description) { - if (getById(name) != null) { - return null; - } - - if (!name.matches("[A-Z][a-zA-Z0-9]+")) { - throw new IllegalArgumentException( - "The tag name '" + name + "' must start with a capital letter and contain only alphanumerics."); - } - - String parentId = parent.getAnnotation(TagInfo.class).id(); - String type = parentId.split("_")[0]; - String className = "org.openhab.core.semantics.model." + type.toLowerCase() + "." + name; - - // Infer label from name, splitting up CamelCaseALL99 -> Camel Case ALL 99 - label = Optional.ofNullable(label).orElseGet(() -> name.replaceAll("([A-Z][a-z]+|[A-Z][A-Z]+|[0-9]+)", " $1")) - .trim(); - synonyms = Optional.ofNullable(synonyms).orElse("").replaceAll("\\s*,\\s*", ",").trim(); - - // Create the tag interface - ClassWriter classWriter = new ClassWriter(0); - classWriter.visit(Opcodes.V11, Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT + Opcodes.ACC_INTERFACE, - className.replace('.', '/'), null, "java/lang/Object", - new String[] { parent.getName().replace('.', '/') }); - - // Add TagInfo Annotation - classWriter.visitSource("Status.java", null); - - AnnotationVisitor annotation = classWriter.visitAnnotation("Lorg/openhab/core/semantics/TagInfo;", true); - annotation.visit("id", parentId + "_" + name); - annotation.visit("label", label); - annotation.visit("synonyms", synonyms); - annotation.visit("description", Optional.ofNullable(description).orElse("").trim()); - annotation.visitEnd(); - - classWriter.visitEnd(); - byte[] byteCode = classWriter.toByteArray(); - Class newTag = null; - try { - newTag = CLASS_LOADER.defineClass(className, byteCode); - } catch (Exception e) { - LOGGER.warn("Failed creating a new semantic tag '{}': {}", className, e.getMessage()); - return null; - } - addToModel(newTag); - addTagSet(newTag); - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("'{}' semantic {} tag added.", className, type); - } - return newTag; - } - - private static void addTagSet(Class tagSet) { - String id = tagSet.getAnnotation(TagInfo.class).id(); - while (id.indexOf("_") != -1) { - TAGS.put(id, tagSet); - id = id.substring(id.indexOf("_") + 1); - } + public static void addTagSet(String id, Class tagSet) { TAGS.put(id, tagSet); } - private static boolean addToModel(Class tag) { - if (Location.class.isAssignableFrom(tag)) { - return Locations.add((Class) tag); - } else if (Equipment.class.isAssignableFrom(tag)) { - return Equipments.add((Class) tag); - } else if (Point.class.isAssignableFrom(tag)) { - return Points.add((Class) tag); - } else if (Property.class.isAssignableFrom(tag)) { - return Properties.add((Class) tag); - } - throw new IllegalArgumentException("Unknown type of tag " + tag); - } - - private static class SemanticClassLoader extends ClassLoader { - public SemanticClassLoader() { - super(SemanticTags.class.getClassLoader()); - } - - public Class defineClass(String className, byte[] byteCode) { - // defineClass is protected in the normal ClassLoader - return defineClass(className, byteCode, 0, byteCode.length); - } + public static void removeTagSet(String id, Class tagSet) { + TAGS.remove(id, tagSet); } } diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticsService.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticsService.java index 7e321aaaf78..df36cc33cd2 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticsService.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/SemanticsService.java @@ -12,16 +12,19 @@ */ package org.openhab.core.semantics; +import java.util.List; import java.util.Locale; import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.items.Item; /** * This interface defines a service, which offers functionality regarding semantic tags. * * @author Kai Kreuzer - Initial contribution + * @author Laurent Garnier - Few methods moved from class SemanticTags in order to use the semantic tag registry */ @NonNullByDefault public interface SemanticsService { @@ -45,4 +48,34 @@ public interface SemanticsService { * @return as set of items that are located in the given location(s) */ Set getItemsInLocation(String labelOrSynonym, Locale locale); + + /** + * Retrieves the first semantic tag having label matching the given parameter. + * Case is ignored. + * + * @param tagLabel the searched label + * @param locale the locale to be considered + * @return the tag class of the first matching semantic tag or null if no matching found + */ + @Nullable + Class getByLabel(String tagLabel, Locale locale); + + /** + * Retrieves all semantic tags having label or a synonym matching the given parameter. + * Case is ignored. + * + * @param tagLabelOrSynonym the searched label or synonym + * @param locale the locale to be considered + * @return the List of tag classes of all matching semantic tags + */ + List> getByLabelOrSynonym(String tagLabelOrSynonym, Locale locale); + + /** + * Gets the label and all synonyms of a semantic tag using the given locale. + * + * @param tagClass the tag class + * @param locale the locale to be considered + * @return the list containing the label and all synonyms of a semantic tag + */ + List getLabelAndSynonyms(Class tagClass, Locale locale); } diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/TagInfo.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/TagInfo.java deleted file mode 100644 index 89b53e7e607..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/TagInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * This is an annotation to be used on semantic tag classes for providing their ids, labels and descriptions. - * - * @author Kai Kreuzer - Initial contribution - */ -@Retention(RUNTIME) -@Target(TYPE) -public @interface TagInfo { - - String id(); - - String label() default ""; - - String synonyms() default ""; - - String description() default ""; -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/dto/SemanticTagDTO.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/dto/SemanticTagDTO.java new file mode 100644 index 00000000000..db00e10f968 --- /dev/null +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/dto/SemanticTagDTO.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.semantics.dto; + +import java.util.List; + +/** + * This is a data transfer object that is used to serialize semantic tags. + * + * @author Laurent Garnier - Initial contribution + */ +public class SemanticTagDTO { + + public String uid; + public String label; + public String description; + public List synonyms; + + public SemanticTagDTO() { + } +} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/dto/SemanticTagDTOMapper.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/dto/SemanticTagDTOMapper.java new file mode 100644 index 00000000000..0987bb6e1d4 --- /dev/null +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/dto/SemanticTagDTOMapper.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.semantics.dto; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.semantics.SemanticTag; +import org.openhab.core.semantics.SemanticTagImpl; + +/** + * The {@link SemanticTagDTOMapper} is an utility class to map semantic tags into + * semantic tag data transfer objects (DTOs). + * + * @author Laurent Garnier - Initial contribution + */ +@NonNullByDefault +public class SemanticTagDTOMapper { + + /** + * Maps semantic tag DTO into semantic tag object. + * + * @param tagDTO the DTO + * @return the semantic tag object + */ + public static @Nullable SemanticTag map(@Nullable SemanticTagDTO tagDTO) { + if (tagDTO == null) { + throw new IllegalArgumentException("The argument 'tagDTO' must not be null."); + } + if (tagDTO.uid == null) { + throw new IllegalArgumentException("The argument 'tagDTO.uid' must not be null."); + } + + return new SemanticTagImpl(tagDTO.uid, tagDTO.label, tagDTO.description, tagDTO.synonyms); + } + + /** + * Maps semantic tag object into semantic tag DTO. + * + * @param tag the semantic tag + * @return the semantic tag DTO + */ + public static SemanticTagDTO map(SemanticTag tag) { + SemanticTagDTO tagDTO = new SemanticTagDTO(); + tagDTO.uid = tag.getUID(); + tagDTO.label = tag.getLabel(); + tagDTO.description = tag.getDescription(); + tagDTO.synonyms = tag.getSynonyms(); + return tagDTO; + } +} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticTagRegistryImpl.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticTagRegistryImpl.java new file mode 100644 index 00000000000..55a9d01151c --- /dev/null +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticTagRegistryImpl.java @@ -0,0 +1,285 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.semantics.internal; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Opcodes; +import org.openhab.core.common.registry.AbstractRegistry; +import org.openhab.core.common.registry.Provider; +import org.openhab.core.semantics.Equipment; +import org.openhab.core.semantics.Location; +import org.openhab.core.semantics.ManagedSemanticTagProvider; +import org.openhab.core.semantics.Point; +import org.openhab.core.semantics.Property; +import org.openhab.core.semantics.SemanticTag; +import org.openhab.core.semantics.SemanticTagProvider; +import org.openhab.core.semantics.SemanticTagRegistry; +import org.openhab.core.semantics.SemanticTags; +import org.openhab.core.semantics.Tag; +import org.openhab.core.semantics.model.DefaultSemanticTagProvider; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This is the main implementing class of the {@link SemanticTagRegistry} interface. It + * keeps track of all declared semantic tags of all semantic tags providers and keeps + * their current state in memory. + * + * @author Laurent Garnier - Initial contribution + */ +@NonNullByDefault +@Component(immediate = true) +public class SemanticTagRegistryImpl extends AbstractRegistry + implements SemanticTagRegistry { + + private static final SemanticClassLoader CLASS_LOADER = new SemanticClassLoader(); + + private final Logger logger = LoggerFactory.getLogger(SemanticTagRegistryImpl.class); + + private final DefaultSemanticTagProvider defaultSemanticTagProvider; + private final ManagedSemanticTagProvider managedProvider; + + @Activate + public SemanticTagRegistryImpl(@Reference DefaultSemanticTagProvider defaultSemanticTagProvider, + @Reference ManagedSemanticTagProvider managedProvider) { + super(SemanticTagProvider.class); + this.defaultSemanticTagProvider = defaultSemanticTagProvider; + this.managedProvider = managedProvider; + // Add the default semantic tags provider first, before all others + super.addProvider(defaultSemanticTagProvider); + super.addProvider(managedProvider); + setManagedProvider(managedProvider); + } + + @Override + protected void addProvider(Provider provider) { + // Ignore the default semantic tags provider and the managed provider (they are added in the constructor) + if (!provider.equals(defaultSemanticTagProvider) && !provider.equals(managedProvider)) { + logger.trace("addProvider {} => calling super.addProvider", provider.getClass().getSimpleName()); + super.addProvider(provider); + } else { + logger.trace("addProvider {} => ignoring it", provider.getClass().getSimpleName()); + } + } + + @Override + public @Nullable Class getTagClassById(String tagId) { + return SemanticTags.getById(tagId); + } + + /** + * Builds the fully qualified id for a semantic tag class. + * + * @param tag the semantic tag class + * @return the fully qualified id + */ + public static String buildId(Class tag) { + return buildId("", tag); + } + + private static String buildId(String relativeId, Class tag) { + if (!Location.class.isAssignableFrom(tag) && !Equipment.class.isAssignableFrom(tag) + && !Point.class.isAssignableFrom(tag) && !Property.class.isAssignableFrom(tag)) { + return relativeId; + } + String id = tag.getSimpleName(); + if (!relativeId.isEmpty()) { + id += "_" + relativeId; + } + return buildId(id, tag.getInterfaces()[0]); + } + + @Override + public boolean canBeAdded(SemanticTag tag) { + String id = tag.getUID(); + // check that a tag with this id does not already exist in the registry + if (get(id) != null) { + return false; + } + // Extract the tag name and the parent tag + int lastSeparator = id.lastIndexOf("_"); + if (lastSeparator <= 0) { + return false; + } + String name = id.substring(lastSeparator + 1); + String parentId = id.substring(0, lastSeparator); + SemanticTag parent = get(parentId); + // Check that the tag name has a valid syntax and the parent tag already exists + // and is either a default tag or a managed tag + // Check also that a semantic tag class with the same name does not already exist + return name.matches("[A-Z][a-zA-Z0-9]+") && parent != null + && (managedProvider.get(parentId) != null || defaultSemanticTagProvider.getAll().contains(parent)) + && getTagClassById(name) == null; + } + + @Override + public List getSubTree(SemanticTag tag) { + List ids = getAll().stream().map(t -> t.getUID()).filter(uid -> uid.startsWith(tag.getUID() + "_")) + .toList(); + List tags = new ArrayList<>(); + tags.add(tag); + ids.forEach(id -> { + SemanticTag t = get(id); + if (t != null) { + tags.add(t); + } + }); + return tags; + } + + @Override + public boolean isEditable(SemanticTag tag) { + return managedProvider.get(tag.getUID()) != null; + } + + @Override + public void removeSubTree(SemanticTag tag) { + // Get tags id in reverse order + List ids = getSubTree(tag).stream().filter(this::isEditable).map(SemanticTag::getUID) + .sorted(Comparator.reverseOrder()).toList(); + ids.forEach(managedProvider::remove); + } + + @Override + protected void onAddElement(SemanticTag tag) throws IllegalArgumentException { + logger.trace("onAddElement {}", tag.getUID()); + super.onAddElement(tag); + + String uid = tag.getUID(); + Class tagClass = getTagClassById(uid); + if (tagClass != null) { + // Class already exists + return; + } + + String type; + String className; + Class newTag; + int lastSeparator = uid.lastIndexOf("_"); + if (lastSeparator < 0) { + switch (uid) { + case "Equipment": + newTag = Equipment.class; + break; + case "Location": + newTag = Location.class; + break; + case "Point": + newTag = Point.class; + break; + case "Property": + newTag = Property.class; + break; + default: + throw new IllegalArgumentException("Failed to create semantic tag '" + uid + + "': only Equipment, Location, Point and Property are allowed as root tags."); + } + type = uid; + className = newTag.getClass().getName(); + } else { + String name = uid.substring(lastSeparator + 1); + String parentId = uid.substring(0, lastSeparator); + Class parentTagClass = getTagClassById(parentId); + if (parentTagClass == null) { + throw new IllegalArgumentException( + "Failed to create semantic tag '" + uid + "': no existing parent tag with id " + parentId); + } + if (!name.matches("[A-Z][a-zA-Z0-9]+")) { + throw new IllegalArgumentException("Failed to create semantic tag '" + uid + + "': tag name must start with a capital letter and contain only alphanumerics."); + } + tagClass = getTagClassById(name); + if (tagClass != null) { + throw new IllegalArgumentException( + "Failed to create semantic tag '" + uid + "': tag '" + buildId(tagClass) + "' already exists."); + } + + type = parentId.split("_")[0]; + className = "org.openhab.core.semantics.model." + type.toLowerCase() + "." + name; + try { + newTag = (Class) Class.forName(className, false, CLASS_LOADER); + logger.debug("'{}' semantic {} tag already exists.", className, type); + } catch (ClassNotFoundException e) { + // Create the tag interface + ClassWriter classWriter = new ClassWriter(0); + classWriter.visit(Opcodes.V11, Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT + Opcodes.ACC_INTERFACE, + className.replace('.', '/'), null, "java/lang/Object", + new String[] { parentTagClass.getName().replace('.', '/') }); + classWriter.visitSource("Status.java", null); + classWriter.visitEnd(); + byte[] byteCode = classWriter.toByteArray(); + try { + newTag = (Class) CLASS_LOADER.defineClass(className, byteCode); + logger.debug("'{}' semantic {} tag created.", className, type); + } catch (Exception ex) { + logger.warn("Failed to create semantic tag '{}': {}", className, ex.getMessage()); + throw new IllegalArgumentException("Failed to create semantic tag '" + className + "'", ex); + } + } + } + + addTagSet(uid, newTag); + logger.debug("'{}' semantic {} tag added.", className, type); + } + + @Override + protected void onRemoveElement(SemanticTag tag) { + logger.trace("onRemoveElement {}", tag.getUID()); + super.onRemoveElement(tag); + removeTagSet(tag.getUID()); + } + + private void addTagSet(String tagId, Class tagSet) { + logger.trace("addTagSet {}", tagId); + String id = tagId; + while (id.indexOf("_") != -1) { + SemanticTags.addTagSet(id, tagSet); + id = id.substring(id.indexOf("_") + 1); + } + SemanticTags.addTagSet(id, tagSet); + } + + private void removeTagSet(String tagId) { + logger.trace("removeTagSet {}", tagId); + Class tagSet = getTagClassById(tagId); + if (tagSet == null) { + return; + } + String id = tagId; + while (id.indexOf("_") != -1) { + SemanticTags.removeTagSet(id, tagSet); + id = id.substring(id.indexOf("_") + 1); + } + SemanticTags.removeTagSet(id, tagSet); + } + + private static class SemanticClassLoader extends ClassLoader { + public SemanticClassLoader() { + super(SemanticTagRegistryImpl.class.getClassLoader()); + } + + public Class defineClass(String className, byte[] byteCode) { + // defineClass is protected in the normal ClassLoader + return defineClass(className, byteCode, 0, byteCode.length); + } + } +} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticsMetadataProvider.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticsMetadataProvider.java index 2f64548c0e7..535fc3f4a3e 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticsMetadataProvider.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticsMetadataProvider.java @@ -33,9 +33,9 @@ import org.openhab.core.semantics.Location; import org.openhab.core.semantics.Point; import org.openhab.core.semantics.Property; +import org.openhab.core.semantics.SemanticTagRegistry; import org.openhab.core.semantics.SemanticTags; import org.openhab.core.semantics.Tag; -import org.openhab.core.semantics.TagInfo; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; @@ -75,7 +75,8 @@ public int compare(String s1, String s2) { private final ItemRegistry itemRegistry; @Activate - public SemanticsMetadataProvider(final @Reference ItemRegistry itemRegistry) { + public SemanticsMetadataProvider(final @Reference ItemRegistry itemRegistry, + final @Reference SemanticTagRegistry semanticTagRegistry) { this.itemRegistry = itemRegistry; } @@ -111,7 +112,7 @@ private void processItem(Item item) { if (type != null) { processProperties(item, configuration); processHierarchy(item, configuration); - Metadata md = new Metadata(key, type.getAnnotation(TagInfo.class).id(), configuration); + Metadata md = new Metadata(key, SemanticTagRegistryImpl.buildId(type), configuration); Metadata oldMd = semantics.put(item.getName(), md); if (oldMd == null) { notifyListenersAboutAddedElement(md); @@ -148,7 +149,7 @@ private void processProperties(Item item, Map configuration) { if (entityClass.isAssignableFrom(type)) { Class p = SemanticTags.getProperty(item); if (p != null) { - configuration.put(relation.getValue(), p.getAnnotation(TagInfo.class).id()); + configuration.put(relation.getValue(), SemanticTagRegistryImpl.buildId(p)); } } } diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticsServiceImpl.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticsServiceImpl.java index 4ef13018d74..61a27a40b43 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticsServiceImpl.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/internal/SemanticsServiceImpl.java @@ -12,14 +12,19 @@ */ package org.openhab.core.semantics.internal; +import java.util.ArrayList; +import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Locale; +import java.util.Optional; import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.items.GroupItem; import org.openhab.core.items.Item; import org.openhab.core.items.ItemPredicates; @@ -30,7 +35,8 @@ import org.openhab.core.semantics.Equipment; import org.openhab.core.semantics.Location; import org.openhab.core.semantics.Point; -import org.openhab.core.semantics.SemanticTags; +import org.openhab.core.semantics.SemanticTag; +import org.openhab.core.semantics.SemanticTagRegistry; import org.openhab.core.semantics.SemanticsPredicates; import org.openhab.core.semantics.SemanticsService; import org.openhab.core.semantics.Tag; @@ -42,6 +48,7 @@ * The internal implementation of the {@link SemanticsService} interface, which is registered as an OSGi service. * * @author Kai Kreuzer - Initial contribution + * @author Laurent Garnier - Few methods moved from class SemanticTags in order to use the semantic tag registry */ @NonNullByDefault @Component @@ -51,12 +58,15 @@ public class SemanticsServiceImpl implements SemanticsService { private final ItemRegistry itemRegistry; private final MetadataRegistry metadataRegistry; + private final SemanticTagRegistry semanticTagRegistry; @Activate public SemanticsServiceImpl(final @Reference ItemRegistry itemRegistry, - final @Reference MetadataRegistry metadataRegistry) { + final @Reference MetadataRegistry metadataRegistry, + final @Reference SemanticTagRegistry semanticTagRegistry) { this.itemRegistry = itemRegistry; this.metadataRegistry = metadataRegistry; + this.semanticTagRegistry = semanticTagRegistry; } @Override @@ -77,7 +87,7 @@ public Set getItemsInLocation(Class locationType) { @Override public Set getItemsInLocation(String labelOrSynonym, Locale locale) { Set items = new HashSet<>(); - List> tagList = SemanticTags.getByLabelOrSynonym(labelOrSynonym, locale); + List> tagList = getByLabelOrSynonym(labelOrSynonym, locale); if (!tagList.isEmpty()) { for (Class tag : tagList) { if (Location.class.isAssignableFrom(tag)) { @@ -112,4 +122,40 @@ private Predicate hasSynonym(String labelOrSynonym) { return false; }; } + + @Override + public @Nullable Class getByLabel(String tagLabel, Locale locale) { + Optional tag = semanticTagRegistry.getAll().stream() + .filter(t -> t.localized(locale).getLabel().equalsIgnoreCase(tagLabel)) + .sorted(Comparator.comparing(SemanticTag::getUID)).findFirst(); + return tag.isPresent() ? semanticTagRegistry.getTagClassById(tag.get().getUID()) : null; + } + + @Override + public List> getByLabelOrSynonym(String tagLabelOrSynonym, Locale locale) { + List tags = semanticTagRegistry.getAll().stream() + .filter(t -> getLabelAndSynonyms(t, locale).contains(tagLabelOrSynonym.toLowerCase(locale))) + .sorted(Comparator.comparing(SemanticTag::getUID)).toList(); + List> tagList = new ArrayList<>(); + tags.forEach(t -> { + Class tag = semanticTagRegistry.getTagClassById(t.getUID()); + if (tag != null) { + tagList.add(tag); + } + }); + return tagList; + } + + @Override + public List getLabelAndSynonyms(Class tagClass, Locale locale) { + SemanticTag tag = semanticTagRegistry.get(SemanticTagRegistryImpl.buildId(tagClass)); + return tag == null ? List.of() : getLabelAndSynonyms(tag, locale); + } + + private List getLabelAndSynonyms(SemanticTag tag, Locale locale) { + SemanticTag localizedTag = tag.localized(locale); + Stream label = Stream.of(localizedTag.getLabel()); + Stream synonyms = localizedTag.getSynonyms().stream(); + return Stream.concat(label, synonyms).map(s -> s.toLowerCase(locale)).distinct().toList(); + } } diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/DefaultSemanticTagProvider.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/DefaultSemanticTagProvider.java new file mode 100644 index 00000000000..177d0657e95 --- /dev/null +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/DefaultSemanticTagProvider.java @@ -0,0 +1,311 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.semantics.model; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.semantics.SemanticTag; +import org.openhab.core.semantics.SemanticTagImpl; +import org.openhab.core.semantics.SemanticTagProvider; +import org.osgi.service.component.annotations.Component; + +/** + * This class defines a provider of all default semantic tags. + * + * @author Generated from generateTagClasses.groovy - Initial contribution + */ +@NonNullByDefault +@Component(immediate = true, service = { SemanticTagProvider.class, DefaultSemanticTagProvider.class }) +public class DefaultSemanticTagProvider implements SemanticTagProvider { + + private List defaultTags; + + public DefaultSemanticTagProvider() { + this.defaultTags = new ArrayList<>(); + defaultTags.add(new SemanticTagImpl("Equipment", "", "", "")); + defaultTags.add(new SemanticTagImpl("Location", "", "", "")); + defaultTags.add(new SemanticTagImpl("Point", "", "", "")); + defaultTags.add(new SemanticTagImpl("Property", "", "", "")); + defaultTags.add(new SemanticTagImpl("Location_Indoor", // + "Indoor", "Anything that is inside a closed building", "")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Apartment", // + "Apartment", "", "Apartments")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Building", // + "Building", "", "Buildings")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Building_Garage", // + "Garage", "", "Garages")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Building_House", // + "House", "", "Houses")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Building_Shed", // + "Shed", "", "Sheds")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Building_SummerHouse", // + "Summer House", "", "Summer Houses, Second Home, Second Homes")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Floor", // + "Floor", "", "Floors")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Floor_GroundFloor", // + "Ground Floor", "", "Ground Floors, Downstairs")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Floor_FirstFloor", // + "First Floor", "", "First Floors, Upstairs")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Floor_SecondFloor", // + "Second Floor", "", "Second Floors")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Floor_ThirdFloor", // + "Third Floor", "", "Third Floors")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Floor_Attic", // + "Attic", "", "Attics")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Floor_Basement", // + "Basement", "", "Basements")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Corridor", // + "Corridor", "", "Corridors, Hallway, Hallways")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room", // + "Room", "", "Rooms")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_Bathroom", // + "Bathroom", "", "Bathrooms, Bath, Baths, Powder Room, Powder Rooms")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_Bedroom", // + "Bedroom", "", "Bedrooms")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_BoilerRoom", // + "Boiler Room", "", "Boiler Rooms")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_Cellar", // + "Cellar", "", "Cellars")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_DiningRoom", // + "Dining Room", "", "Dining Rooms")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_Entry", // + "Entry", "", "Entries, Foyer, Foyers")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_FamilyRoom", // + "Family Room", "", "Family Rooms")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_GuestRoom", // + "Guest Room", "", "Guest Rooms")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_Kitchen", // + "Kitchen", "", "Kitchens")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_LaundryRoom", // + "Laundry Room", "", "Laundry Rooms")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_LivingRoom", // + "Living Room", "", "Living Rooms")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_Office", // + "Office", "", "Offices")); + defaultTags.add(new SemanticTagImpl("Location_Indoor_Room_Veranda", // + "Veranda", "", "Verandas")); + defaultTags.add(new SemanticTagImpl("Location_Outdoor", // + "Outdoor", "", "")); + defaultTags.add(new SemanticTagImpl("Location_Outdoor_Carport", // + "Carport", "", "Carports")); + defaultTags.add(new SemanticTagImpl("Location_Outdoor_Driveway", // + "Driveway", "", "Driveways")); + defaultTags.add(new SemanticTagImpl("Location_Outdoor_Garden", // + "Garden", "", "Gardens")); + defaultTags.add(new SemanticTagImpl("Location_Outdoor_Patio", // + "Patio", "", "Patios")); + defaultTags.add(new SemanticTagImpl("Location_Outdoor_Porch", // + "Porch", "", "Porches")); + defaultTags.add(new SemanticTagImpl("Location_Outdoor_Terrace", // + "Terrace", "", "Terraces, Deck, Decks")); + defaultTags.add(new SemanticTagImpl("Property_Temperature", // + "Temperature", "", "Temperatures")); + defaultTags.add(new SemanticTagImpl("Property_Light", // + "Light", "", "Lights, Lighting")); + defaultTags.add(new SemanticTagImpl("Property_ColorTemperature", // + "Color Temperature", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Humidity", // + "Humidity", "", "Moisture")); + defaultTags.add(new SemanticTagImpl("Property_Presence", // + "Presence", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Pressure", // + "Pressure", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Smoke", // + "Smoke", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Noise", // + "Noise", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Rain", // + "Rain", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Wind", // + "Wind", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Water", // + "Water", "", "")); + defaultTags.add(new SemanticTagImpl("Property_CO2", // + "CO2", "", "Carbon Dioxide")); + defaultTags.add(new SemanticTagImpl("Property_CO", // + "CO", "", "Carbon Monoxide")); + defaultTags.add(new SemanticTagImpl("Property_Energy", // + "Energy", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Power", // + "Power", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Voltage", // + "Voltage", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Current", // + "Current", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Frequency", // + "Frequency", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Gas", // + "Gas", "", "")); + defaultTags.add(new SemanticTagImpl("Property_SoundVolume", // + "Sound Volume", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Oil", // + "Oil", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Duration", // + "Duration", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Level", // + "Level", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Opening", // + "Opening", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Timestamp", // + "Timestamp", "", "")); + defaultTags.add(new SemanticTagImpl("Property_Ultraviolet", // + "Ultraviolet", "", "UV")); + defaultTags.add(new SemanticTagImpl("Property_Vibration", // + "Vibration", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Alarm", // + "Alarm", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Control", // + "Control", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Control_Switch", // + "Switch", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Measurement", // + "Measurement", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Setpoint", // + "Setpoint", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Status", // + "Status", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Status_LowBattery", // + "LowBattery", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Status_OpenLevel", // + "OpenLevel", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Status_OpenState", // + "OpenState", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Status_Tampered", // + "Tampered", "", "")); + defaultTags.add(new SemanticTagImpl("Point_Status_Tilt", // + "Tilt", "", "")); + defaultTags.add(new SemanticTagImpl("Equipment_AlarmSystem", // + "Alarm System", "", "Alarm Systems")); + defaultTags.add(new SemanticTagImpl("Equipment_Battery", // + "Battery", "", "Batteries")); + defaultTags.add(new SemanticTagImpl("Equipment_Blinds", // + "Blinds", "", "Rollershutter, Rollershutters, Roller shutter, Roller shutters, Shutter, Shutters")); + defaultTags.add(new SemanticTagImpl("Equipment_Boiler", // + "Boiler", "", "Boilers")); + defaultTags.add(new SemanticTagImpl("Equipment_Camera", // + "Camera", "", "Cameras")); + defaultTags.add(new SemanticTagImpl("Equipment_Car", // + "Car", "", "Cars")); + defaultTags.add(new SemanticTagImpl("Equipment_CleaningRobot", // + "Cleaning Robot", "", "Cleaning Robots, Vacuum robot, Vacuum robots")); + defaultTags.add(new SemanticTagImpl("Equipment_Door", // + "Door", "", "Doors")); + defaultTags.add(new SemanticTagImpl("Equipment_Door_BackDoor", // + "Back Door", "", "Back Doors")); + defaultTags.add(new SemanticTagImpl("Equipment_Door_CellarDoor", // + "Cellar Door", "", "Cellar Doors")); + defaultTags.add(new SemanticTagImpl("Equipment_Door_FrontDoor", // + "Front Door", "", "Front Doors, Frontdoor, Frontdoors")); + defaultTags.add(new SemanticTagImpl("Equipment_Door_GarageDoor", // + "Garage Door", "", "Garage Doors")); + defaultTags.add(new SemanticTagImpl("Equipment_Door_Gate", // + "Gate", "", "Gates")); + defaultTags.add(new SemanticTagImpl("Equipment_Door_InnerDoor", // + "Inner Door", "", "Inner Doors")); + defaultTags.add(new SemanticTagImpl("Equipment_Door_SideDoor", // + "Side Door", "", "Side Doors")); + defaultTags.add(new SemanticTagImpl("Equipment_Doorbell", // + "Doorbell", "", "Doorbells")); + defaultTags.add(new SemanticTagImpl("Equipment_Fan", // + "Fan", "", "Fans")); + defaultTags.add(new SemanticTagImpl("Equipment_Fan_CeilingFan", // + "Ceiling Fan", "", "Ceiling Fans")); + defaultTags.add(new SemanticTagImpl("Equipment_Fan_KitchenHood", // + "Kitchen Hood", "", "Kitchen Hoods")); + defaultTags.add(new SemanticTagImpl("Equipment_HVAC", // + "HVAC", "", "Heating, Ventilation, Air Conditioning, A/C, A/Cs, AC")); + defaultTags.add(new SemanticTagImpl("Equipment_Inverter", // + "Inverter", "", "Inverters")); + defaultTags.add(new SemanticTagImpl("Equipment_LawnMower", // + "Lawn Mower", "", "Lawn Mowers")); + defaultTags.add(new SemanticTagImpl("Equipment_Lightbulb", // + "Lightbulb", "", "Lightbulbs, Bulb, Bulbs, Lamp, Lamps, Lights, Lighting")); + defaultTags.add(new SemanticTagImpl("Equipment_Lightbulb_LightStripe", // + "Light Stripe", "", "Light Stripes")); + defaultTags.add(new SemanticTagImpl("Equipment_Lock", // + "Lock", "", "Locks")); + defaultTags.add(new SemanticTagImpl("Equipment_NetworkAppliance", // + "Network Appliance", "", "Network Appliances")); + defaultTags.add(new SemanticTagImpl("Equipment_PowerOutlet", // + "Power Outlet", "", "Power Outlets, Outlet, Outlets")); + defaultTags.add(new SemanticTagImpl("Equipment_Projector", // + "Projector", "", "Projectors, Beamer, Beamers")); + defaultTags.add(new SemanticTagImpl("Equipment_Pump", // + "Pump", "", "Pumps")); + defaultTags.add(new SemanticTagImpl("Equipment_RadiatorControl", // + "Radiator Control", "", "Radiator Controls, Radiator, Radiators")); + defaultTags.add(new SemanticTagImpl("Equipment_Receiver", // + "Receiver", "", "Receivers, Audio Receiver, Audio Receivers, AV Receiver, AV Receivers")); + defaultTags.add(new SemanticTagImpl("Equipment_RemoteControl", // + "Remote Control", "", "Remote Controls")); + defaultTags.add(new SemanticTagImpl("Equipment_Screen", // + "Screen", "", "Screens")); + defaultTags.add(new SemanticTagImpl("Equipment_Screen_Television", // + "Television", "", "Televisions, TV, TVs")); + defaultTags.add(new SemanticTagImpl("Equipment_Sensor", // + "Sensor", "", "Sensors")); + defaultTags.add(new SemanticTagImpl("Equipment_Sensor_MotionDetector", // + "Motion Detector", "", "Motion Detectors, Motion sensor, Motion sensors")); + defaultTags.add(new SemanticTagImpl("Equipment_Sensor_SmokeDetector", // + "Smoke Detector", "", "Smoke Detectors")); + defaultTags.add(new SemanticTagImpl("Equipment_Siren", // + "Siren", "", "Sirens")); + defaultTags.add(new SemanticTagImpl("Equipment_Smartphone", // + "Smartphone", "", "Smartphones, Phone, Phones")); + defaultTags.add(new SemanticTagImpl("Equipment_Speaker", // + "Speaker", "", "Speakers")); + defaultTags.add(new SemanticTagImpl("Equipment_Valve", // + "Valve", "", "Valves")); + defaultTags.add(new SemanticTagImpl("Equipment_VoiceAssistant", // + "Voice Assistant", "", "Voice Assistants")); + defaultTags.add(new SemanticTagImpl("Equipment_WallSwitch", // + "Wall Switch", "", "Wall Switches")); + defaultTags.add(new SemanticTagImpl("Equipment_WebService", // + "Web Service", "", "Web Services")); + defaultTags.add(new SemanticTagImpl("Equipment_WebService_WeatherService", // + "Weather Service", "", "Weather Services")); + defaultTags.add(new SemanticTagImpl("Equipment_WhiteGood", // + "White Good", "", "White Goods")); + defaultTags.add(new SemanticTagImpl("Equipment_WhiteGood_Dishwasher", // + "Dishwasher", "", "Dishwashers")); + defaultTags.add(new SemanticTagImpl("Equipment_WhiteGood_Dryer", // + "Dryer", "", "Dryers")); + defaultTags.add(new SemanticTagImpl("Equipment_WhiteGood_Freezer", // + "Freezer", "", "Freezers")); + defaultTags.add(new SemanticTagImpl("Equipment_WhiteGood_Oven", // + "Oven", "", "Ovens")); + defaultTags.add(new SemanticTagImpl("Equipment_WhiteGood_Refrigerator", // + "Refrigerator", "", "Refrigerators")); + defaultTags.add(new SemanticTagImpl("Equipment_WhiteGood_WashingMachine", // + "Washing Machine", "", "Washing Machines")); + defaultTags.add(new SemanticTagImpl("Equipment_Window", // + "Window", "", "Windows")); + } + + @Override + public Collection getAll() { + return defaultTags; + } + + @Override + public void addProviderChangeListener(ProviderChangeListener listener) { + } + + @Override + public void removeProviderChangeListener(ProviderChangeListener listener) { + } +} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/AlarmSystem.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/AlarmSystem.java deleted file mode 100644 index bc810386bdf..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/AlarmSystem.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Alarm System. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_AlarmSystem", label = "Alarm System", synonyms = "Alarm Systems", description = "") -public interface AlarmSystem extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/BackDoor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/BackDoor.java deleted file mode 100644 index f693b7df429..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/BackDoor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Back Door. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Door_BackDoor", label = "Back Door", synonyms = "Back Doors", description = "") -public interface BackDoor extends Door { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Battery.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Battery.java deleted file mode 100644 index f1bdad31eda..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Battery.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Battery. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Battery", label = "Battery", synonyms = "Batteries", description = "") -public interface Battery extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Blinds.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Blinds.java deleted file mode 100644 index cf282d1ce37..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Blinds.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Blinds. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Blinds", label = "Blinds", synonyms = "Rollershutter, Rollershutters, Roller shutter, Roller shutters, Shutter, Shutters", description = "") -public interface Blinds extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Boiler.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Boiler.java deleted file mode 100644 index 0ea0d34b930..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Boiler.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Boiler. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Boiler", label = "Boiler", synonyms = "Boilers", description = "") -public interface Boiler extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Camera.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Camera.java deleted file mode 100644 index bd983ae404e..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Camera.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Camera. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Camera", label = "Camera", synonyms = "Cameras", description = "") -public interface Camera extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Car.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Car.java deleted file mode 100644 index 2875a98b5dd..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Car.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Car. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Car", label = "Car", synonyms = "Cars", description = "") -public interface Car extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CeilingFan.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CeilingFan.java deleted file mode 100644 index 61628444b2b..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CeilingFan.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Ceiling Fan. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Fan_CeilingFan", label = "Ceiling Fan", synonyms = "Ceiling Fans", description = "") -public interface CeilingFan extends Fan { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CellarDoor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CellarDoor.java deleted file mode 100644 index c61ce7ee805..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CellarDoor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Cellar Door. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Door_CellarDoor", label = "Cellar Door", synonyms = "Cellar Doors", description = "") -public interface CellarDoor extends Door { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CleaningRobot.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CleaningRobot.java deleted file mode 100644 index ff5c995fb1c..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/CleaningRobot.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Cleaning Robot. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_CleaningRobot", label = "Cleaning Robot", synonyms = "Cleaning Robots, Vacuum robot, Vacuum robots", description = "") -public interface CleaningRobot extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Dishwasher.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Dishwasher.java deleted file mode 100644 index ecb707ab016..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Dishwasher.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Dishwasher. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_WhiteGood_Dishwasher", label = "Dishwasher", synonyms = "Dishwashers", description = "") -public interface Dishwasher extends WhiteGood { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Door.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Door.java deleted file mode 100644 index 584d5ebf5c4..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Door.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Door. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Door", label = "Door", synonyms = "Doors", description = "") -public interface Door extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Doorbell.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Doorbell.java deleted file mode 100644 index 61875ce66fa..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Doorbell.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Doorbell. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Doorbell", label = "Doorbell", synonyms = "Doorbells", description = "") -public interface Doorbell extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Dryer.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Dryer.java deleted file mode 100644 index 8860419ffb9..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Dryer.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Dryer. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_WhiteGood_Dryer", label = "Dryer", synonyms = "Dryers", description = "") -public interface Dryer extends WhiteGood { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Equipments.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Equipments.java deleted file mode 100644 index d99172b88c6..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Equipments.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Stream; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; - -/** - * This class provides a stream of all defined equipments. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -public class Equipments { - - static final Set> EQUIPMENTS = new HashSet<>(); - - static { - EQUIPMENTS.add(Equipment.class); - EQUIPMENTS.add(AlarmSystem.class); - EQUIPMENTS.add(BackDoor.class); - EQUIPMENTS.add(Battery.class); - EQUIPMENTS.add(Blinds.class); - EQUIPMENTS.add(Boiler.class); - EQUIPMENTS.add(Camera.class); - EQUIPMENTS.add(Car.class); - EQUIPMENTS.add(CeilingFan.class); - EQUIPMENTS.add(CellarDoor.class); - EQUIPMENTS.add(CleaningRobot.class); - EQUIPMENTS.add(Dishwasher.class); - EQUIPMENTS.add(Door.class); - EQUIPMENTS.add(Doorbell.class); - EQUIPMENTS.add(Dryer.class); - EQUIPMENTS.add(Fan.class); - EQUIPMENTS.add(Freezer.class); - EQUIPMENTS.add(FrontDoor.class); - EQUIPMENTS.add(GarageDoor.class); - EQUIPMENTS.add(Gate.class); - EQUIPMENTS.add(HVAC.class); - EQUIPMENTS.add(InnerDoor.class); - EQUIPMENTS.add(Inverter.class); - EQUIPMENTS.add(KitchenHood.class); - EQUIPMENTS.add(LawnMower.class); - EQUIPMENTS.add(LightStripe.class); - EQUIPMENTS.add(Lightbulb.class); - EQUIPMENTS.add(Lock.class); - EQUIPMENTS.add(MotionDetector.class); - EQUIPMENTS.add(NetworkAppliance.class); - EQUIPMENTS.add(Oven.class); - EQUIPMENTS.add(PowerOutlet.class); - EQUIPMENTS.add(Projector.class); - EQUIPMENTS.add(Pump.class); - EQUIPMENTS.add(RadiatorControl.class); - EQUIPMENTS.add(Receiver.class); - EQUIPMENTS.add(Refrigerator.class); - EQUIPMENTS.add(RemoteControl.class); - EQUIPMENTS.add(Screen.class); - EQUIPMENTS.add(Sensor.class); - EQUIPMENTS.add(SideDoor.class); - EQUIPMENTS.add(Siren.class); - EQUIPMENTS.add(Smartphone.class); - EQUIPMENTS.add(SmokeDetector.class); - EQUIPMENTS.add(Speaker.class); - EQUIPMENTS.add(Television.class); - EQUIPMENTS.add(Valve.class); - EQUIPMENTS.add(VoiceAssistant.class); - EQUIPMENTS.add(WallSwitch.class); - EQUIPMENTS.add(WashingMachine.class); - EQUIPMENTS.add(WeatherService.class); - EQUIPMENTS.add(WebService.class); - EQUIPMENTS.add(WhiteGood.class); - EQUIPMENTS.add(Window.class); - } - - public static Stream> stream() { - return EQUIPMENTS.stream(); - } - - public static boolean add(Class tag) { - return EQUIPMENTS.add(tag); - } -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Fan.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Fan.java deleted file mode 100644 index 8df120d40b7..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Fan.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Fan. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Fan", label = "Fan", synonyms = "Fans", description = "") -public interface Fan extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Freezer.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Freezer.java deleted file mode 100644 index da57322726f..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Freezer.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Freezer. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_WhiteGood_Freezer", label = "Freezer", synonyms = "Freezers", description = "") -public interface Freezer extends WhiteGood { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/FrontDoor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/FrontDoor.java deleted file mode 100644 index 4fd6ce52306..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/FrontDoor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Front Door. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Door_FrontDoor", label = "Front Door", synonyms = "Front Doors, Frontdoor, Frontdoors", description = "") -public interface FrontDoor extends Door { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/GarageDoor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/GarageDoor.java deleted file mode 100644 index 177c0eb1981..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/GarageDoor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Garage Door. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Door_GarageDoor", label = "Garage Door", synonyms = "Garage Doors", description = "") -public interface GarageDoor extends Door { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Gate.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Gate.java deleted file mode 100644 index beadc24bce1..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Gate.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Gate. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Door_Gate", label = "Gate", synonyms = "Gates", description = "") -public interface Gate extends Door { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/HVAC.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/HVAC.java deleted file mode 100644 index 0073408c846..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/HVAC.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a HVAC. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_HVAC", label = "HVAC", synonyms = "Heating, Ventilation, Air Conditioning, A/C, A/Cs, AC", description = "") -public interface HVAC extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/InnerDoor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/InnerDoor.java deleted file mode 100644 index bfc3f11d2e9..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/InnerDoor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Inner Door. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Door_InnerDoor", label = "Inner Door", synonyms = "Inner Doors", description = "") -public interface InnerDoor extends Door { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Inverter.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Inverter.java deleted file mode 100644 index 303893113d3..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Inverter.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Inverter. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Inverter", label = "Inverter", synonyms = "Inverters", description = "") -public interface Inverter extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/KitchenHood.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/KitchenHood.java deleted file mode 100644 index e53b7f56860..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/KitchenHood.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Kitchen Hood. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Fan_KitchenHood", label = "Kitchen Hood", synonyms = "Kitchen Hoods", description = "") -public interface KitchenHood extends Fan { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/LawnMower.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/LawnMower.java deleted file mode 100644 index 9b354437dbb..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/LawnMower.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Lawn Mower. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_LawnMower", label = "Lawn Mower", synonyms = "Lawn Mowers", description = "") -public interface LawnMower extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/LightStripe.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/LightStripe.java deleted file mode 100644 index 7e628d3b9cf..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/LightStripe.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Light Stripe. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Lightbulb_LightStripe", label = "Light Stripe", synonyms = "Light Stripes", description = "") -public interface LightStripe extends Lightbulb { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Lightbulb.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Lightbulb.java deleted file mode 100644 index 76eb0d4992d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Lightbulb.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Lightbulb. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Lightbulb", label = "Lightbulb", synonyms = "Lightbulbs, Bulb, Bulbs, Lamp, Lamps, Lights, Lighting", description = "") -public interface Lightbulb extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Lock.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Lock.java deleted file mode 100644 index 26c303b1329..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Lock.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Lock. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Lock", label = "Lock", synonyms = "Locks", description = "") -public interface Lock extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/MotionDetector.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/MotionDetector.java deleted file mode 100644 index 3a7c0f40ffa..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/MotionDetector.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Motion Detector. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Sensor_MotionDetector", label = "Motion Detector", synonyms = "Motion Detectors, Motion sensor, Motion sensors", description = "") -public interface MotionDetector extends Sensor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/NetworkAppliance.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/NetworkAppliance.java deleted file mode 100644 index e873a53d2a0..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/NetworkAppliance.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Network Appliance. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_NetworkAppliance", label = "Network Appliance", synonyms = "Network Appliances", description = "") -public interface NetworkAppliance extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Oven.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Oven.java deleted file mode 100644 index 18578cd0d6c..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Oven.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Oven. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_WhiteGood_Oven", label = "Oven", synonyms = "Ovens", description = "") -public interface Oven extends WhiteGood { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/PowerOutlet.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/PowerOutlet.java deleted file mode 100644 index bbeb001eb4f..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/PowerOutlet.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Power Outlet. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_PowerOutlet", label = "Power Outlet", synonyms = "Power Outlets, Outlet, Outlets", description = "") -public interface PowerOutlet extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Projector.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Projector.java deleted file mode 100644 index 5fb617c4692..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Projector.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Projector. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Projector", label = "Projector", synonyms = "Projectors, Beamer, Beamers", description = "") -public interface Projector extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Pump.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Pump.java deleted file mode 100644 index 02cd22bebb0..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Pump.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Pump. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Pump", label = "Pump", synonyms = "Pumps", description = "") -public interface Pump extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/RadiatorControl.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/RadiatorControl.java deleted file mode 100644 index 882289fa68f..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/RadiatorControl.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Radiator Control. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_RadiatorControl", label = "Radiator Control", synonyms = "Radiator Controls, Radiator, Radiators", description = "") -public interface RadiatorControl extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Receiver.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Receiver.java deleted file mode 100644 index d1cdfe7b87a..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Receiver.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Receiver. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Receiver", label = "Receiver", synonyms = "Receivers, Audio Receiver, Audio Receivers, AV Receiver, AV Receivers", description = "") -public interface Receiver extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Refrigerator.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Refrigerator.java deleted file mode 100644 index fa855447615..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Refrigerator.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Refrigerator. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_WhiteGood_Refrigerator", label = "Refrigerator", synonyms = "Refrigerators", description = "") -public interface Refrigerator extends WhiteGood { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/RemoteControl.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/RemoteControl.java deleted file mode 100644 index 4befed3c843..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/RemoteControl.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Remote Control. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_RemoteControl", label = "Remote Control", synonyms = "Remote Controls", description = "") -public interface RemoteControl extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Screen.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Screen.java deleted file mode 100644 index c3cb10e0c2e..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Screen.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Screen. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Screen", label = "Screen", synonyms = "Screens", description = "") -public interface Screen extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Sensor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Sensor.java deleted file mode 100644 index ef60408ada6..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Sensor.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Sensor. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Sensor", label = "Sensor", synonyms = "Sensors", description = "") -public interface Sensor extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/SideDoor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/SideDoor.java deleted file mode 100644 index ba2e3bb1595..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/SideDoor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Side Door. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Door_SideDoor", label = "Side Door", synonyms = "Side Doors", description = "") -public interface SideDoor extends Door { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Siren.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Siren.java deleted file mode 100644 index e436b39ebbc..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Siren.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Siren. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Siren", label = "Siren", synonyms = "Sirens", description = "") -public interface Siren extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Smartphone.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Smartphone.java deleted file mode 100644 index fbecc781aab..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Smartphone.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Smartphone. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Smartphone", label = "Smartphone", synonyms = "Smartphones, Phone, Phones", description = "") -public interface Smartphone extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/SmokeDetector.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/SmokeDetector.java deleted file mode 100644 index 2ee50b2ea44..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/SmokeDetector.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Smoke Detector. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Sensor_SmokeDetector", label = "Smoke Detector", synonyms = "Smoke Detectors", description = "") -public interface SmokeDetector extends Sensor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Speaker.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Speaker.java deleted file mode 100644 index ce42af983c8..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Speaker.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Speaker. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Speaker", label = "Speaker", synonyms = "Speakers", description = "") -public interface Speaker extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Television.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Television.java deleted file mode 100644 index c84af6d7cc4..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Television.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Television. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Screen_Television", label = "Television", synonyms = "Televisions, TV, TVs", description = "") -public interface Television extends Screen { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Valve.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Valve.java deleted file mode 100644 index a30ad2fd9a6..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Valve.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Valve. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Valve", label = "Valve", synonyms = "Valves", description = "") -public interface Valve extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/VoiceAssistant.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/VoiceAssistant.java deleted file mode 100644 index af28a055e85..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/VoiceAssistant.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Voice Assistant. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_VoiceAssistant", label = "Voice Assistant", synonyms = "Voice Assistants", description = "") -public interface VoiceAssistant extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WallSwitch.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WallSwitch.java deleted file mode 100644 index d2d68e2d85d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WallSwitch.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Wall Switch. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_WallSwitch", label = "Wall Switch", synonyms = "Wall Switches", description = "") -public interface WallSwitch extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WashingMachine.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WashingMachine.java deleted file mode 100644 index b70aa93db22..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WashingMachine.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Washing Machine. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_WhiteGood_WashingMachine", label = "Washing Machine", synonyms = "Washing Machines", description = "") -public interface WashingMachine extends WhiteGood { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WeatherService.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WeatherService.java deleted file mode 100644 index 2f3118d3bc0..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WeatherService.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Weather Service. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_WebService_WeatherService", label = "Weather Service", synonyms = "Weather Services", description = "") -public interface WeatherService extends WebService { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WebService.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WebService.java deleted file mode 100644 index 33f14f5500e..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WebService.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Web Service. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_WebService", label = "Web Service", synonyms = "Web Services", description = "") -public interface WebService extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WhiteGood.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WhiteGood.java deleted file mode 100644 index 687e056dbd6..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/WhiteGood.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a White Good. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_WhiteGood", label = "White Good", synonyms = "White Goods", description = "") -public interface WhiteGood extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Window.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Window.java deleted file mode 100644 index d2f305cb128..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Window.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.equipment; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Equipment; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Window. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Equipment_Window", label = "Window", synonyms = "Windows", description = "") -public interface Window extends Equipment { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Apartment.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Apartment.java deleted file mode 100644 index 389e7844dc9..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Apartment.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Apartment. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Apartment", label = "Apartment", synonyms = "Apartments", description = "") -public interface Apartment extends Indoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Attic.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Attic.java deleted file mode 100644 index f766e622e1d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Attic.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Attic. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Floor_Attic", label = "Attic", synonyms = "Attics", description = "") -public interface Attic extends Floor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Basement.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Basement.java deleted file mode 100644 index 8fc8cb3baad..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Basement.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Basement. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Floor_Basement", label = "Basement", synonyms = "Basements", description = "") -public interface Basement extends Floor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Bathroom.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Bathroom.java deleted file mode 100644 index 4b6c3fb78b4..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Bathroom.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Bathroom. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_Bathroom", label = "Bathroom", synonyms = "Bathrooms, Bath, Baths, Powder Room, Powder Rooms", description = "") -public interface Bathroom extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Bedroom.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Bedroom.java deleted file mode 100644 index 8c5c0fc987b..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Bedroom.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Bedroom. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_Bedroom", label = "Bedroom", synonyms = "Bedrooms", description = "") -public interface Bedroom extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/BoilerRoom.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/BoilerRoom.java deleted file mode 100644 index d149ef4468d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/BoilerRoom.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Boiler Room. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_BoilerRoom", label = "Boiler Room", synonyms = "Boiler Rooms", description = "") -public interface BoilerRoom extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Building.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Building.java deleted file mode 100644 index 46577c537f6..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Building.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Building. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Building", label = "Building", synonyms = "Buildings", description = "") -public interface Building extends Indoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Carport.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Carport.java deleted file mode 100644 index 322ddfe103e..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Carport.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Carport. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Outdoor_Carport", label = "Carport", synonyms = "Carports", description = "") -public interface Carport extends Outdoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Cellar.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Cellar.java deleted file mode 100644 index e5f0ab2709b..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Cellar.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Cellar. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_Cellar", label = "Cellar", synonyms = "Cellars", description = "") -public interface Cellar extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Corridor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Corridor.java deleted file mode 100644 index 6509b82659e..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Corridor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Corridor. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Corridor", label = "Corridor", synonyms = "Corridors, Hallway, Hallways", description = "") -public interface Corridor extends Indoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/DiningRoom.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/DiningRoom.java deleted file mode 100644 index 21c7affc1d7..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/DiningRoom.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Dining Room. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_DiningRoom", label = "Dining Room", synonyms = "Dining Rooms", description = "") -public interface DiningRoom extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Driveway.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Driveway.java deleted file mode 100644 index 44930624558..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Driveway.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Driveway. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Outdoor_Driveway", label = "Driveway", synonyms = "Driveways", description = "") -public interface Driveway extends Outdoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Entry.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Entry.java deleted file mode 100644 index f88c4f10bd7..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Entry.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Entry. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_Entry", label = "Entry", synonyms = "Entries, Foyer, Foyers", description = "") -public interface Entry extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/FamilyRoom.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/FamilyRoom.java deleted file mode 100644 index d4c095f059d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/FamilyRoom.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Family Room. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_FamilyRoom", label = "Family Room", synonyms = "Family Rooms", description = "") -public interface FamilyRoom extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/FirstFloor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/FirstFloor.java deleted file mode 100644 index 977606b7ea5..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/FirstFloor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a First Floor. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Floor_FirstFloor", label = "First Floor", synonyms = "First Floors, Upstairs", description = "") -public interface FirstFloor extends Floor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Floor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Floor.java deleted file mode 100644 index e6a71e4e6a5..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Floor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Floor. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Floor", label = "Floor", synonyms = "Floors", description = "") -public interface Floor extends Indoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Garage.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Garage.java deleted file mode 100644 index 8f592538f52..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Garage.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Garage. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Building_Garage", label = "Garage", synonyms = "Garages", description = "") -public interface Garage extends Building { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Garden.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Garden.java deleted file mode 100644 index 1efedd39b76..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Garden.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Garden. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Outdoor_Garden", label = "Garden", synonyms = "Gardens", description = "") -public interface Garden extends Outdoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/GroundFloor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/GroundFloor.java deleted file mode 100644 index b8b2942d71c..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/GroundFloor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Ground Floor. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Floor_GroundFloor", label = "Ground Floor", synonyms = "Ground Floors, Downstairs", description = "") -public interface GroundFloor extends Floor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/GuestRoom.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/GuestRoom.java deleted file mode 100644 index cfafb8f99ff..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/GuestRoom.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Guest Room. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_GuestRoom", label = "Guest Room", synonyms = "Guest Rooms", description = "") -public interface GuestRoom extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/House.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/House.java deleted file mode 100644 index b22410e8c55..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/House.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a House. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Building_House", label = "House", synonyms = "Houses", description = "") -public interface House extends Building { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Indoor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Indoor.java deleted file mode 100644 index 48c652aaa85..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Indoor.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Location; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Indoor. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor", label = "Indoor", synonyms = "", description = "Anything that is inside a closed building") -public interface Indoor extends Location { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Kitchen.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Kitchen.java deleted file mode 100644 index ffdd06d2786..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Kitchen.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Kitchen. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_Kitchen", label = "Kitchen", synonyms = "Kitchens", description = "") -public interface Kitchen extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/LaundryRoom.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/LaundryRoom.java deleted file mode 100644 index 98f46395ba3..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/LaundryRoom.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Laundry Room. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_LaundryRoom", label = "Laundry Room", synonyms = "Laundry Rooms", description = "") -public interface LaundryRoom extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/LivingRoom.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/LivingRoom.java deleted file mode 100644 index c23557395b7..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/LivingRoom.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Living Room. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_LivingRoom", label = "Living Room", synonyms = "Living Rooms", description = "") -public interface LivingRoom extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Locations.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Locations.java deleted file mode 100644 index 6c5063dfb1d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Locations.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Stream; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Location; - -/** - * This class provides a stream of all defined locations. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -public class Locations { - - static final Set> LOCATIONS = new HashSet<>(); - - static { - LOCATIONS.add(Location.class); - LOCATIONS.add(Apartment.class); - LOCATIONS.add(Attic.class); - LOCATIONS.add(Basement.class); - LOCATIONS.add(Bathroom.class); - LOCATIONS.add(Bedroom.class); - LOCATIONS.add(BoilerRoom.class); - LOCATIONS.add(Building.class); - LOCATIONS.add(Carport.class); - LOCATIONS.add(Cellar.class); - LOCATIONS.add(Corridor.class); - LOCATIONS.add(DiningRoom.class); - LOCATIONS.add(Driveway.class); - LOCATIONS.add(Entry.class); - LOCATIONS.add(FamilyRoom.class); - LOCATIONS.add(FirstFloor.class); - LOCATIONS.add(Floor.class); - LOCATIONS.add(Garage.class); - LOCATIONS.add(Garden.class); - LOCATIONS.add(GroundFloor.class); - LOCATIONS.add(GuestRoom.class); - LOCATIONS.add(House.class); - LOCATIONS.add(Indoor.class); - LOCATIONS.add(Kitchen.class); - LOCATIONS.add(LaundryRoom.class); - LOCATIONS.add(LivingRoom.class); - LOCATIONS.add(Office.class); - LOCATIONS.add(Outdoor.class); - LOCATIONS.add(Patio.class); - LOCATIONS.add(Porch.class); - LOCATIONS.add(Room.class); - LOCATIONS.add(SecondFloor.class); - LOCATIONS.add(Shed.class); - LOCATIONS.add(SummerHouse.class); - LOCATIONS.add(Terrace.class); - LOCATIONS.add(ThirdFloor.class); - LOCATIONS.add(Veranda.class); - } - - public static Stream> stream() { - return LOCATIONS.stream(); - } - - public static boolean add(Class tag) { - return LOCATIONS.add(tag); - } -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Office.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Office.java deleted file mode 100644 index e5b29630351..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Office.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Office. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_Office", label = "Office", synonyms = "Offices", description = "") -public interface Office extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Outdoor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Outdoor.java deleted file mode 100644 index 5e0b0ede4e4..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Outdoor.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Location; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Outdoor. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Outdoor", label = "Outdoor", synonyms = "", description = "") -public interface Outdoor extends Location { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Patio.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Patio.java deleted file mode 100644 index 673db0ae90f..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Patio.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Patio. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Outdoor_Patio", label = "Patio", synonyms = "Patios", description = "") -public interface Patio extends Outdoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Porch.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Porch.java deleted file mode 100644 index 239fb09fecb..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Porch.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Porch. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Outdoor_Porch", label = "Porch", synonyms = "Porches", description = "") -public interface Porch extends Outdoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Room.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Room.java deleted file mode 100644 index fcde06a6013..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Room.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Room. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room", label = "Room", synonyms = "Rooms", description = "") -public interface Room extends Indoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/SecondFloor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/SecondFloor.java deleted file mode 100644 index 9dd926a9a5d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/SecondFloor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Second Floor. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Floor_SecondFloor", label = "Second Floor", synonyms = "Second Floors", description = "") -public interface SecondFloor extends Floor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Shed.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Shed.java deleted file mode 100644 index 016b82fd6ce..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Shed.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Shed. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Building_Shed", label = "Shed", synonyms = "Sheds", description = "") -public interface Shed extends Building { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/SummerHouse.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/SummerHouse.java deleted file mode 100644 index 2aabcebaa04..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/SummerHouse.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Summer House. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Building_SummerHouse", label = "Summer House", synonyms = "Summer Houses, Second Home, Second Homes", description = "") -public interface SummerHouse extends Building { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Terrace.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Terrace.java deleted file mode 100644 index 9d1ac8800b2..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Terrace.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Terrace. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Outdoor_Terrace", label = "Terrace", synonyms = "Terraces, Deck, Decks", description = "") -public interface Terrace extends Outdoor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/ThirdFloor.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/ThirdFloor.java deleted file mode 100644 index 02f6fe4a2a9..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/ThirdFloor.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Third Floor. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Floor_ThirdFloor", label = "Third Floor", synonyms = "Third Floors", description = "") -public interface ThirdFloor extends Floor { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Veranda.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Veranda.java deleted file mode 100644 index 2138ef6aba3..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Veranda.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.location; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Veranda. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Location_Indoor_Room_Veranda", label = "Veranda", synonyms = "Verandas", description = "") -public interface Veranda extends Room { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Alarm.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Alarm.java deleted file mode 100644 index 580573b6c22..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Alarm.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Point; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Alarm. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Point_Alarm", label = "Alarm", synonyms = "", description = "") -public interface Alarm extends Point { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Control.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Control.java deleted file mode 100644 index 963d242091b..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Control.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Point; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Control. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Point_Control", label = "Control", synonyms = "", description = "") -public interface Control extends Point { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/LowBattery.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/LowBattery.java deleted file mode 100644 index 52b9708f90a..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/LowBattery.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a LowBattery. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Point_Status_LowBattery", label = "LowBattery", synonyms = "", description = "") -public interface LowBattery extends Status { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Measurement.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Measurement.java deleted file mode 100644 index 7cf717f6c12..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Measurement.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Point; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Measurement. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Point_Measurement", label = "Measurement", synonyms = "", description = "") -public interface Measurement extends Point { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/OpenLevel.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/OpenLevel.java deleted file mode 100644 index 374d422f57d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/OpenLevel.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an OpenLevel. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Point_Status_OpenLevel", label = "OpenLevel", synonyms = "", description = "") -public interface OpenLevel extends Status { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/OpenState.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/OpenState.java deleted file mode 100644 index a03d0918e02..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/OpenState.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an OpenState. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Point_Status_OpenState", label = "OpenState", synonyms = "", description = "") -public interface OpenState extends Status { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Points.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Points.java deleted file mode 100644 index d7950695f1e..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Points.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Stream; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Point; - -/** - * This class provides a stream of all defined points. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -public class Points { - - static final Set> POINTS = new HashSet<>(); - - static { - POINTS.add(Point.class); - POINTS.add(Alarm.class); - POINTS.add(Control.class); - POINTS.add(LowBattery.class); - POINTS.add(Measurement.class); - POINTS.add(OpenLevel.class); - POINTS.add(OpenState.class); - POINTS.add(Setpoint.class); - POINTS.add(Status.class); - POINTS.add(Switch.class); - POINTS.add(Tampered.class); - POINTS.add(Tilt.class); - } - - public static Stream> stream() { - return POINTS.stream(); - } - - public static boolean add(Class tag) { - return POINTS.add(tag); - } -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Setpoint.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Setpoint.java deleted file mode 100644 index 68bc3136b12..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Setpoint.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Point; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Setpoint. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Point_Setpoint", label = "Setpoint", synonyms = "", description = "") -public interface Setpoint extends Point { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Status.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Status.java deleted file mode 100644 index d3a844a9c79..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Status.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Point; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Status. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Point_Status", label = "Status", synonyms = "", description = "") -public interface Status extends Point { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Switch.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Switch.java deleted file mode 100644 index 0fbb27945f0..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Switch.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Switch. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Point_Control_Switch", label = "Switch", synonyms = "", description = "") -public interface Switch extends Control { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Tampered.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Tampered.java deleted file mode 100644 index ac65fdb63ab..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Tampered.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.point; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Tampered. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Point_Status_Tampered", label = "Tampered", synonyms = "", description = "") -public interface Tampered extends Status { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/CO.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/CO.java deleted file mode 100644 index cf5c8824a29..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/CO.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a CO. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_CO", label = "CO", synonyms = "Carbon Monoxide", description = "") -public interface CO extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/CO2.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/CO2.java deleted file mode 100644 index 13d29f113f7..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/CO2.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a CO2. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_CO2", label = "CO2", synonyms = "Carbon Dioxide", description = "") -public interface CO2 extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/ColorTemperature.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/ColorTemperature.java deleted file mode 100644 index 3c1e2ee1f89..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/ColorTemperature.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Color Temperature. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_ColorTemperature", label = "Color Temperature", synonyms = "", description = "") -public interface ColorTemperature extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Current.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Current.java deleted file mode 100644 index 2f944e0c003..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Current.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Current. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Current", label = "Current", synonyms = "", description = "") -public interface Current extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Duration.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Duration.java deleted file mode 100644 index 7ef6b3c766f..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Duration.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Duration. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Duration", label = "Duration", synonyms = "", description = "") -public interface Duration extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Energy.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Energy.java deleted file mode 100644 index e52abd5ae9c..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Energy.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Energy. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Energy", label = "Energy", synonyms = "", description = "") -public interface Energy extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Frequency.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Frequency.java deleted file mode 100644 index 5458939f559..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Frequency.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Frequency. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Frequency", label = "Frequency", synonyms = "", description = "") -public interface Frequency extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Gas.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Gas.java deleted file mode 100644 index 94d71e28c1b..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Gas.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Gas. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Gas", label = "Gas", synonyms = "", description = "") -public interface Gas extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Humidity.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Humidity.java deleted file mode 100644 index 6d2781b9d87..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Humidity.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Humidity. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Humidity", label = "Humidity", synonyms = "Moisture", description = "") -public interface Humidity extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Level.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Level.java deleted file mode 100644 index 85411489ebb..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Level.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Level. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Level", label = "Level", synonyms = "", description = "") -public interface Level extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Light.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Light.java deleted file mode 100644 index 81d999cea9c..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Light.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Light. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Light", label = "Light", synonyms = "Lights, Lighting", description = "") -public interface Light extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Noise.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Noise.java deleted file mode 100644 index f59869d58bb..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Noise.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Noise. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Noise", label = "Noise", synonyms = "", description = "") -public interface Noise extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Oil.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Oil.java deleted file mode 100644 index c90daa7e054..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Oil.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Oil. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Oil", label = "Oil", synonyms = "", description = "") -public interface Oil extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Opening.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Opening.java deleted file mode 100644 index 1f1ba1dde1d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Opening.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Opening. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Opening", label = "Opening", synonyms = "", description = "") -public interface Opening extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Power.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Power.java deleted file mode 100644 index 3da7279a987..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Power.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Power. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Power", label = "Power", synonyms = "", description = "") -public interface Power extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Presence.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Presence.java deleted file mode 100644 index 1b3d2adeaf8..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Presence.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Presence. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Presence", label = "Presence", synonyms = "", description = "") -public interface Presence extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Pressure.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Pressure.java deleted file mode 100644 index c71a2a4a667..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Pressure.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Pressure. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Pressure", label = "Pressure", synonyms = "", description = "") -public interface Pressure extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Properties.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Properties.java deleted file mode 100644 index 06de5ebba85..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Properties.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Stream; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; - -/** - * This class provides a stream of all defined properties. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -public class Properties { - - static final Set> PROPERTIES = new HashSet<>(); - - static { - PROPERTIES.add(Property.class); - PROPERTIES.add(CO.class); - PROPERTIES.add(CO2.class); - PROPERTIES.add(ColorTemperature.class); - PROPERTIES.add(Current.class); - PROPERTIES.add(Duration.class); - PROPERTIES.add(Energy.class); - PROPERTIES.add(Frequency.class); - PROPERTIES.add(Gas.class); - PROPERTIES.add(Humidity.class); - PROPERTIES.add(Level.class); - PROPERTIES.add(Light.class); - PROPERTIES.add(Noise.class); - PROPERTIES.add(Oil.class); - PROPERTIES.add(Opening.class); - PROPERTIES.add(Power.class); - PROPERTIES.add(Presence.class); - PROPERTIES.add(Pressure.class); - PROPERTIES.add(Rain.class); - PROPERTIES.add(Smoke.class); - PROPERTIES.add(SoundVolume.class); - PROPERTIES.add(Temperature.class); - PROPERTIES.add(Timestamp.class); - PROPERTIES.add(Ultraviolet.class); - PROPERTIES.add(Vibration.class); - PROPERTIES.add(Voltage.class); - PROPERTIES.add(Water.class); - PROPERTIES.add(Wind.class); - } - - public static Stream> stream() { - return PROPERTIES.stream(); - } - - public static boolean add(Class tag) { - return PROPERTIES.add(tag); - } -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Rain.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Rain.java deleted file mode 100644 index f4f53b5e98b..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Rain.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Rain. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Rain", label = "Rain", synonyms = "", description = "") -public interface Rain extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Smoke.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Smoke.java deleted file mode 100644 index 4aeea0f353a..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Smoke.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Smoke. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Smoke", label = "Smoke", synonyms = "", description = "") -public interface Smoke extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/SoundVolume.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/SoundVolume.java deleted file mode 100644 index 4a820588833..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/SoundVolume.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Sound Volume. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_SoundVolume", label = "Sound Volume", synonyms = "", description = "") -public interface SoundVolume extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Temperature.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Temperature.java deleted file mode 100644 index 94a4b4cbf0f..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Temperature.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Temperature. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Temperature", label = "Temperature", synonyms = "Temperatures", description = "") -public interface Temperature extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Timestamp.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Timestamp.java deleted file mode 100644 index b429c1b4e99..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Timestamp.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Timestamp. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Timestamp", label = "Timestamp", synonyms = "", description = "") -public interface Timestamp extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Ultraviolet.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Ultraviolet.java deleted file mode 100644 index 0c6266a845d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Ultraviolet.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines an Ultraviolet. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Ultraviolet", label = "Ultraviolet", synonyms = "UV", description = "") -public interface Ultraviolet extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Vibration.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Vibration.java deleted file mode 100644 index 99f0aa58f90..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Vibration.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Vibration. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Vibration", label = "Vibration", synonyms = "", description = "") -public interface Vibration extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Voltage.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Voltage.java deleted file mode 100644 index e8e3c163d6a..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Voltage.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Voltage. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Voltage", label = "Voltage", synonyms = "", description = "") -public interface Voltage extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Water.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Water.java deleted file mode 100644 index 6bbe90ad11b..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Water.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Water. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Water", label = "Water", synonyms = "", description = "") -public interface Water extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Wind.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Wind.java deleted file mode 100644 index 92a1e7c0e9d..00000000000 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Wind.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2010-2023 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.semantics.model.property; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.semantics.Property; -import org.openhab.core.semantics.TagInfo; - -/** - * This class defines a Wind. - * - * @author Generated from generateTagClasses.groovy - Initial contribution - */ -@NonNullByDefault -@TagInfo(id = "Property_Wind", label = "Wind", synonyms = "", description = "") -public interface Wind extends Property { -} diff --git a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticTagsTest.java b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticTagsTest.java index 56043f29e34..d17c798ea25 100644 --- a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticTagsTest.java +++ b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticTagsTest.java @@ -12,43 +12,48 @@ */ package org.openhab.core.semantics; -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.*; -import java.util.Locale; +import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; import org.openhab.core.i18n.UnitProvider; import org.openhab.core.items.GenericItem; import org.openhab.core.items.GroupItem; import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.semantics.model.equipment.CleaningRobot; -import org.openhab.core.semantics.model.equipment.Equipments; -import org.openhab.core.semantics.model.location.Bathroom; -import org.openhab.core.semantics.model.location.Kitchen; -import org.openhab.core.semantics.model.location.Locations; -import org.openhab.core.semantics.model.location.Room; -import org.openhab.core.semantics.model.point.Measurement; -import org.openhab.core.semantics.model.point.Points; -import org.openhab.core.semantics.model.property.Light; -import org.openhab.core.semantics.model.property.Properties; -import org.openhab.core.semantics.model.property.SoundVolume; -import org.openhab.core.semantics.model.property.Temperature; +import org.openhab.core.semantics.internal.SemanticTagRegistryImpl; +import org.openhab.core.semantics.model.DefaultSemanticTagProvider; /** * @author Kai Kreuzer - Initial contribution */ @NonNullByDefault +@ExtendWith(MockitoExtension.class) public class SemanticTagsTest { + private static final String CUSTOM_LOCATION = "CustomLocation"; + private static final String CUSTOM_EQUIPMENT = "CustomEquipment"; + private static final String CUSTOM_POINT = "CustomPoint"; + private static final String CUSTOM_PROPERTY = "CustomProperty"; + + private @Mock @NonNullByDefault({}) ManagedSemanticTagProvider managedSemanticTagProviderMock; + private @NonNullByDefault({}) GroupItem locationItem; private @NonNullByDefault({}) GroupItem equipmentItem; private @NonNullByDefault({}) GenericItem pointItem; + private @NonNullByDefault({}) Class roomTagClass; + private @NonNullByDefault({}) Class bathroomTagClass; + private @NonNullByDefault({}) Class cleaningRobotTagClass; + private @NonNullByDefault({}) Class measurementTagClass; + private @NonNullByDefault({}) Class temperatureTagClass; + @BeforeEach public void setup() { CoreItemFactory itemFactory = new CoreItemFactory(mock(UnitProvider.class)); @@ -62,85 +67,75 @@ public void setup() { pointItem = itemFactory.createItem(CoreItemFactory.NUMBER, "TestTemperature"); pointItem.addTag("Measurement"); pointItem.addTag("Temperature"); - } - - @Test - public void testByTagId() { - assertEquals(Location.class, SemanticTags.getById("Location")); - assertEquals(Room.class, SemanticTags.getById("Room")); - assertEquals(Room.class, SemanticTags.getById("Location_Indoor_Room")); - assertEquals(Bathroom.class, SemanticTags.getById("Bathroom")); - assertEquals(Bathroom.class, SemanticTags.getById("Room_Bathroom")); - assertEquals(Bathroom.class, SemanticTags.getById("Indoor_Room_Bathroom")); - assertEquals(Bathroom.class, SemanticTags.getById("Location_Indoor_Room_Bathroom")); - } - - @Test - public void testByLabel() { - assertEquals(Kitchen.class, SemanticTags.getByLabel("Kitchen", Locale.ENGLISH)); - assertEquals(Kitchen.class, SemanticTags.getByLabel("Küche", Locale.GERMAN)); - assertNull(SemanticTags.getByLabel("Bad", Locale.GERMAN)); - } - @Test - public void testByLabelOrSynonym() { - assertEquals(Kitchen.class, SemanticTags.getByLabelOrSynonym("Kitchen", Locale.ENGLISH).iterator().next()); - assertEquals(Kitchen.class, SemanticTags.getByLabelOrSynonym("Küche", Locale.GERMAN).iterator().next()); - assertEquals(Bathroom.class, SemanticTags.getByLabelOrSynonym("Badezimmer", Locale.GERMAN).iterator().next()); - } + SemanticTag customLocationTag = new SemanticTagImpl("Location_" + CUSTOM_LOCATION, null, null, List.of()); + SemanticTag customEquipmentTag = new SemanticTagImpl("Equipment_" + CUSTOM_EQUIPMENT, null, null, List.of()); + SemanticTag customPointTag = new SemanticTagImpl("Point_" + CUSTOM_POINT, null, null, List.of()); + SemanticTag customPropertyTag = new SemanticTagImpl("Property_" + CUSTOM_PROPERTY, null, null, List.of()); + when(managedSemanticTagProviderMock.getAll()) + .thenReturn(List.of(customLocationTag, customEquipmentTag, customPointTag, customPropertyTag)); + new SemanticTagRegistryImpl(new DefaultSemanticTagProvider(), managedSemanticTagProviderMock); - @Test - public void testGetLabel() { - assertEquals("Kitchen", SemanticTags.getLabel(Kitchen.class, Locale.ENGLISH)); - assertEquals("Sound Volume", SemanticTags.getLabel(SoundVolume.class, Locale.ENGLISH)); + roomTagClass = SemanticTags.getById("Location_Indoor_Room"); + bathroomTagClass = SemanticTags.getById("Location_Indoor_Room_Bathroom"); + cleaningRobotTagClass = SemanticTags.getById("Equipment_CleaningRobot"); + measurementTagClass = SemanticTags.getById("Point_Measurement"); + temperatureTagClass = SemanticTags.getById("Property_Temperature"); } @Test - public void testGetSynonyms() { - assertThat(SemanticTags.getSynonyms(Light.class, Locale.ENGLISH), hasItems("Lights", "Lighting")); + public void testTagClasses() { + assertNotNull(roomTagClass); + assertNotNull(bathroomTagClass); + assertNotNull(cleaningRobotTagClass); + assertNotNull(measurementTagClass); + assertNotNull(temperatureTagClass); } @Test - public void testGetDescription() { - Class tag = SemanticTags.add("TestDesc", Light.class, null, null, "Test Description"); - assertEquals("Test Description", SemanticTags.getDescription(tag, Locale.ENGLISH)); + public void testByTagId() { + assertEquals(Location.class, SemanticTags.getById("Location")); + assertEquals(roomTagClass, SemanticTags.getById("Room")); + assertEquals(roomTagClass, SemanticTags.getById("Indoor_Room")); + assertEquals(roomTagClass, SemanticTags.getById("Location_Indoor_Room")); + assertEquals(bathroomTagClass, SemanticTags.getById("Bathroom")); + assertEquals(bathroomTagClass, SemanticTags.getById("Room_Bathroom")); + assertEquals(bathroomTagClass, SemanticTags.getById("Indoor_Room_Bathroom")); + assertEquals(bathroomTagClass, SemanticTags.getById("Location_Indoor_Room_Bathroom")); } @Test public void testGetSemanticType() { - assertEquals(Bathroom.class, SemanticTags.getSemanticType(locationItem)); - assertEquals(CleaningRobot.class, SemanticTags.getSemanticType(equipmentItem)); - assertEquals(Measurement.class, SemanticTags.getSemanticType(pointItem)); + assertEquals(bathroomTagClass, SemanticTags.getSemanticType(locationItem)); + assertEquals(cleaningRobotTagClass, SemanticTags.getSemanticType(equipmentItem)); + assertEquals(measurementTagClass, SemanticTags.getSemanticType(pointItem)); } @Test public void testGetLocation() { - assertEquals(Bathroom.class, SemanticTags.getLocation(locationItem)); + assertEquals(bathroomTagClass, SemanticTags.getLocation(locationItem)); } @Test public void testGetEquipment() { - assertEquals(CleaningRobot.class, SemanticTags.getEquipment(equipmentItem)); + assertEquals(cleaningRobotTagClass, SemanticTags.getEquipment(equipmentItem)); } @Test public void testGetPoint() { - assertEquals(Measurement.class, SemanticTags.getPoint(pointItem)); + assertEquals(measurementTagClass, SemanticTags.getPoint(pointItem)); } @Test public void testGetProperty() { - assertEquals(Temperature.class, SemanticTags.getProperty(pointItem)); + assertEquals(temperatureTagClass, SemanticTags.getProperty(pointItem)); } @Test public void testAddLocation() { - String tagName = "CustomLocation"; - Class customTag = SemanticTags.add(tagName, Location.class); + String tagName = CUSTOM_LOCATION; + Class customTag = SemanticTags.getById(tagName); assertNotNull(customTag); - assertEquals(customTag, SemanticTags.getById(tagName)); - assertEquals(customTag, SemanticTags.getByLabel("Custom Location", Locale.getDefault())); - assertTrue(Locations.stream().toList().contains(customTag)); GroupItem myItem = new GroupItem("MyLocation"); myItem.addTag(tagName); @@ -148,22 +143,11 @@ public void testAddLocation() { assertEquals(customTag, SemanticTags.getLocation(myItem)); } - @Test - public void testAddLocationWithParentString() { - String tagName = "CustomLocationParentString"; - Class customTag = SemanticTags.add(tagName, "Location"); - assertNotNull(customTag); - assertTrue(Locations.stream().toList().contains(customTag)); - } - @Test public void testAddEquipment() { - String tagName = "CustomEquipment"; - Class customTag = SemanticTags.add(tagName, Equipment.class); + String tagName = CUSTOM_EQUIPMENT; + Class customTag = SemanticTags.getById(tagName); assertNotNull(customTag); - assertEquals(customTag, SemanticTags.getById(tagName)); - assertEquals(customTag, SemanticTags.getByLabel("Custom Equipment", Locale.getDefault())); - assertTrue(Equipments.stream().toList().contains(customTag)); GroupItem myItem = new GroupItem("MyEquipment"); myItem.addTag(tagName); @@ -171,22 +155,11 @@ public void testAddEquipment() { assertEquals(customTag, SemanticTags.getEquipment(myItem)); } - @Test - public void testAddEquipmentWithParentString() { - String tagName = "CustomEquipmentParentString"; - Class customTag = SemanticTags.add(tagName, "Television"); - assertNotNull(customTag); - assertTrue(Equipments.stream().toList().contains(customTag)); - } - @Test public void testAddPoint() { - String tagName = "CustomPoint"; - Class customTag = SemanticTags.add(tagName, Point.class); + String tagName = CUSTOM_POINT; + Class customTag = SemanticTags.getById(tagName); assertNotNull(customTag); - assertEquals(customTag, SemanticTags.getById(tagName)); - assertEquals(customTag, SemanticTags.getByLabel("Custom Point", Locale.getDefault())); - assertTrue(Points.stream().toList().contains(customTag)); GroupItem myItem = new GroupItem("MyItem"); myItem.addTag(tagName); @@ -194,57 +167,15 @@ public void testAddPoint() { assertEquals(customTag, SemanticTags.getPoint(myItem)); } - @Test - public void testAddPointParentString() { - String tagName = "CustomPointParentString"; - Class customTag = SemanticTags.add(tagName, "Control"); - assertNotNull(customTag); - assertTrue(Points.stream().toList().contains(customTag)); - } - @Test public void testAddProperty() { - String tagName = "CustomProperty"; - Class customTag = SemanticTags.add(tagName, Property.class); + String tagName = CUSTOM_PROPERTY; + Class customTag = SemanticTags.getById(tagName); assertNotNull(customTag); - assertEquals(customTag, SemanticTags.getById(tagName)); - assertEquals(customTag, SemanticTags.getByLabel("Custom Property", Locale.getDefault())); - assertTrue(Properties.stream().toList().contains(customTag)); GroupItem myItem = new GroupItem("MyItem"); myItem.addTag(tagName); assertEquals(customTag, SemanticTags.getProperty(myItem)); } - - @Test - public void testAddPropertyParentString() { - String tagName = "CustomPropertyParentString"; - Class customTag = SemanticTags.add(tagName, "Property"); - assertNotNull(customTag); - assertTrue(Properties.stream().toList().contains(customTag)); - } - - @Test - public void testAddingExistingTagShouldFail() { - assertNull(SemanticTags.add("Room", Location.class)); - - assertNotNull(SemanticTags.add("CustomLocation1", Location.class)); - assertNull(SemanticTags.add("CustomLocation1", Location.class)); - } - - @Test - public void testAddWithCustomLabel() { - Class tag = SemanticTags.add("CustomProperty2", Property.class, " Custom Label ", null, null); - assertEquals(tag, SemanticTags.getByLabel("Custom Label", Locale.getDefault())); - } - - @Test - public void testAddWithSynonyms() { - String synonyms = " Synonym1, Synonym2 , Synonym With Space "; - Class tag = SemanticTags.add("CustomProperty3", Property.class, null, synonyms, null); - assertEquals(tag, SemanticTags.getByLabelOrSynonym("Synonym1", Locale.getDefault()).get(0)); - assertEquals(tag, SemanticTags.getByLabelOrSynonym("Synonym2", Locale.getDefault()).get(0)); - assertEquals(tag, SemanticTags.getByLabelOrSynonym("Synonym With Space", Locale.getDefault()).get(0)); - } } diff --git a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticsPredicatesTest.java b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticsPredicatesTest.java index 988a5a46c56..947ecaca92f 100644 --- a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticsPredicatesTest.java +++ b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticsPredicatesTest.java @@ -13,17 +13,23 @@ package org.openhab.core.semantics; import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.*; + +import java.util.List; +import java.util.Objects; import org.eclipse.jdt.annotation.NonNullByDefault; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; import org.openhab.core.i18n.UnitProvider; import org.openhab.core.items.GenericItem; import org.openhab.core.items.GroupItem; import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.semantics.model.property.Humidity; -import org.openhab.core.semantics.model.property.Temperature; +import org.openhab.core.semantics.internal.SemanticTagRegistryImpl; +import org.openhab.core.semantics.model.DefaultSemanticTagProvider; /** * These are tests for {@link SemanticsPredicates}. @@ -31,8 +37,11 @@ * @author Christoph Weitkamp - Initial contribution */ @NonNullByDefault +@ExtendWith(MockitoExtension.class) public class SemanticsPredicatesTest { + private @Mock @NonNullByDefault({}) ManagedSemanticTagProvider managedSemanticTagProviderMock; + private @NonNullByDefault({}) GroupItem locationItem; private @NonNullByDefault({}) GroupItem equipmentItem; private @NonNullByDefault({}) GenericItem pointItem; @@ -50,6 +59,9 @@ public void setup() { pointItem = itemFactory.createItem(CoreItemFactory.NUMBER, "TestTemperature"); pointItem.addTag("Measurement"); pointItem.addTag("Temperature"); + + when(managedSemanticTagProviderMock.getAll()).thenReturn(List.of()); + new SemanticTagRegistryImpl(new DefaultSemanticTagProvider(), managedSemanticTagProviderMock); } @Test @@ -75,9 +87,13 @@ public void testIsPoint() { @Test public void testRelatesTo() { - assertFalse(SemanticsPredicates.relatesTo(Temperature.class).test(locationItem)); - assertFalse(SemanticsPredicates.relatesTo(Temperature.class).test(equipmentItem)); - assertTrue(SemanticsPredicates.relatesTo(Temperature.class).test(pointItem)); - assertFalse(SemanticsPredicates.relatesTo(Humidity.class).test(equipmentItem)); + Class temperatureTagClass = (Class) Objects + .requireNonNull(SemanticTags.getById("Property_Temperature")); + Class humidityTagClass = (Class) Objects + .requireNonNull(SemanticTags.getById("Property_Humidity")); + assertFalse(SemanticsPredicates.relatesTo(temperatureTagClass).test(locationItem)); + assertFalse(SemanticsPredicates.relatesTo(temperatureTagClass).test(equipmentItem)); + assertTrue(SemanticsPredicates.relatesTo(temperatureTagClass).test(pointItem)); + assertFalse(SemanticsPredicates.relatesTo(humidityTagClass).test(equipmentItem)); } } diff --git a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticTagRegistryImplTest.java b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticTagRegistryImplTest.java new file mode 100644 index 00000000000..80532c3d92c --- /dev/null +++ b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticTagRegistryImplTest.java @@ -0,0 +1,120 @@ +/** + * Copyright (c) 2010-2023 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.semantics.internal; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.List; +import java.util.Objects; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.openhab.core.semantics.Equipment; +import org.openhab.core.semantics.Location; +import org.openhab.core.semantics.ManagedSemanticTagProvider; +import org.openhab.core.semantics.Point; +import org.openhab.core.semantics.Property; +import org.openhab.core.semantics.SemanticTag; +import org.openhab.core.semantics.SemanticTagImpl; +import org.openhab.core.semantics.SemanticTagRegistry; +import org.openhab.core.semantics.Tag; +import org.openhab.core.semantics.model.DefaultSemanticTagProvider; + +/** + * @author Laurent Garnier - Initial contribution + */ +@ExtendWith(MockitoExtension.class) +@NonNullByDefault +public class SemanticTagRegistryImplTest { + + private @Mock @NonNullByDefault({}) ManagedSemanticTagProvider managedSemanticTagProviderMock; + private @NonNullByDefault({}) SemanticTagRegistry semanticTagRegistry; + + private @NonNullByDefault({}) SemanticTag userLocationTag; + private @NonNullByDefault({}) SemanticTag userSubLocationTag; + + private @NonNullByDefault({}) Class roomTagClass; + private @NonNullByDefault({}) Class bathroomTagClass; + private @NonNullByDefault({}) Class cleaningRobotTagClass; + private @NonNullByDefault({}) Class measurementTagClass; + private @NonNullByDefault({}) Class temperatureTagClass; + + @BeforeEach + public void setup() throws Exception { + userLocationTag = new SemanticTagImpl("Location_UserLocation", "Custom label", "Custom description", + " Synonym1, Synonym2 , Synonym With Space "); + userSubLocationTag = new SemanticTagImpl("Location_UserLocation_UserSubLocation", null, null, List.of()); + when(managedSemanticTagProviderMock.getAll()).thenReturn(List.of(userLocationTag, userSubLocationTag)); + semanticTagRegistry = new SemanticTagRegistryImpl(new DefaultSemanticTagProvider(), + managedSemanticTagProviderMock); + + roomTagClass = semanticTagRegistry.getTagClassById("Location_Indoor_Room"); + bathroomTagClass = semanticTagRegistry.getTagClassById("Location_Indoor_Room_Bathroom"); + cleaningRobotTagClass = semanticTagRegistry.getTagClassById("Equipment_CleaningRobot"); + measurementTagClass = semanticTagRegistry.getTagClassById("Point_Measurement"); + temperatureTagClass = semanticTagRegistry.getTagClassById("Property_Temperature"); + } + + @Test + public void testGetById() { + assertEquals(Location.class, semanticTagRegistry.getTagClassById("Location")); + assertEquals(roomTagClass, semanticTagRegistry.getTagClassById("Room")); + assertEquals(roomTagClass, semanticTagRegistry.getTagClassById("Indoor_Room")); + assertEquals(roomTagClass, semanticTagRegistry.getTagClassById("Location_Indoor_Room")); + assertEquals(bathroomTagClass, semanticTagRegistry.getTagClassById("Bathroom")); + assertEquals(bathroomTagClass, semanticTagRegistry.getTagClassById("Room_Bathroom")); + assertEquals(bathroomTagClass, semanticTagRegistry.getTagClassById("Indoor_Room_Bathroom")); + assertEquals(bathroomTagClass, semanticTagRegistry.getTagClassById("Location_Indoor_Room_Bathroom")); + } + + @Test + public void testBuildId() { + assertEquals("Location", SemanticTagRegistryImpl.buildId(Location.class)); + assertEquals("Location_Indoor_Room", SemanticTagRegistryImpl.buildId(roomTagClass)); + assertEquals("Location_Indoor_Room_Bathroom", SemanticTagRegistryImpl.buildId(bathroomTagClass)); + assertEquals("Equipment", SemanticTagRegistryImpl.buildId(Equipment.class)); + assertEquals("Equipment_CleaningRobot", SemanticTagRegistryImpl.buildId(cleaningRobotTagClass)); + assertEquals("Point", SemanticTagRegistryImpl.buildId(Point.class)); + assertEquals("Point_Measurement", SemanticTagRegistryImpl.buildId(measurementTagClass)); + assertEquals("Property", SemanticTagRegistryImpl.buildId(Property.class)); + assertEquals("Property_Temperature", SemanticTagRegistryImpl.buildId(temperatureTagClass)); + } + + @Test + public void testIsEditable() { + when(managedSemanticTagProviderMock.get(eq("Location"))).thenReturn(null); + when(managedSemanticTagProviderMock.get(eq("Location_Indoor"))).thenReturn(null); + when(managedSemanticTagProviderMock.get(eq("Location_Indoor_Room"))).thenReturn(null); + when(managedSemanticTagProviderMock.get(eq("Location_Indoor_Room_Bathroom"))).thenReturn(null); + when(managedSemanticTagProviderMock.get(eq("Location_UserLocation"))).thenReturn(userLocationTag); + when(managedSemanticTagProviderMock.get(eq("Location_UserLocation_UserSubLocation"))) + .thenReturn(userSubLocationTag); + + assertFalse(semanticTagRegistry.isEditable(Objects.requireNonNull(semanticTagRegistry.get("Location")))); + assertFalse(semanticTagRegistry.isEditable(Objects.requireNonNull(semanticTagRegistry.get("Location_Indoor")))); + assertFalse(semanticTagRegistry + .isEditable(Objects.requireNonNull(semanticTagRegistry.get("Location_Indoor_Room")))); + assertFalse(semanticTagRegistry + .isEditable(Objects.requireNonNull(semanticTagRegistry.get("Location_Indoor_Room_Bathroom")))); + assertTrue(semanticTagRegistry + .isEditable(Objects.requireNonNull(semanticTagRegistry.get("Location_UserLocation")))); + assertTrue(semanticTagRegistry + .isEditable(Objects.requireNonNull(semanticTagRegistry.get("Location_UserLocation_UserSubLocation")))); + } +} diff --git a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsMetadataProviderTest.java b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsMetadataProviderTest.java index 90a5edc6cff..a8de24199fc 100644 --- a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsMetadataProviderTest.java +++ b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsMetadataProviderTest.java @@ -16,6 +16,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; +import java.util.List; import java.util.Objects; import org.eclipse.jdt.annotation.NonNull; @@ -36,6 +37,9 @@ import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.Metadata; import org.openhab.core.library.items.SwitchItem; +import org.openhab.core.semantics.ManagedSemanticTagProvider; +import org.openhab.core.semantics.SemanticTagRegistry; +import org.openhab.core.semantics.model.DefaultSemanticTagProvider; /** * @author Simon Lamon - Initial contribution @@ -49,14 +53,19 @@ public class SemanticsMetadataProviderTest { private static final String GROUP_ITEM_NAME = "groupItem"; - private @NonNullByDefault({}) @Mock ItemRegistry itemRegistry; - private @NonNullByDefault({}) @Mock ProviderChangeListener<@NonNull Metadata> changeListener; + private @Mock @NonNullByDefault({}) ItemRegistry itemRegistry; + private @Mock @NonNullByDefault({}) ProviderChangeListener<@NonNull Metadata> changeListener; + private @Mock @NonNullByDefault({}) ManagedSemanticTagProvider managedSemanticTagProviderMock; private @NonNullByDefault({}) SemanticsMetadataProvider semanticsMetadataProvider; @BeforeEach public void beforeEach() throws Exception { - semanticsMetadataProvider = new SemanticsMetadataProvider(itemRegistry) { + when(managedSemanticTagProviderMock.getAll()).thenReturn(List.of()); + SemanticTagRegistry semanticTagRegistry = new SemanticTagRegistryImpl(new DefaultSemanticTagProvider(), + managedSemanticTagProviderMock); + + semanticsMetadataProvider = new SemanticsMetadataProvider(itemRegistry, semanticTagRegistry) { { addProviderChangeListener(changeListener); } diff --git a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsServiceImplTest.java b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsServiceImplTest.java index 3ff77cb163d..4e95ba4044d 100644 --- a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsServiceImplTest.java +++ b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsServiceImplTest.java @@ -12,9 +12,11 @@ */ package org.openhab.core.semantics.internal; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; +import java.util.List; import java.util.Locale; import java.util.Set; import java.util.stream.Stream; @@ -32,11 +34,17 @@ import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.MetadataRegistry; import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.semantics.model.location.Bathroom; -import org.openhab.core.semantics.model.location.LivingRoom; +import org.openhab.core.semantics.Location; +import org.openhab.core.semantics.ManagedSemanticTagProvider; +import org.openhab.core.semantics.SemanticTag; +import org.openhab.core.semantics.SemanticTagImpl; +import org.openhab.core.semantics.SemanticTagRegistry; +import org.openhab.core.semantics.Tag; +import org.openhab.core.semantics.model.DefaultSemanticTagProvider; /** * @author Kai Kreuzer - Initial contribution + * @author Laurent Garnier - Tests added for methods moved from SemanticTags to SemanticsService */ @ExtendWith(MockitoExtension.class) @NonNullByDefault @@ -45,11 +53,18 @@ public class SemanticsServiceImplTest { private @Mock @NonNullByDefault({}) ItemRegistry itemRegistryMock; private @Mock @NonNullByDefault({}) MetadataRegistry metadataRegistryMock; private @Mock @NonNullByDefault({}) UnitProvider unitProviderMock; + private @Mock @NonNullByDefault({}) ManagedSemanticTagProvider managedSemanticTagProviderMock; private @NonNullByDefault({}) GroupItem locationItem; private @NonNullByDefault({}) GroupItem equipmentItem; private @NonNullByDefault({}) GenericItem pointItem; + private @NonNullByDefault({}) Class roomTagClass; + private @NonNullByDefault({}) Class bathroomTagClass; + private @NonNullByDefault({}) Class livingRoomTagClass; + private @NonNullByDefault({}) Class userLocationTagClass; + private @NonNullByDefault({}) Class cleaningRobotTagClass; + private @NonNullByDefault({}) SemanticsServiceImpl service; @BeforeEach @@ -69,28 +84,149 @@ public void setup() throws Exception { pointItem.addGroupName(locationItem.getName()); locationItem.addMember(pointItem); - when(itemRegistryMock.stream()).thenReturn(Stream.of(locationItem, equipmentItem, pointItem)) - .thenReturn(Stream.of(locationItem, equipmentItem, pointItem)) - .thenReturn(Stream.of(locationItem, equipmentItem, pointItem)); + SemanticTag userLocationTag = new SemanticTagImpl("Location_UserLocation", "Custom label", "Custom description", + " Synonym1, Synonym2 , Synonym With Space "); + when(managedSemanticTagProviderMock.getAll()).thenReturn(List.of(userLocationTag)); + SemanticTagRegistry semanticTagRegistry = new SemanticTagRegistryImpl(new DefaultSemanticTagProvider(), + managedSemanticTagProviderMock); + + roomTagClass = semanticTagRegistry.getTagClassById("Location_Indoor_Room"); + bathroomTagClass = semanticTagRegistry.getTagClassById("Location_Indoor_Room_Bathroom"); + livingRoomTagClass = semanticTagRegistry.getTagClassById("Location_Indoor_Room_LivingRoom"); + userLocationTagClass = semanticTagRegistry.getTagClassById("Location_UserLocation"); + cleaningRobotTagClass = semanticTagRegistry.getTagClassById("Equipment_CleaningRobot"); - service = new SemanticsServiceImpl(itemRegistryMock, metadataRegistryMock); + service = new SemanticsServiceImpl(itemRegistryMock, metadataRegistryMock, semanticTagRegistry); } @Test public void testGetItemsInLocation() throws Exception { - Set items = service.getItemsInLocation(Bathroom.class); + when(itemRegistryMock.stream()).thenReturn(Stream.of(locationItem, equipmentItem, pointItem)) + .thenReturn(Stream.of(locationItem, equipmentItem, pointItem)) + .thenReturn(Stream.of(locationItem, equipmentItem, pointItem)); + + Set items = service.getItemsInLocation((Class) bathroomTagClass); + assertEquals(1, items.size()); assertTrue(items.contains(pointItem)); - items = service.getItemsInLocation("Room", Locale.ENGLISH); + items = service.getItemsInLocation((Class) roomTagClass); + assertEquals(1, items.size()); assertTrue(items.contains(pointItem)); + + items = service.getItemsInLocation((Class) livingRoomTagClass); + assertTrue(items.isEmpty()); } @Test public void testGetItemsInLocationByString() throws Exception { + when(itemRegistryMock.stream()).thenReturn(Stream.of(locationItem, equipmentItem, pointItem)) + .thenReturn(Stream.of(locationItem, equipmentItem, pointItem)) + .thenReturn(Stream.of(locationItem, equipmentItem, pointItem)) + .thenReturn(Stream.of(locationItem, equipmentItem, pointItem)) + .thenReturn(Stream.of(locationItem, equipmentItem, pointItem)) + .thenReturn(Stream.of(locationItem, equipmentItem, pointItem)); + when(metadataRegistryMock.get(any())).thenReturn(null); + + // Label of a location group item Set items = service.getItemsInLocation("joe's room", Locale.ENGLISH); + assertEquals(1, items.size()); assertTrue(items.contains(pointItem)); - items = service.getItemsInLocation(LivingRoom.class); + // Location tag label + items = service.getItemsInLocation("bathroom", Locale.ENGLISH); + assertEquals(1, items.size()); + assertTrue(items.contains(pointItem)); + + // Location tag synonym + items = service.getItemsInLocation("powder room", Locale.ENGLISH); + assertEquals(1, items.size()); + assertTrue(items.contains(pointItem)); + + // Location parent tag label + items = service.getItemsInLocation("Room", Locale.ENGLISH); + assertEquals(1, items.size()); + assertTrue(items.contains(pointItem)); + + // Existing item label + items = service.getItemsInLocation("my Test label", Locale.ENGLISH); + assertTrue(items.isEmpty()); + + // Unknown item label + items = service.getItemsInLocation("wrong label", Locale.ENGLISH); assertTrue(items.isEmpty()); } + + @Test + public void testGetLabelAndSynonyms() { + List result = service.getLabelAndSynonyms(bathroomTagClass, Locale.ENGLISH); + assertEquals(6, result.size()); + assertEquals("bathroom", result.get(0)); + assertEquals("bathrooms", result.get(1)); + assertEquals("bath", result.get(2)); + assertEquals("baths", result.get(3)); + assertEquals("powder room", result.get(4)); + assertEquals("powder rooms", result.get(5)); + + result = service.getLabelAndSynonyms(cleaningRobotTagClass, Locale.FRENCH); + assertEquals(4, result.size()); + assertEquals("robot de nettoyage", result.get(0)); + assertEquals("robos de nettoyage", result.get(1)); + assertEquals("robot aspirateur", result.get(2)); + assertEquals("robots aspirateur", result.get(3)); + + result = service.getLabelAndSynonyms(userLocationTagClass, Locale.ENGLISH); + assertEquals(4, result.size()); + assertEquals("custom label", result.get(0)); + assertEquals("synonym1", result.get(1)); + assertEquals("synonym2", result.get(2)); + assertEquals("synonym with space", result.get(3)); + } + + @Test + public void testGetByLabel() { + Class tag = service.getByLabel("BATHROOM", Locale.ENGLISH); + assertEquals(bathroomTagClass, tag); + tag = service.getByLabel("Bath", Locale.ENGLISH); + assertNull(tag); + + tag = service.getByLabel("ROBOT de nettoyage", Locale.FRENCH); + assertEquals(cleaningRobotTagClass, tag); + tag = service.getByLabel("Robot aspirateur", Locale.FRENCH); + assertNull(tag); + + tag = service.getByLabel("CUSTOM label", Locale.ENGLISH); + assertEquals(userLocationTagClass, tag); + tag = service.getByLabel("Synonym1", Locale.ENGLISH); + assertNull(tag); + } + + @Test + public void testGetByLabelOrSynonym() { + List> tags = service.getByLabelOrSynonym("BATHROOM", Locale.ENGLISH); + assertEquals(1, tags.size()); + assertEquals(bathroomTagClass, tags.get(0)); + tags = service.getByLabelOrSynonym("POWDER Rooms", Locale.ENGLISH); + assertEquals(1, tags.size()); + assertEquals(bathroomTagClass, tags.get(0)); + tags = service.getByLabelOrSynonym("other bath", Locale.ENGLISH); + assertTrue(tags.isEmpty()); + + tags = service.getByLabelOrSynonym("ROBOT de nettoyage", Locale.FRENCH); + assertEquals(1, tags.size()); + assertEquals(cleaningRobotTagClass, tags.get(0)); + tags = service.getByLabelOrSynonym("ROBOTS aspirateur", Locale.FRENCH); + assertEquals(1, tags.size()); + assertEquals(cleaningRobotTagClass, tags.get(0)); + tags = service.getByLabelOrSynonym("Robot cuiseur", Locale.FRENCH); + assertTrue(tags.isEmpty()); + + tags = service.getByLabelOrSynonym("CUSTOM label", Locale.ENGLISH); + assertEquals(1, tags.size()); + assertEquals(userLocationTagClass, tags.get(0)); + tags = service.getByLabelOrSynonym("Synonym with space", Locale.ENGLISH); + assertEquals(1, tags.size()); + assertEquals(userLocationTagClass, tags.get(0)); + tags = service.getByLabelOrSynonym("wrong label", Locale.ENGLISH); + assertTrue(tags.isEmpty()); + } }