From b3d5b3cdd218c32725a2be4451a07c37c358a02e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Sun, 7 Nov 2021 19:32:27 +0100 Subject: [PATCH] PropertyListComponent + Scenes --- Zuhause-ETS5 | 2 +- .../angular/src/app/api/ISearchService.ts | 2 +- src/main/angular/src/app/api/device/Device.ts | 6 +- .../angular/src/app/api/property/Property.ts | 42 +++++++++++ .../src/app/api/property/property.service.ts | 57 +++------------ src/main/angular/src/app/api/scene/Scene.ts | 36 ++++++++++ .../src/app/api/scene/scene.service.spec.ts | 16 +++++ .../src/app/api/scene/scene.service.ts | 39 ++++++++++ .../angular/src/app/api/schedule/Schedule.ts | 2 +- .../angular/src/app/app-routing.module.ts | 3 + src/main/angular/src/app/app.component.html | 4 ++ src/main/angular/src/app/app.module.ts | 2 + .../device-list/device-list.component.ts | 16 ++--- .../app/pages/device/device.component.html | 4 +- .../property-list.component.html | 53 ++++++++++++++ .../property-list.component.less | 0 .../property-list.component.spec.ts | 25 +++++++ .../property-list/property-list.component.ts | 71 +++++++++++++++++++ .../schedule-list.component.less | 53 -------------- .../pages/schedule/schedule.component.html | 6 +- .../pages/schedule/schedule.component.less | 57 --------------- .../app/pages/schedule/schedule.component.ts | 8 ++- .../edit-field/edit-field.component.less | 3 - .../app/shared/search/search.component.html | 21 +----- .../app/shared/search/search.component.less | 4 -- .../src/app/shared/search/search.component.ts | 4 +- src/main/angular/src/index.html | 2 +- src/main/angular/src/styles.less | 58 +++++++++++++++ .../ph87/homeautomation/DemoDataService.java | 13 ++++ .../ph87/homeautomation/channel/Channel.java | 2 +- .../homeautomation/device/DeviceSetDto.java | 14 ---- .../device/DeviceWriteService.java | 3 - .../homeautomation/knx/group/KnxGroup.java | 2 +- .../knx/group/KnxGroupWriteService.java | 2 +- .../property/PropertyController.java | 32 ++++++--- .../homeautomation/property/PropertyDto.java | 4 +- .../property/PropertyReadService.java | 8 ++- .../property/PropertyRepository.java | 2 + .../homeautomation/property/PropertyType.java | 2 +- .../property/PropertyWriteService.java | 4 +- .../de/ph87/homeautomation/scene/Scene.java | 33 +++++++++ .../homeautomation/scene/SceneController.java | 42 +++++++++++ .../ph87/homeautomation/scene/SceneDto.java | 20 ++++++ .../homeautomation/scene/SceneMapper.java | 12 ++++ .../scene/SceneReadService.java | 34 +++++++++ .../homeautomation/scene/SceneRepository.java | 13 ++++ .../scene/SceneWriteService.java | 48 +++++++++++++ .../ph87/homeautomation/shared/Helpers.java | 8 +++ .../shared/ISearchController.java | 2 +- 49 files changed, 649 insertions(+), 247 deletions(-) create mode 100644 src/main/angular/src/app/api/property/Property.ts create mode 100644 src/main/angular/src/app/api/scene/Scene.ts create mode 100644 src/main/angular/src/app/api/scene/scene.service.spec.ts create mode 100644 src/main/angular/src/app/api/scene/scene.service.ts create mode 100644 src/main/angular/src/app/pages/property-list/property-list.component.html create mode 100644 src/main/angular/src/app/pages/property-list/property-list.component.less create mode 100644 src/main/angular/src/app/pages/property-list/property-list.component.spec.ts create mode 100644 src/main/angular/src/app/pages/property-list/property-list.component.ts delete mode 100644 src/main/java/de/ph87/homeautomation/device/DeviceSetDto.java create mode 100644 src/main/java/de/ph87/homeautomation/scene/Scene.java create mode 100644 src/main/java/de/ph87/homeautomation/scene/SceneController.java create mode 100644 src/main/java/de/ph87/homeautomation/scene/SceneDto.java create mode 100644 src/main/java/de/ph87/homeautomation/scene/SceneMapper.java create mode 100644 src/main/java/de/ph87/homeautomation/scene/SceneReadService.java create mode 100644 src/main/java/de/ph87/homeautomation/scene/SceneRepository.java create mode 100644 src/main/java/de/ph87/homeautomation/scene/SceneWriteService.java diff --git a/Zuhause-ETS5 b/Zuhause-ETS5 index 65f72ff..b362ae7 160000 --- a/Zuhause-ETS5 +++ b/Zuhause-ETS5 @@ -1 +1 @@ -Subproject commit 65f72ffc2cf56175b3ca2e51ec7d95228907318a +Subproject commit b362ae703f89547339ad5762714b1f6c999429fa diff --git a/src/main/angular/src/app/api/ISearchService.ts b/src/main/angular/src/app/api/ISearchService.ts index ef04432..8561f30 100644 --- a/src/main/angular/src/app/api/ISearchService.ts +++ b/src/main/angular/src/app/api/ISearchService.ts @@ -2,7 +2,7 @@ import {KeyValuePair} from "./KeyValuePair"; export interface ISearchService { - get(id: string, next: (results: KeyValuePair) => void, error: (error: any) => void): void; + get(id: number, next: (results: KeyValuePair) => void, error: (error: any) => void): void; search(term: string, next: (results: KeyValuePair[]) => void, error: (error: any) => void): void; diff --git a/src/main/angular/src/app/api/device/Device.ts b/src/main/angular/src/app/api/device/Device.ts index 0caac7e..24983a6 100644 --- a/src/main/angular/src/app/api/device/Device.ts +++ b/src/main/angular/src/app/api/device/Device.ts @@ -1,5 +1,5 @@ import {validateNumberNotNull, validateStringNotEmptyNotNull} from "../validators"; -import {Property} from "../property/property.service"; +import {Property} from "../property/Property"; export abstract class Device { @@ -56,7 +56,7 @@ export class DeviceSwitch extends Device { } updateProperty(property: Property): void { - if (this.stateProperty?.name === property.name) { + if (this.stateProperty?.id === property.id) { this.stateProperty = property; } } @@ -75,7 +75,7 @@ export class DeviceShutter extends Device { } updateProperty(property: Property): void { - if (this.positionProperty?.name === property.name) { + if (this.positionProperty?.id === property.id) { this.positionProperty = property; } } diff --git a/src/main/angular/src/app/api/property/Property.ts b/src/main/angular/src/app/api/property/Property.ts new file mode 100644 index 0000000..6629aba --- /dev/null +++ b/src/main/angular/src/app/api/property/Property.ts @@ -0,0 +1,42 @@ +import {validateDateAllowNull, validateNumberAllowNull, validateNumberNotNull, validateStringNotEmptyNotNull} from "../validators"; + +export class Property { + + constructor( + public id: number, + public name: string, + public type: string, + public title: string, + public value: number | null, + public timestamp: Date | null, + ) { + // nothing + } + + static fromJsonAllowNull(json: any): Property | null { + if (json === undefined || json === null) { + return null; + } + return this.fromJson(json); + } + + static fromJson(json: any): Property { + return new Property( + validateNumberNotNull(json['id']), + validateStringNotEmptyNotNull(json['name']), + validateStringNotEmptyNotNull(json['type']), + validateStringNotEmptyNotNull(json['title']), + validateNumberAllowNull(json['value']), + validateDateAllowNull(json['timestamp']), + ); + } + + public static trackBy(index: number, item: Property): string { + return item.name; + } + + public static compareName(a: Property, b: Property): number { + return a.name.localeCompare(b.name); + } + +} diff --git a/src/main/angular/src/app/api/property/property.service.ts b/src/main/angular/src/app/api/property/property.service.ts index d8c867f..d4994d1 100644 --- a/src/main/angular/src/app/api/property/property.service.ts +++ b/src/main/angular/src/app/api/property/property.service.ts @@ -1,48 +1,9 @@ import {Injectable} from '@angular/core'; -import {ApiService, NO_OP} from "../api.service"; -import {validateDateAllowNull, validateNumberAllowNull, validateStringNotEmptyNotNull} from "../validators"; +import {ApiService, NO_COMPARE, NO_OP} from "../api.service"; import {ISearchService} from "../ISearchService"; import {KeyValuePair} from "../KeyValuePair"; import {Update} from "../Update"; - -export class Property { - - constructor( - public name: string, - public type: string, - public title: string, - public value: number | null, - public valueTimestamp: Date | null, - ) { - // nothing - } - - static fromJsonAllowNull(json: any): Property | null { - if (json === undefined || json === null) { - return null; - } - return this.fromJson(json); - } - - static fromJson(json: any): Property { - return new Property( - validateStringNotEmptyNotNull(json['name']), - validateStringNotEmptyNotNull(json['type']), - validateStringNotEmptyNotNull(json['title']), - validateNumberAllowNull(json['value']), - validateDateAllowNull(json['valueTimestamp']), - ); - } - - public static trackBy(index: number, item: Property): string { - return item.name; - } - - public static compareName(a: Property, b: Property): number { - return a.name.localeCompare(b.name); - } - -} +import {Property} from "./Property"; @Injectable({ providedIn: 'root' @@ -55,20 +16,24 @@ export class PropertyService implements ISearchService { // nothing } - subscribe(next: (device: Update) => void): void { + findAll(next: (list: Property[]) => void, compare: (a: Property, b: Property) => number = NO_COMPARE, error: (error: any) => void = NO_OP): void { + this.api.getList("property/findAll", Property.fromJson, compare, next, error); + } + + subscribe(next: (property: Update) => void): void { this.api.subscribe("PropertyDto", Property.fromJson, next); } - get(id: string, next: (results: KeyValuePair) => void, error: (error: any) => void): void { - this.api.postReturnItem("property/getById", id, KeyValuePair.fromJson, next, error); + get(id: number, next: (results: KeyValuePair) => void, error: (error: any) => void): void { + this.api.getItem("property/getById/" + id, KeyValuePair.fromJson, next, error); } search(term: string, next: (results: KeyValuePair[]) => void = NO_OP, error: (error: any) => void = NO_OP): void { this.api.postReturnList("property/searchLike", term, KeyValuePair.fromJson, next, error); } - set(property: Property, value: number, next: () => void = NO_OP, error: (error: any) => void = NO_OP): void { - this.api.postReturnNone("property/set", {name: property.name, value: value}, next, error) + set(property: Property, key: string, value: any, next: (item: Property) => void = NO_OP, error: (error: any) => void = NO_OP): void { + this.api.postReturnItem("property/set/" + property.id + "/" + key, value, Property.fromJson, next, error); } } diff --git a/src/main/angular/src/app/api/scene/Scene.ts b/src/main/angular/src/app/api/scene/Scene.ts new file mode 100644 index 0000000..c98a64d --- /dev/null +++ b/src/main/angular/src/app/api/scene/Scene.ts @@ -0,0 +1,36 @@ +import {validateNumberNotNull, validateStringNotEmptyNotNull} from "../validators"; + +export class Scene { + + constructor( + public id: number, + public number: number, + public title: string, + ) { + // nothing + } + + static fromJsonAllowNull(json: any): Scene | null { + if (json === undefined || json === null) { + return null; + } + return this.fromJson(json); + } + + static fromJson(json: any): Scene { + return new Scene( + validateNumberNotNull(json['id']), + validateNumberNotNull(json['number']), + validateStringNotEmptyNotNull(json['title']), + ); + } + + public static trackBy(index: number, item: Scene): number { + return item.id; + } + + public static compareNumber(a: Scene, b: Scene): number { + return a.number - b.number; + } + +} diff --git a/src/main/angular/src/app/api/scene/scene.service.spec.ts b/src/main/angular/src/app/api/scene/scene.service.spec.ts new file mode 100644 index 0000000..ce6d35f --- /dev/null +++ b/src/main/angular/src/app/api/scene/scene.service.spec.ts @@ -0,0 +1,16 @@ +import {TestBed} from '@angular/core/testing'; + +import {SceneService} from './scene.service'; + +describe('SceneService', () => { + let service: SceneService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(SceneService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/main/angular/src/app/api/scene/scene.service.ts b/src/main/angular/src/app/api/scene/scene.service.ts new file mode 100644 index 0000000..87bc51c --- /dev/null +++ b/src/main/angular/src/app/api/scene/scene.service.ts @@ -0,0 +1,39 @@ +import {Injectable} from '@angular/core'; +import {ApiService, NO_COMPARE, NO_OP} from "../api.service"; +import {ISearchService} from "../ISearchService"; +import {KeyValuePair} from "../KeyValuePair"; +import {Update} from "../Update"; +import {Scene} from "./Scene"; + +@Injectable({ + providedIn: 'root' +}) +export class SceneService implements ISearchService { + + constructor( + readonly api: ApiService, + ) { + // nothing + } + + findAll(next: (list: Scene[]) => void, compare: (a: Scene, b: Scene) => number = NO_COMPARE, error: (error: any) => void = NO_OP): void { + this.api.getList("scene/findAll", Scene.fromJson, compare, next, error); + } + + subscribe(next: (scene: Update) => void): void { + this.api.subscribe("SceneDto", Scene.fromJson, next); + } + + get(id: number, next: (results: KeyValuePair) => void, error: (error: any) => void): void { + this.api.getItem("scene/getById/" + id, KeyValuePair.fromJson, next, error); + } + + search(term: string, next: (results: KeyValuePair[]) => void = NO_OP, error: (error: any) => void = NO_OP): void { + this.api.postReturnList("scene/searchLike", term, KeyValuePair.fromJson, next, error); + } + + set(scene: Scene, key: string, value: any, next: (item: Scene) => void = NO_OP, error: (error: any) => void = NO_OP): void { + this.api.postReturnItem("scene/set/" + scene.id + "/" + key, value, Scene.fromJson, next, error); + } + +} diff --git a/src/main/angular/src/app/api/schedule/Schedule.ts b/src/main/angular/src/app/api/schedule/Schedule.ts index 68e768f..d4e6cb9 100644 --- a/src/main/angular/src/app/api/schedule/Schedule.ts +++ b/src/main/angular/src/app/api/schedule/Schedule.ts @@ -1,6 +1,6 @@ import {validateBooleanNotNull, validateListOrEmpty, validateNumberNotNull, validateStringNotEmptyNotNull} from "../validators"; import {ScheduleEntry} from "./entry/ScheduleEntry"; -import {Property} from "../property/property.service"; +import {Property} from "../property/Property"; export class Schedule { diff --git a/src/main/angular/src/app/app-routing.module.ts b/src/main/angular/src/app/app-routing.module.ts index c8a7206..e17e770 100644 --- a/src/main/angular/src/app/app-routing.module.ts +++ b/src/main/angular/src/app/app-routing.module.ts @@ -4,10 +4,13 @@ import {ScheduleListComponent} from "./pages/schedule-list/schedule-list.compone import {ScheduleComponent} from "./pages/schedule/schedule.component"; import {DeviceListComponent} from "./pages/device-list/device-list.component"; import {DeviceComponent} from "./pages/device/device.component"; +import {PropertyListComponent} from "./pages/property-list/property-list.component"; const routes: Routes = [ {path: 'Device', component: DeviceComponent}, {path: 'DeviceList', component: DeviceListComponent}, + // {path: 'Property', component: PropertyComponent}, + {path: 'PropertyList', component: PropertyListComponent}, {path: 'Schedule', component: ScheduleComponent}, {path: 'ScheduleList', component: ScheduleListComponent}, {path: '**', redirectTo: '/ScheduleList'}, diff --git a/src/main/angular/src/app/app.component.html b/src/main/angular/src/app/app.component.html index 1b0a353..3c06b28 100644 --- a/src/main/angular/src/app/app.component.html +++ b/src/main/angular/src/app/app.component.html @@ -4,6 +4,10 @@ Zeitpläne +
+ Eigenschaften +
+
Geräte
diff --git a/src/main/angular/src/app/app.module.ts b/src/main/angular/src/app/app.module.ts index e2cc6d5..77ffa18 100644 --- a/src/main/angular/src/app/app.module.ts +++ b/src/main/angular/src/app/app.module.ts @@ -13,6 +13,7 @@ import {ScheduleComponent} from "./pages/schedule/schedule.component"; import {SearchComponent} from './shared/search/search.component'; import {DeviceListComponent} from './pages/device-list/device-list.component'; import {DeviceComponent} from './pages/device/device.component'; +import {PropertyListComponent} from './pages/property-list/property-list.component'; @NgModule({ declarations: [ @@ -24,6 +25,7 @@ import {DeviceComponent} from './pages/device/device.component'; SearchComponent, DeviceListComponent, DeviceComponent, + PropertyListComponent, ], imports: [ BrowserModule, diff --git a/src/main/angular/src/app/pages/device-list/device-list.component.ts b/src/main/angular/src/app/pages/device-list/device-list.component.ts index 3c01a1b..dc50033 100644 --- a/src/main/angular/src/app/pages/device-list/device-list.component.ts +++ b/src/main/angular/src/app/pages/device-list/device-list.component.ts @@ -31,28 +31,20 @@ export class DeviceListComponent implements OnInit { this.deviceService.findAll(devices => this.devices = devices); } - asDeviceSwitch(device: Device): DeviceSwitch { - return device as DeviceSwitch; - } - - asDeviceShutter(device: Device): DeviceShutter { - return device as DeviceShutter; - } - setSwitchState(d: Device, value: boolean): void { const device: DeviceSwitch = d as DeviceSwitch; if (!device.stateProperty) { - throw new Error("Property 'setState' not set for: " + device); + throw new Error("Property 'stateProperty' not set for: " + device); } - this.propertyService.set(device.stateProperty, value ? 1 : 0); + this.propertyService.set(device.stateProperty, "value", value ? 1 : 0); } setShutterPosition(d: Device, value: number): void { const device: DeviceShutter = d as DeviceShutter; if (!device.positionProperty) { - throw new Error("Property 'setPosition' not set for: " + device); + throw new Error("Property 'positionProperty' not set for: " + device); } - this.propertyService.set(device.positionProperty, value); + this.propertyService.set(device.positionProperty, "value", value); } create(): void { diff --git a/src/main/angular/src/app/pages/device/device.component.html b/src/main/angular/src/app/pages/device/device.component.html index da3f1bf..d53ace1 100644 --- a/src/main/angular/src/app/pages/device/device.component.html +++ b/src/main/angular/src/app/pages/device/device.component.html @@ -13,7 +13,7 @@ Eigenschaft - + @@ -30,7 +30,7 @@ Eigenschaft - + diff --git a/src/main/angular/src/app/pages/property-list/property-list.component.html b/src/main/angular/src/app/pages/property-list/property-list.component.html new file mode 100644 index 0000000..11a5dd8 --- /dev/null +++ b/src/main/angular/src/app/pages/property-list/property-list.component.html @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
BezeichnungNameTypWertZeitstempel
+ + + + + + + {{property.value ? "An" : "Aus"}} + + {{property.value}} % + + {{property.value}} % + + {{property.value}} K + + {{property.value | number:'0.0-0'}} lux + + {{findScene(property)?.title || "Unbekannt: " + property.value}} + + -LEER- + {{property.timestamp | date:'yyyy-MM-dd HH:mm:ss'}}
diff --git a/src/main/angular/src/app/pages/property-list/property-list.component.less b/src/main/angular/src/app/pages/property-list/property-list.component.less new file mode 100644 index 0000000..e69de29 diff --git a/src/main/angular/src/app/pages/property-list/property-list.component.spec.ts b/src/main/angular/src/app/pages/property-list/property-list.component.spec.ts new file mode 100644 index 0000000..9c4d429 --- /dev/null +++ b/src/main/angular/src/app/pages/property-list/property-list.component.spec.ts @@ -0,0 +1,25 @@ +import {ComponentFixture, TestBed} from '@angular/core/testing'; + +import {PropertyListComponent} from './property-list.component'; + +describe('PropertyListComponent', () => { + let component: PropertyListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [PropertyListComponent] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PropertyListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/main/angular/src/app/pages/property-list/property-list.component.ts b/src/main/angular/src/app/pages/property-list/property-list.component.ts new file mode 100644 index 0000000..92dc3d5 --- /dev/null +++ b/src/main/angular/src/app/pages/property-list/property-list.component.ts @@ -0,0 +1,71 @@ +import {Component, OnInit} from '@angular/core'; +import {Property} from "../../api/property/Property"; +import {PropertyService} from "../../api/property/property.service"; +import {Scene} from "../../api/scene/Scene"; +import {SceneService} from "../../api/scene/scene.service"; + +@Component({ + selector: 'app-property-list', + templateUrl: './property-list.component.html', + styleUrls: ['./property-list.component.less'] +}) +export class PropertyListComponent implements OnInit { + + properties: Property[] = []; + + scenes: Scene[] = []; + + constructor( + readonly propertyService: PropertyService, + readonly sceneService: SceneService, + ) { + // nothing + } + + ngOnInit(): void { + this.propertyService.findAll(properties => this.properties = properties, Property.compareName); + this.propertyService.subscribe(update => this.updateProperty(update.payload, update.existing)); + + this.sceneService.findAll(scenes => this.scenes = scenes, Scene.compareNumber); + this.sceneService.subscribe(update => this.updateScene(update.payload, update.existing)); + } + + setProperty(property: Property, key: string, value: any): void { + this.propertyService.set(property, key, value, property => this.updateProperty(property, true)); + } + + setScene(scene: Scene, key: string, value: any): void { + this.sceneService.set(scene, key, value, scene => this.updateScene(scene, true)); + } + + private updateProperty(property: Property, existing: boolean): void { + const index: number = this.properties.findIndex(p => p.id === property.id); + if (index >= 0) { + if (existing) { + this.properties[index] = property; + } else { + this.properties.slice(index, 1); + } + } else if (existing) { + this.properties.push(property); + } + } + + private updateScene(scene: Scene, existing: boolean): void { + const index: number = this.scenes.findIndex(p => p.id === scene.id); + if (index >= 0) { + if (existing) { + this.scenes[index] = scene; + } else { + this.scenes.slice(index, 1); + } + } else if (existing) { + this.scenes.push(scene); + } + } + + findScene(property: Property): Scene | undefined { + return this.scenes.find(s => s.id === property.value); + } + +} diff --git a/src/main/angular/src/app/pages/schedule-list/schedule-list.component.less b/src/main/angular/src/app/pages/schedule-list/schedule-list.component.less index d287ae9..36a87cf 100644 --- a/src/main/angular/src/app/pages/schedule-list/schedule-list.component.less +++ b/src/main/angular/src/app/pages/schedule-list/schedule-list.component.less @@ -9,56 +9,3 @@ select { th { background-color: lightblue; } - -.empty { - text-align: center; - color: gray; - background-color: #DDDDDD; -} - -.boolean { - text-align: center; -} - -.true { - background-color: palegreen; -} - -.false { - background-color: indianred; -} - -.number { - text-align: right; -} - -.full { - padding: 0; -} - -.first { - border-right-width: 0; - padding-right: 0; -} - -.middle { - border-right-width: 0; - border-left-width: 0; - padding-right: 0; - padding-left: 0; -} - -.last { - border-left-width: 0; - padding-left: 0; -} - -.delete { - color: darkred; -} - -.disabled { - * { - background-color: gray; - } -} diff --git a/src/main/angular/src/app/pages/schedule/schedule.component.html b/src/main/angular/src/app/pages/schedule/schedule.component.html index dbe8bea..6706263 100644 --- a/src/main/angular/src/app/pages/schedule/schedule.component.html +++ b/src/main/angular/src/app/pages/schedule/schedule.component.html @@ -14,7 +14,7 @@ - + {{schedule.property?.type}} @@ -144,7 +144,7 @@ - + @@ -161,7 +161,7 @@ diff --git a/src/main/angular/src/app/pages/schedule/schedule.component.less b/src/main/angular/src/app/pages/schedule/schedule.component.less index 09b5709..4f5cc2b 100644 --- a/src/main/angular/src/app/pages/schedule/schedule.component.less +++ b/src/main/angular/src/app/pages/schedule/schedule.component.less @@ -17,60 +17,3 @@ tr.header { } } - -.empty { - text-align: center; - color: gray; - background-color: #DDDDDD; -} - -.boolean { - text-align: center; -} - -.true { - background-color: palegreen; -} - -.tristate { - background-color: yellow; -} - -.false { - background-color: indianred; -} - -.number { - text-align: right; -} - -.full { - padding: 0; -} - -.first { - border-right-width: 0; - padding-right: 0; -} - -.middle { - border-right-width: 0; - border-left-width: 0; - padding-right: 0; - padding-left: 0; -} - -.last { - border-left-width: 0; - padding-left: 0; -} - -.delete { - color: darkred; -} - -.disabled { - * { - background-color: gray; - } -} diff --git a/src/main/angular/src/app/pages/schedule/schedule.component.ts b/src/main/angular/src/app/pages/schedule/schedule.component.ts index 210fb72..ccab73f 100644 --- a/src/main/angular/src/app/pages/schedule/schedule.component.ts +++ b/src/main/angular/src/app/pages/schedule/schedule.component.ts @@ -7,6 +7,8 @@ import {faCheckCircle, faCircle, faTimesCircle} from '@fortawesome/free-regular- import {ActivatedRoute} from "@angular/router"; import {DataService} from "../../data.service"; import {PropertyService} from "../../api/property/property.service"; +import {Scene} from "../../api/scene/Scene"; +import {SceneService} from "../../api/scene/scene.service"; @Component({ selector: 'app-schedule', @@ -22,18 +24,22 @@ export class ScheduleComponent implements OnInit { schedule!: Schedule; + scenes: Scene[] = []; + constructor( readonly activatedRoute: ActivatedRoute, readonly scheduleService: ScheduleService, readonly scheduleEntryService: ScheduleEntryService, - readonly dataService: DataService, readonly propertyService: PropertyService, + readonly sceneService: SceneService, + readonly dataService: DataService, ) { // nothing } ngOnInit(): void { this.dataService.schedule = undefined; + this.sceneService.findAll(scenes => this.scenes = scenes); this.activatedRoute.params.subscribe(params => this.scheduleService.getById(params.id, schedule => this.setSchedule(schedule))); } diff --git a/src/main/angular/src/app/shared/edit-field/edit-field.component.less b/src/main/angular/src/app/shared/edit-field/edit-field.component.less index 965bdc3..e69de29 100644 --- a/src/main/angular/src/app/shared/edit-field/edit-field.component.less +++ b/src/main/angular/src/app/shared/edit-field/edit-field.component.less @@ -1,3 +0,0 @@ -.empty { - color: gray; -} \ No newline at end of file diff --git a/src/main/angular/src/app/shared/search/search.component.html b/src/main/angular/src/app/shared/search/search.component.html index 6d3dd9d..a5b6427 100644 --- a/src/main/angular/src/app/shared/search/search.component.html +++ b/src/main/angular/src/app/shared/search/search.component.html @@ -1,37 +1,22 @@ -
- +
{{selected.value}} [{{selected.key}}] - -LEER- -
- +
-
-
+
{{selected.value}} [{{selected.key}}] diff --git a/src/main/angular/src/app/shared/search/search.component.less b/src/main/angular/src/app/shared/search/search.component.less index 88549a1..2bc9ee1 100644 --- a/src/main/angular/src/app/shared/search/search.component.less +++ b/src/main/angular/src/app/shared/search/search.component.less @@ -1,7 +1,3 @@ -.empty { - color: gray; -} - .selected { font-weight: bold; border-bottom: 1px solid black; diff --git a/src/main/angular/src/app/shared/search/search.component.ts b/src/main/angular/src/app/shared/search/search.component.ts index 3a50400..5377125 100644 --- a/src/main/angular/src/app/shared/search/search.component.ts +++ b/src/main/angular/src/app/shared/search/search.component.ts @@ -24,7 +24,7 @@ export class SearchComponent implements OnInit { searchService!: ISearchService; @Input() - initial?: string; + initial?: number; @Input() showKey: boolean = false; @@ -65,7 +65,7 @@ export class SearchComponent implements OnInit { } start(): void { - this.term = this.initial || ""; + this.term = this.selected?.value || ""; if (this.resultList && this.input) { this.resultList.style.left = this.input.style.left; } diff --git a/src/main/angular/src/index.html b/src/main/angular/src/index.html index d3d0ec5..4c19e05 100644 --- a/src/main/angular/src/index.html +++ b/src/main/angular/src/index.html @@ -4,7 +4,7 @@ Angular - + diff --git a/src/main/angular/src/styles.less b/src/main/angular/src/styles.less index be80562..8822d5d 100644 --- a/src/main/angular/src/styles.less +++ b/src/main/angular/src/styles.less @@ -35,3 +35,61 @@ table.vertical { text-align: left; } } + +.empty { + text-align: center; + color: gray; + background-color: #DDDDDD; +} + +.boolean { + text-align: center; +} + +.true { + background-color: palegreen; +} + +.tristate { + background-color: yellow; +} + +.false { + background-color: indianred; +} + +.number { + text-align: right; +} + +.full { + padding: 0; +} + +.first { + border-right-width: 0; + padding-right: 0; +} + +.middle { + border-right-width: 0; + border-left-width: 0; + padding-right: 0; + padding-left: 0; +} + +.last { + border-left-width: 0; + padding-left: 0; +} + +.delete { + color: darkred; +} + +.disabled { + * { + background-color: gray; + } +} + diff --git a/src/main/java/de/ph87/homeautomation/DemoDataService.java b/src/main/java/de/ph87/homeautomation/DemoDataService.java index 4f0b36a..75f7984 100644 --- a/src/main/java/de/ph87/homeautomation/DemoDataService.java +++ b/src/main/java/de/ph87/homeautomation/DemoDataService.java @@ -9,6 +9,8 @@ import de.ph87.homeautomation.knx.group.KnxGroupReadService; import de.ph87.homeautomation.property.Property; import de.ph87.homeautomation.property.PropertyRepository; import de.ph87.homeautomation.property.PropertyType; +import de.ph87.homeautomation.scene.SceneRepository; +import de.ph87.homeautomation.scene.SceneWriteService; import de.ph87.homeautomation.schedule.Schedule; import de.ph87.homeautomation.schedule.ScheduleRepository; import de.ph87.homeautomation.schedule.entry.ScheduleEntry; @@ -41,6 +43,10 @@ public class DemoDataService { private final KnxGroupReadService knxGroupReadService; + private final SceneRepository sceneRepository; + + private final SceneWriteService sceneWriteService; + public void insertDemoData() { final Property ambiente_eg = createProperty("ambiente.eg", PropertyType.SWITCH, "Ambiente EG", knx(0, 3, 81), knx(0, 3, 80)); final Property ambiente_og = createProperty("ambiente.og", PropertyType.SWITCH, "Ambiente OG", knx(0, 6, 2), knx(0, 6, 3)); @@ -62,6 +68,13 @@ public class DemoDataService { deviceWriteService.createDeviceShutter("Flur Rollladen", flur_og_rollladen); } + if (sceneRepository.count() == 0) { + sceneWriteService.create(1, "Alles AUS"); + sceneWriteService.create(2, "Nachtlicht"); + sceneWriteService.create(30, "Dekoration AUS"); + sceneWriteService.create(31, "Dekoration AN"); + } + if (scheduleRepository.count() == 0) { final Schedule scheduleEgFlurLicht = createSchedule(true, "EG Flur Licht", flur_eg_licht); createTime(scheduleEgFlurLicht, true, 1, 0, 0, MIN30, true); diff --git a/src/main/java/de/ph87/homeautomation/channel/Channel.java b/src/main/java/de/ph87/homeautomation/channel/Channel.java index c301898..cb372e3 100644 --- a/src/main/java/de/ph87/homeautomation/channel/Channel.java +++ b/src/main/java/de/ph87/homeautomation/channel/Channel.java @@ -22,6 +22,6 @@ public abstract class Channel { public abstract Double getValue(); - public abstract ZonedDateTime getValueTimestamp(); + public abstract ZonedDateTime getTimestamp(); } diff --git a/src/main/java/de/ph87/homeautomation/device/DeviceSetDto.java b/src/main/java/de/ph87/homeautomation/device/DeviceSetDto.java deleted file mode 100644 index ed48c04..0000000 --- a/src/main/java/de/ph87/homeautomation/device/DeviceSetDto.java +++ /dev/null @@ -1,14 +0,0 @@ -package de.ph87.homeautomation.device; - -import lombok.Data; - -@Data -public class DeviceSetDto { - - private long id; - - private String property; - - private double value; - -} diff --git a/src/main/java/de/ph87/homeautomation/device/DeviceWriteService.java b/src/main/java/de/ph87/homeautomation/device/DeviceWriteService.java index dd312ea..ff516a5 100644 --- a/src/main/java/de/ph87/homeautomation/device/DeviceWriteService.java +++ b/src/main/java/de/ph87/homeautomation/device/DeviceWriteService.java @@ -5,7 +5,6 @@ import de.ph87.homeautomation.device.devices.DeviceDto; import de.ph87.homeautomation.device.devices.DeviceShutter; import de.ph87.homeautomation.device.devices.DeviceSwitch; import de.ph87.homeautomation.property.Property; -import de.ph87.homeautomation.property.PropertyWriteService; import de.ph87.homeautomation.schedule.ScheduleWriteService; import de.ph87.homeautomation.web.BadRequestException; import lombok.RequiredArgsConstructor; @@ -23,8 +22,6 @@ public class DeviceWriteService { private final DeviceRepository deviceRepository; - private final PropertyWriteService propertyWriteService; - private final DeviceReadService deviceReadService; public DeviceDto createDeviceSwitch(final String title, final Property stateProperty) { diff --git a/src/main/java/de/ph87/homeautomation/knx/group/KnxGroup.java b/src/main/java/de/ph87/homeautomation/knx/group/KnxGroup.java index f0ad9c8..4ecbed6 100644 --- a/src/main/java/de/ph87/homeautomation/knx/group/KnxGroup.java +++ b/src/main/java/de/ph87/homeautomation/knx/group/KnxGroup.java @@ -42,7 +42,7 @@ public class KnxGroup extends Channel { private Double value; - private ZonedDateTime valueTimestamp; + private ZonedDateTime timestamp; @Embedded private KnxGroupLinkInfo read = new KnxGroupLinkInfo(); diff --git a/src/main/java/de/ph87/homeautomation/knx/group/KnxGroupWriteService.java b/src/main/java/de/ph87/homeautomation/knx/group/KnxGroupWriteService.java index 3abaec9..aa7644f 100644 --- a/src/main/java/de/ph87/homeautomation/knx/group/KnxGroupWriteService.java +++ b/src/main/java/de/ph87/homeautomation/knx/group/KnxGroupWriteService.java @@ -72,7 +72,7 @@ public class KnxGroupWriteService { // TODO implement all DPTXlator... if (valueOptional.isPresent()) { knxGroup.setValue(valueOptional.get()); - knxGroup.setValueTimestamp(ZonedDateTime.now()); + knxGroup.setTimestamp(ZonedDateTime.now()); log.debug("KnxGroup updated: {}", knxGroup); applicationEventPublisher.publishEvent(new ChannelChangedEvent(knxGroup)); } else { diff --git a/src/main/java/de/ph87/homeautomation/property/PropertyController.java b/src/main/java/de/ph87/homeautomation/property/PropertyController.java index 23afaea..cea0cfc 100644 --- a/src/main/java/de/ph87/homeautomation/property/PropertyController.java +++ b/src/main/java/de/ph87/homeautomation/property/PropertyController.java @@ -17,15 +17,30 @@ public class PropertyController implements ISearchController { private final PropertyReadService propertyReadService; - @PostMapping("set") - public void set(@RequestBody final PropertySetDto dto) { - propertyWriteService.write(dto.getName(), dto.getValue()); + @GetMapping("findAll") + public List findAll() { + return propertyReadService.findAllDto(); + } + + @PostMapping("set/{id}/type") + public PropertyDto setPropertyType(@PathVariable final long id, @RequestBody final String propertyType) { + return propertyWriteService.set(id, Property::setType, PropertyType.valueOf(propertyType)); + } + + @PostMapping("set/{id}/name") + public PropertyDto setPropertyName(@PathVariable final long id, @RequestBody final String propertyName) { + return propertyWriteService.set(id, Property::setName, propertyName); + } + + @PostMapping("set/{id}/value") + public PropertyDto setValue(@PathVariable final long id, @RequestBody final double value) { + return propertyWriteService.set(id, propertyWriteService::write, value); } @Override - @PostMapping("getById") - public KeyValuePair getById(@RequestBody final String name) { - final PropertyDto propertyDto = propertyReadService.getDtoByName(name); + @GetMapping("getById/{id}") + public KeyValuePair getById(@PathVariable final long id) { + final PropertyDto propertyDto = propertyReadService.getDtoById(id); return toKeyValuePair(propertyDto); } @@ -39,9 +54,4 @@ public class PropertyController implements ISearchController { return new KeyValuePair(propertyDto.getName(), propertyDto.getTitle()); } - @PostMapping("set/{id}/type") - public PropertyDto setPropertyType(@PathVariable final long id, @RequestBody final String propertyType) { - return propertyWriteService.set(id, Property::setType, PropertyType.valueOf(propertyType)); - } - } diff --git a/src/main/java/de/ph87/homeautomation/property/PropertyDto.java b/src/main/java/de/ph87/homeautomation/property/PropertyDto.java index 87c1cd2..445596a 100644 --- a/src/main/java/de/ph87/homeautomation/property/PropertyDto.java +++ b/src/main/java/de/ph87/homeautomation/property/PropertyDto.java @@ -18,7 +18,7 @@ public final class PropertyDto implements Serializable { private final Double value; - private final ZonedDateTime valueTimestamp; + private final ZonedDateTime timestamp; public PropertyDto(final Property property) { this.id = property.getId(); @@ -26,7 +26,7 @@ public final class PropertyDto implements Serializable { this.name = property.getName(); this.title = property.getTitle(); this.value = property.getValue(); - this.valueTimestamp = property.getTimestamp(); + this.timestamp = property.getTimestamp(); } } diff --git a/src/main/java/de/ph87/homeautomation/property/PropertyReadService.java b/src/main/java/de/ph87/homeautomation/property/PropertyReadService.java index 3f881db..329aaf2 100644 --- a/src/main/java/de/ph87/homeautomation/property/PropertyReadService.java +++ b/src/main/java/de/ph87/homeautomation/property/PropertyReadService.java @@ -30,12 +30,16 @@ public class PropertyReadService { return propertyRepository.findAllByNameLike(like).stream().map(propertyMapper::toDto).collect(Collectors.toList()); } - public PropertyDto getDtoByName(final String name) { - return propertyMapper.toDto(getByName(name)); + public PropertyDto getDtoById(final long id) { + return propertyMapper.toDto(getById(id)); } public Property getById(final long id) { return propertyRepository.findById(id).orElseThrow(RuntimeException::new); } + public List findAllDto() { + return propertyRepository.findAll().stream().map(propertyMapper::toDto).collect(Collectors.toList()); + } + } diff --git a/src/main/java/de/ph87/homeautomation/property/PropertyRepository.java b/src/main/java/de/ph87/homeautomation/property/PropertyRepository.java index 10ba610..395982f 100644 --- a/src/main/java/de/ph87/homeautomation/property/PropertyRepository.java +++ b/src/main/java/de/ph87/homeautomation/property/PropertyRepository.java @@ -11,6 +11,8 @@ public interface PropertyRepository extends CrudRepository { List findAllByReadChannel_Id(long readChannelId); + List findAll(); + List findAllByNameLike(final String like); boolean existsByName(String name); diff --git a/src/main/java/de/ph87/homeautomation/property/PropertyType.java b/src/main/java/de/ph87/homeautomation/property/PropertyType.java index 4cddcb6..1a834c7 100644 --- a/src/main/java/de/ph87/homeautomation/property/PropertyType.java +++ b/src/main/java/de/ph87/homeautomation/property/PropertyType.java @@ -1,5 +1,5 @@ package de.ph87.homeautomation.property; public enum PropertyType { - SWITCH, SHUTTER, BRIGHTNESS, COLOR_TEMPERATURE, LUX, SCENE + SWITCH, SHUTTER, BRIGHTNESS_PERCENT, COLOR_TEMPERATURE, LUX, SCENE } diff --git a/src/main/java/de/ph87/homeautomation/property/PropertyWriteService.java b/src/main/java/de/ph87/homeautomation/property/PropertyWriteService.java index 695ce42..ea0906b 100644 --- a/src/main/java/de/ph87/homeautomation/property/PropertyWriteService.java +++ b/src/main/java/de/ph87/homeautomation/property/PropertyWriteService.java @@ -43,8 +43,8 @@ public class PropertyWriteService { propertyReadService.findAllByReadChannel_Id(event.getChannelId()) .forEach(property -> { property.setValue(property.getReadChannel().getValue()); - property.setTimestamp(property.getReadChannel().getValueTimestamp()); - log.debug("Updated Property from Channel: {}", property); + property.setTimestamp(property.getReadChannel().getTimestamp()); + log.debug("Updated Property from Channel: {}", property); webSocketService.send(propertyMapper.toDto(property), true); } ); diff --git a/src/main/java/de/ph87/homeautomation/scene/Scene.java b/src/main/java/de/ph87/homeautomation/scene/Scene.java new file mode 100644 index 0000000..dd9ec8e --- /dev/null +++ b/src/main/java/de/ph87/homeautomation/scene/Scene.java @@ -0,0 +1,33 @@ +package de.ph87.homeautomation.scene; + +import lombok.*; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Getter +@Setter +@ToString +@Entity +@NoArgsConstructor +public class Scene { + + @Id + @GeneratedValue + @Setter(AccessLevel.NONE) + private long id; + + @Column(nullable = false, unique = true) + private int number; + + @Column(nullable = false, unique = true) + private String title; + + public Scene(final int number, final String title) { + this.number = number; + this.title = title; + } + +} diff --git a/src/main/java/de/ph87/homeautomation/scene/SceneController.java b/src/main/java/de/ph87/homeautomation/scene/SceneController.java new file mode 100644 index 0000000..e541c55 --- /dev/null +++ b/src/main/java/de/ph87/homeautomation/scene/SceneController.java @@ -0,0 +1,42 @@ +package de.ph87.homeautomation.scene; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("scene") +@RequiredArgsConstructor +public class SceneController { + + private final SceneReadService sceneReadService; + + private final SceneWriteService sceneWriteService; + + @GetMapping("findAll") + public List findAll() { + return sceneReadService.findAll(); + } + + @GetMapping("getById/{id}") + public SceneDto getById(@PathVariable final long id) { + return sceneReadService.getDtoById(id); + } + + @PostMapping("create") + public SceneDto create(@RequestBody final int number) { + return sceneWriteService.create(number, null); + } + + @GetMapping("delete/{id}") + public void delete(@PathVariable final long id) { + sceneWriteService.delete(id); + } + + @PostMapping("set/{id}/title") + public SceneDto setName(@PathVariable final long id, @RequestBody final String title) { + return sceneWriteService.set(id, Scene::setTitle, title); + } + +} diff --git a/src/main/java/de/ph87/homeautomation/scene/SceneDto.java b/src/main/java/de/ph87/homeautomation/scene/SceneDto.java new file mode 100644 index 0000000..73e29c1 --- /dev/null +++ b/src/main/java/de/ph87/homeautomation/scene/SceneDto.java @@ -0,0 +1,20 @@ +package de.ph87.homeautomation.scene; + +import lombok.Getter; + +@Getter +public class SceneDto { + + public final long id; + + public final int number; + + public final String title; + + public SceneDto(final Scene scene) { + this.id = scene.getId(); + this.number = scene.getNumber(); + this.title = scene.getTitle(); + } + +} diff --git a/src/main/java/de/ph87/homeautomation/scene/SceneMapper.java b/src/main/java/de/ph87/homeautomation/scene/SceneMapper.java new file mode 100644 index 0000000..daf9234 --- /dev/null +++ b/src/main/java/de/ph87/homeautomation/scene/SceneMapper.java @@ -0,0 +1,12 @@ +package de.ph87.homeautomation.scene; + +import org.springframework.stereotype.Service; + +@Service +public class SceneMapper { + + public SceneDto toDto(final Scene scene) { + return new SceneDto(scene); + } + +} diff --git a/src/main/java/de/ph87/homeautomation/scene/SceneReadService.java b/src/main/java/de/ph87/homeautomation/scene/SceneReadService.java new file mode 100644 index 0000000..28a0783 --- /dev/null +++ b/src/main/java/de/ph87/homeautomation/scene/SceneReadService.java @@ -0,0 +1,34 @@ +package de.ph87.homeautomation.scene; + +import de.ph87.homeautomation.web.NotFoundException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.stream.Collectors; + +@Slf4j +@Service +@Transactional +@RequiredArgsConstructor +public class SceneReadService { + + private final SceneRepository sceneRepository; + + private final SceneMapper sceneMapper; + + public List findAll() { + return sceneRepository.findAll().stream().map(sceneMapper::toDto).collect(Collectors.toList()); + } + + public Scene getById(final long id) { + return sceneRepository.findById(id).orElseThrow(() -> new NotFoundException("Scene.id=%d", id)); + } + + public SceneDto getDtoById(final long id) { + return sceneMapper.toDto(getById(id)); + } + +} diff --git a/src/main/java/de/ph87/homeautomation/scene/SceneRepository.java b/src/main/java/de/ph87/homeautomation/scene/SceneRepository.java new file mode 100644 index 0000000..bf73c92 --- /dev/null +++ b/src/main/java/de/ph87/homeautomation/scene/SceneRepository.java @@ -0,0 +1,13 @@ +package de.ph87.homeautomation.scene; + +import org.springframework.data.repository.CrudRepository; + +import java.util.List; + +public interface SceneRepository extends CrudRepository { + + List findAll(); + + boolean existsByTitle(String title); + +} diff --git a/src/main/java/de/ph87/homeautomation/scene/SceneWriteService.java b/src/main/java/de/ph87/homeautomation/scene/SceneWriteService.java new file mode 100644 index 0000000..2632728 --- /dev/null +++ b/src/main/java/de/ph87/homeautomation/scene/SceneWriteService.java @@ -0,0 +1,48 @@ +package de.ph87.homeautomation.scene; + +import de.ph87.homeautomation.schedule.ScheduleWriteService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.function.BiConsumer; + +import static de.ph87.homeautomation.shared.Helpers.orElseGet; + +@Slf4j +@Service +@Transactional +@RequiredArgsConstructor +public class SceneWriteService { + + private final SceneRepository sceneRepository; + + private final SceneReadService sceneReadService; + + private final SceneMapper sceneMapper; + + public SceneDto set(final long id, final BiConsumer setter, final T value) { + final Scene scene = sceneReadService.getById(id); + setter.accept(scene, value); + return sceneMapper.toDto(scene); + } + + public void delete(final long id) { + sceneRepository.deleteById(id); + } + + public SceneDto create(final int number, final String title) { + return sceneMapper.toDto(sceneRepository.save(new Scene(number, orElseGet(title, this::generateUnusedTitle)))); + } + + private String generateUnusedTitle() { + int index = 0; + String title = null; + while (title == null || sceneRepository.existsByTitle(title)) { + title = ScheduleWriteService.NAME_PREFIX + ++index; + } + return title; + } + +} diff --git a/src/main/java/de/ph87/homeautomation/shared/Helpers.java b/src/main/java/de/ph87/homeautomation/shared/Helpers.java index f682c11..f05c0b5 100644 --- a/src/main/java/de/ph87/homeautomation/shared/Helpers.java +++ b/src/main/java/de/ph87/homeautomation/shared/Helpers.java @@ -3,9 +3,17 @@ package de.ph87.homeautomation.shared; import java.util.ArrayList; import java.util.List; import java.util.function.Function; +import java.util.function.Supplier; public class Helpers { + public static T orElseGet(final T value, final Supplier orElseGet) { + if (value == null) { + return orElseGet.get(); + } + return value; + } + public static U mapIfNotNull(final T value, final Function map) { if (value == null) { return null; diff --git a/src/main/java/de/ph87/homeautomation/shared/ISearchController.java b/src/main/java/de/ph87/homeautomation/shared/ISearchController.java index 04404d0..1dda3f4 100644 --- a/src/main/java/de/ph87/homeautomation/shared/ISearchController.java +++ b/src/main/java/de/ph87/homeautomation/shared/ISearchController.java @@ -4,7 +4,7 @@ import java.util.List; public interface ISearchController { - KeyValuePair getById(final String id); + KeyValuePair getById(final long id); List searchLike(final String term);