diff --git a/src/main/java/ru/investbook/web/forms/model/EventCashFlowModel.java b/src/main/java/ru/investbook/web/forms/model/EventCashFlowModel.java index 9d3dc5a5..6513d0c9 100644 --- a/src/main/java/ru/investbook/web/forms/model/EventCashFlowModel.java +++ b/src/main/java/ru/investbook/web/forms/model/EventCashFlowModel.java @@ -19,6 +19,7 @@ package ru.investbook.web.forms.model; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; import lombok.Data; import org.checkerframework.checker.nullness.qual.Nullable; @@ -41,17 +42,17 @@ public class EventCashFlowModel { private @NotEmpty String portfolio; @DateTimeFormat(pattern = "yyyy-MM-dd") - private LocalDate date = LocalDate.now(); + private @NotNull LocalDate date = LocalDate.now(); @DateTimeFormat(pattern = "HH:mm:ss") - private LocalTime time = LocalTime.NOON; + private @NotNull LocalTime time = LocalTime.NOON; - private CashFlowType type; + private @NotNull CashFlowType type; /** * Negative value for cash out, otherwise - positive */ - private BigDecimal value; + private @NotNull BigDecimal value; private @NotEmpty String valueCurrency = "RUB"; diff --git a/src/main/java/ru/investbook/web/forms/model/ForeignExchangeRateModel.java b/src/main/java/ru/investbook/web/forms/model/ForeignExchangeRateModel.java index 4e4ac444..c5b74939 100644 --- a/src/main/java/ru/investbook/web/forms/model/ForeignExchangeRateModel.java +++ b/src/main/java/ru/investbook/web/forms/model/ForeignExchangeRateModel.java @@ -19,6 +19,7 @@ package ru.investbook.web.forms.model; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; @@ -30,13 +31,14 @@ public class ForeignExchangeRateModel { @DateTimeFormat(pattern = "yyyy-MM-dd") - private LocalDate date = LocalDate.now(); + private @NotNull LocalDate date = LocalDate.now(); private @NotEmpty String baseCurrency; - @NotEmpty String quoteCurrency; + @NotEmpty + String quoteCurrency; - private @Positive BigDecimal rate; + private @Positive @NotNull BigDecimal rate; public void setBaseCurrency(String currency) { this.baseCurrency = currency.toUpperCase(); diff --git a/src/main/java/ru/investbook/web/forms/model/PortfolioCashModel.java b/src/main/java/ru/investbook/web/forms/model/PortfolioCashModel.java index 967e59bc..eb897fae 100644 --- a/src/main/java/ru/investbook/web/forms/model/PortfolioCashModel.java +++ b/src/main/java/ru/investbook/web/forms/model/PortfolioCashModel.java @@ -19,6 +19,7 @@ package ru.investbook.web.forms.model; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; import org.checkerframework.checker.nullness.qual.Nullable; @@ -39,12 +40,12 @@ public class PortfolioCashModel { private @Nullable String market; @DateTimeFormat(pattern = "yyyy-MM-dd") - private LocalDate date = LocalDate.now(); + private @NotNull LocalDate date = LocalDate.now(); @DateTimeFormat(pattern = "HH:mm:ss") - private LocalTime time = LocalTime.NOON; + private @NotNull LocalTime time = LocalTime.NOON; - private BigDecimal cash = BigDecimal.ZERO; + private @NotNull BigDecimal cash = BigDecimal.ZERO; - private String currency = "RUB"; + private @NotEmpty String currency = "RUB"; } diff --git a/src/main/java/ru/investbook/web/forms/model/PortfolioPropertyModel.java b/src/main/java/ru/investbook/web/forms/model/PortfolioPropertyModel.java index 621ff2fc..23edd150 100644 --- a/src/main/java/ru/investbook/web/forms/model/PortfolioPropertyModel.java +++ b/src/main/java/ru/investbook/web/forms/model/PortfolioPropertyModel.java @@ -19,6 +19,7 @@ package ru.investbook.web.forms.model; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.checkerframework.checker.nullness.qual.Nullable; import org.springframework.format.annotation.DateTimeFormat; @@ -34,8 +35,8 @@ public abstract class PortfolioPropertyModel { private @NotEmpty String portfolio; @DateTimeFormat(pattern = "yyyy-MM-dd") - private LocalDate date = LocalDate.now(); + private @NotNull LocalDate date = LocalDate.now(); @DateTimeFormat(pattern = "HH:mm:ss") - private LocalTime time = LocalTime.NOON; + private @NotNull LocalTime time = LocalTime.NOON; } diff --git a/src/main/java/ru/investbook/web/forms/model/PortfolioPropertyTotalAssetsModel.java b/src/main/java/ru/investbook/web/forms/model/PortfolioPropertyTotalAssetsModel.java index e05e2e87..f583d46c 100644 --- a/src/main/java/ru/investbook/web/forms/model/PortfolioPropertyTotalAssetsModel.java +++ b/src/main/java/ru/investbook/web/forms/model/PortfolioPropertyTotalAssetsModel.java @@ -18,6 +18,7 @@ package ru.investbook.web.forms.model; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; import org.spacious_team.broker.pojo.PortfolioPropertyType; @@ -31,9 +32,9 @@ @EqualsAndHashCode(callSuper = true) public class PortfolioPropertyTotalAssetsModel extends PortfolioPropertyModel { - private BigDecimal totalAssets; + private @NotNull BigDecimal totalAssets; - private Currency totalAssetsCurrency; + private @NotNull Currency totalAssetsCurrency; public enum Currency { RUB, USD; diff --git a/src/main/java/ru/investbook/web/forms/model/SecurityDescriptionModel.java b/src/main/java/ru/investbook/web/forms/model/SecurityDescriptionModel.java index 7650c2e4..096b744e 100644 --- a/src/main/java/ru/investbook/web/forms/model/SecurityDescriptionModel.java +++ b/src/main/java/ru/investbook/web/forms/model/SecurityDescriptionModel.java @@ -19,6 +19,7 @@ package ru.investbook.web.forms.model; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.checkerframework.checker.nullness.qual.Nullable; @@ -31,9 +32,9 @@ public class SecurityDescriptionModel { */ private @NotEmpty String security = "Наименование (RU0000000000)"; - private @Nullable @NotEmpty String sector; + private @NotEmpty String sector; - private SecurityType securityType; + private @NotNull SecurityType securityType; public void setSecurity(Integer securityId, @Nullable String securityIsin, @Nullable String securityName, SecurityType securityType) { this.securityId = securityId; diff --git a/src/main/java/ru/investbook/web/forms/model/SecurityEventCashFlowModel.java b/src/main/java/ru/investbook/web/forms/model/SecurityEventCashFlowModel.java index d595ae06..5cfcbc32 100644 --- a/src/main/java/ru/investbook/web/forms/model/SecurityEventCashFlowModel.java +++ b/src/main/java/ru/investbook/web/forms/model/SecurityEventCashFlowModel.java @@ -19,6 +19,7 @@ package ru.investbook.web.forms.model; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.PositiveOrZero; import lombok.Data; import org.checkerframework.checker.nullness.qual.Nullable; @@ -39,10 +40,10 @@ public class SecurityEventCashFlowModel { private @NotEmpty String portfolio; @DateTimeFormat(pattern = "yyyy-MM-dd") - private LocalDate date = LocalDate.now(); + private @NotNull LocalDate date = LocalDate.now(); @DateTimeFormat(pattern = "HH:mm:ss") - private LocalTime time = LocalTime.NOON; + private @NotNull LocalTime time = LocalTime.NOON; /** * In "name (isin)" or "contract-name" format @@ -51,9 +52,9 @@ public class SecurityEventCashFlowModel { private int count; - private CashFlowType type; + private @NotNull CashFlowType type; - private BigDecimal value; + private @NotNull BigDecimal value; private @NotEmpty String valueCurrency = "RUB"; diff --git a/src/main/java/ru/investbook/web/forms/model/SecurityQuoteModel.java b/src/main/java/ru/investbook/web/forms/model/SecurityQuoteModel.java index 012474b3..9b528dcd 100644 --- a/src/main/java/ru/investbook/web/forms/model/SecurityQuoteModel.java +++ b/src/main/java/ru/investbook/web/forms/model/SecurityQuoteModel.java @@ -19,6 +19,7 @@ package ru.investbook.web.forms.model; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; import jakarta.validation.constraints.PositiveOrZero; import lombok.Data; @@ -41,11 +42,11 @@ public class SecurityQuoteModel { */ private @NotEmpty String security; - private SecurityType securityType; + private @NotNull SecurityType securityType; - private Instant timestamp = LocalDate.now().atTime(LocalTime.NOON).atZone(systemDefault()).toInstant(); + private @NotNull Instant timestamp = LocalDate.now().atTime(LocalTime.NOON).atZone(systemDefault()).toInstant(); - private @Positive BigDecimal quote; + private @NotNull @Positive BigDecimal quote; private @Nullable @Positive BigDecimal price; diff --git a/src/main/java/ru/investbook/web/forms/model/SplitModel.java b/src/main/java/ru/investbook/web/forms/model/SplitModel.java index 6a9d34b5..c207f62f 100644 --- a/src/main/java/ru/investbook/web/forms/model/SplitModel.java +++ b/src/main/java/ru/investbook/web/forms/model/SplitModel.java @@ -19,6 +19,7 @@ package ru.investbook.web.forms.model; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; import lombok.Data; import org.checkerframework.checker.nullness.qual.Nullable; @@ -36,10 +37,10 @@ public class SplitModel { private @NotEmpty String portfolio; @DateTimeFormat(pattern = "yyyy-MM-dd") - private LocalDate date = LocalDate.now(); + private @NotNull LocalDate date = LocalDate.now(); @DateTimeFormat(pattern = "HH:mm") - private LocalTime time = LocalTime.NOON; + private @NotNull LocalTime time = LocalTime.NOON; /** * In "name (isin)" format diff --git a/src/main/java/ru/investbook/web/forms/model/TransactionModel.java b/src/main/java/ru/investbook/web/forms/model/TransactionModel.java index 59de0f6b..8d9f0cd3 100644 --- a/src/main/java/ru/investbook/web/forms/model/TransactionModel.java +++ b/src/main/java/ru/investbook/web/forms/model/TransactionModel.java @@ -19,6 +19,7 @@ package ru.investbook.web.forms.model; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; import jakarta.validation.constraints.PositiveOrZero; import jakarta.xml.bind.DatatypeConverter; @@ -56,20 +57,20 @@ public class TransactionModel { private @NotEmpty String portfolio; - private Action action; + private @NotNull Action action; @DateTimeFormat(pattern = "yyyy-MM-dd") - private LocalDate date = LocalDate.now(); + private @NotNull LocalDate date = LocalDate.now(); @DateTimeFormat(pattern = "HH:mm:ss") - private LocalTime time = LocalTime.NOON; + private @NotNull LocalTime time = LocalTime.NOON; /** * In "name (isin)" or "contract-name" format */ private @NotEmpty String security; - private SecurityType securityType; + private @NotNull SecurityType securityType; private @Positive int count;