code clean, package cleanup
This commit is contained in:
parent
8e3e763e59
commit
551efdbcff
@ -1,4 +1,4 @@
|
||||
package de.ph87.home.common;
|
||||
package de.ph87.home.common.crud;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.annotation.Nullable;
|
||||
@ -1,4 +1,4 @@
|
||||
package de.ph87.home.common;
|
||||
package de.ph87.home.common.crud;
|
||||
|
||||
import lombok.NonNull;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@ -1,4 +1,4 @@
|
||||
package de.ph87.home.common;
|
||||
package de.ph87.home.common.crud;
|
||||
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.NonNull;
|
||||
@ -1,4 +1,4 @@
|
||||
package de.ph87.home.property;
|
||||
package de.ph87.home.common.json;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClassSerializer extends JsonSerializer<Class<?>> {
|
||||
public class ClassSimpleNameSerializer extends JsonSerializer<Class<?>> {
|
||||
|
||||
@Override
|
||||
public void serialize(final Class<?> aClass, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException {
|
||||
@ -1,4 +1,4 @@
|
||||
package de.ph87.home.common;
|
||||
package de.ph87.home.common.json;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
@ -9,7 +9,7 @@ import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
public class EpochSecondsToZonedDateTime extends JsonDeserializer<ZonedDateTime> {
|
||||
public class EpochSecondsToZonedDateTimeDeserializer extends JsonDeserializer<ZonedDateTime> {
|
||||
|
||||
@Override
|
||||
public ZonedDateTime deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException {
|
||||
@ -1,4 +1,4 @@
|
||||
package de.ph87.home.common;
|
||||
package de.ph87.home.common.json;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
@ -7,7 +7,7 @@ import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
|
||||
public class SecondsToDuration extends JsonDeserializer<Duration> {
|
||||
public class SecondsToDurationDeserializer extends JsonDeserializer<Duration> {
|
||||
|
||||
@Override
|
||||
public Duration deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException {
|
||||
@ -1,7 +1,7 @@
|
||||
package de.ph87.home.device;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import de.ph87.home.common.AbstractSearchFilter;
|
||||
import de.ph87.home.common.crud.AbstractSearchFilter;
|
||||
import de.ph87.home.property.PropertyTypeMismatch;
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package de.ph87.home.device;
|
||||
|
||||
import de.ph87.home.common.EntityNotFound;
|
||||
import de.ph87.home.common.crud.EntityNotFound;
|
||||
import de.ph87.home.property.*;
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.NonNull;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package de.ph87.home.knx.group;
|
||||
|
||||
import de.ph87.home.knx.DPT;
|
||||
import de.ph87.home.knx.group.dpt.DPT;
|
||||
import de.ph87.home.property.State;
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package de.ph87.home.knx.group;
|
||||
|
||||
import de.ph87.home.common.AbstractSearchFilter;
|
||||
import de.ph87.home.common.crud.AbstractSearchFilter;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package de.ph87.home.knx.group;
|
||||
|
||||
import de.ph87.home.knx.DPT;
|
||||
import de.ph87.home.knx.DPTException;
|
||||
import de.ph87.home.knx.group.dpt.DPT;
|
||||
import de.ph87.home.knx.group.dpt.DPTException;
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package de.ph87.home.knx.group;
|
||||
|
||||
import de.ph87.home.common.EntityNotFound;
|
||||
import de.ph87.home.common.crud.EntityNotFound;
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package de.ph87.home.knx;
|
||||
package de.ph87.home.knx.group.dpt;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
@ -1,4 +1,4 @@
|
||||
package de.ph87.home.knx;
|
||||
package de.ph87.home.knx.group.dpt;
|
||||
|
||||
import lombok.NonNull;
|
||||
|
||||
@ -96,6 +96,9 @@ public class KnxPropertyService {
|
||||
}
|
||||
case DOUBLE -> propertyService.update(this, knxProperty.getId(), Double.class, translator.getNumericValue(), translator.getValue());
|
||||
};
|
||||
if (property.getState() == null) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
group.setState(property.getState());
|
||||
groupService.publish(group);
|
||||
} catch (KNXException | PropertyNotFound | PropertyTypeMismatch | PropertyNotOwned e) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package de.ph87.home.property;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import de.ph87.home.common.json.ClassSimpleNameSerializer;
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
@ -14,7 +15,7 @@ import java.util.Objects;
|
||||
public class State<T> {
|
||||
|
||||
@NonNull
|
||||
@JsonSerialize(using = ClassSerializer.class)
|
||||
@JsonSerialize(using = ClassSimpleNameSerializer.class)
|
||||
private final Class<T> type;
|
||||
|
||||
@NonNull
|
||||
|
||||
@ -3,8 +3,8 @@ package de.ph87.home.tvheadend.api.dto;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import de.ph87.home.common.EpochSecondsToZonedDateTime;
|
||||
import de.ph87.home.common.SecondsToDuration;
|
||||
import de.ph87.home.common.json.EpochSecondsToZonedDateTimeDeserializer;
|
||||
import de.ph87.home.common.json.SecondsToDurationDeserializer;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
@ -38,38 +38,38 @@ public class DvrEntryGridUpcoming {
|
||||
private boolean enabled;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTime.class)
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTimeDeserializer.class)
|
||||
private ZonedDateTime create;
|
||||
|
||||
@JsonProperty
|
||||
private long watched;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTime.class)
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTimeDeserializer.class)
|
||||
private ZonedDateTime start;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = SecondsToDuration.class)
|
||||
@JsonDeserialize(using = SecondsToDurationDeserializer.class)
|
||||
private Duration start_extra;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTime.class)
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTimeDeserializer.class)
|
||||
private ZonedDateTime start_real;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTime.class)
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTimeDeserializer.class)
|
||||
private ZonedDateTime stop;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = SecondsToDuration.class)
|
||||
@JsonDeserialize(using = SecondsToDurationDeserializer.class)
|
||||
private Duration stop_extra;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTime.class)
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTimeDeserializer.class)
|
||||
private ZonedDateTime stop_real;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = SecondsToDuration.class)
|
||||
@JsonDeserialize(using = SecondsToDurationDeserializer.class)
|
||||
private Duration duration;
|
||||
|
||||
@JsonProperty
|
||||
@ -207,7 +207,7 @@ public class DvrEntryGridUpcoming {
|
||||
private long duplicate;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTime.class)
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTimeDeserializer.class)
|
||||
private ZonedDateTime first_aired;
|
||||
|
||||
@JsonProperty
|
||||
|
||||
@ -2,7 +2,7 @@ package de.ph87.home.tvheadend.api.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import de.ph87.home.common.EpochSecondsToZonedDateTime;
|
||||
import de.ph87.home.common.json.EpochSecondsToZonedDateTimeDeserializer;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@ -39,7 +39,7 @@ public class StatusConnections {
|
||||
private int peer_port;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTime.class)
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTimeDeserializer.class)
|
||||
private ZonedDateTime started;
|
||||
|
||||
@JsonProperty
|
||||
|
||||
@ -2,7 +2,7 @@ package de.ph87.home.tvheadend.api.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import de.ph87.home.common.EpochSecondsToZonedDateTime;
|
||||
import de.ph87.home.common.json.EpochSecondsToZonedDateTimeDeserializer;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@ -27,7 +27,7 @@ public class StatusSubscriptions {
|
||||
private long id;
|
||||
|
||||
@JsonProperty
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTime.class)
|
||||
@JsonDeserialize(using = EpochSecondsToZonedDateTimeDeserializer.class)
|
||||
private ZonedDateTime start;
|
||||
|
||||
@JsonProperty
|
||||
|
||||
Loading…
Reference in New Issue
Block a user