diff --git a/modules/rest-api/src/com/haulmont/addon/restapi/api/common/RestParseUtils.java b/modules/rest-api/src/com/haulmont/addon/restapi/api/common/RestParseUtils.java index 56f3866..7e5b715 100644 --- a/modules/rest-api/src/com/haulmont/addon/restapi/api/common/RestParseUtils.java +++ b/modules/rest-api/src/com/haulmont/addon/restapi/api/common/RestParseUtils.java @@ -104,6 +104,9 @@ public Object toObject(Type type, String value, @Nullable String modelVersion) t if (OffsetTime.class == clazz) { return Datatypes.getNN(OffsetTime.class).parse(value); } + if (Time.class == clazz) { + return Datatypes.getNN(Time.class).parse(value); + } if (BigDecimal.class == clazz) return Datatypes.getNN(BigDecimal.class).parse(value); if (Boolean.class == clazz || Boolean.TYPE == clazz) return Datatypes.getNN(Boolean.class).parse(value); if (Long.class == clazz || Long.TYPE == clazz) return Datatypes.getNN(Long.class).parse(value); diff --git a/test/restapi-demo/modules/core/src/com/haulmont/rest/demo/core/app/PortalTestServiceBean.java b/test/restapi-demo/modules/core/src/com/haulmont/rest/demo/core/app/PortalTestServiceBean.java index 995b244..f8d8be4 100644 --- a/test/restapi-demo/modules/core/src/com/haulmont/rest/demo/core/app/PortalTestServiceBean.java +++ b/test/restapi-demo/modules/core/src/com/haulmont/rest/demo/core/app/PortalTestServiceBean.java @@ -25,6 +25,7 @@ import javax.inject.Inject; import javax.validation.constraints.Pattern; import java.math.BigDecimal; +import java.sql.Time; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.*; @@ -55,12 +56,13 @@ public Integer sum(int number1, String number2) { } @Override - public String convertDate(LocalDate localDate, LocalDateTime localDateTime, LocalTime localTime, OffsetDateTime offsetDateTime, OffsetTime offsetTime) { + public String convertDate(LocalDate localDate, LocalDateTime localDateTime, LocalTime localTime, OffsetDateTime offsetDateTime, OffsetTime offsetTime, Time time) { StringBuilder builder = new StringBuilder(localDate.toString()).append(","); builder.append(localDateTime.toString()).append(","); builder.append(localTime.toString()).append(","); builder.append(offsetDateTime.toString()).append(","); builder.append(offsetTime.toString()); + builder.append(time.toString()); return builder.toString(); } diff --git a/test/restapi-demo/modules/global/src/com/haulmont/rest/demo/core/app/PortalTestService.java b/test/restapi-demo/modules/global/src/com/haulmont/rest/demo/core/app/PortalTestService.java index 0c3efb4..1b6be82 100644 --- a/test/restapi-demo/modules/global/src/com/haulmont/rest/demo/core/app/PortalTestService.java +++ b/test/restapi-demo/modules/global/src/com/haulmont/rest/demo/core/app/PortalTestService.java @@ -14,6 +14,7 @@ import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import java.math.BigDecimal; +import java.sql.Time; import java.text.ParseException; import java.time.*; import java.util.Date; @@ -34,7 +35,7 @@ public interface PortalTestService { Integer sum(int number1, String number2); - String convertDate(LocalDate localDate, LocalDateTime localDateTime, LocalTime localTime, OffsetDateTime offsetDateTime, OffsetTime offsetTime); + String convertDate(LocalDate localDate, LocalDateTime localDateTime, LocalTime localTime, OffsetDateTime offsetDateTime, OffsetTime offsetTime, Time time); void methodWithCustomException(); diff --git a/test/restapi-demo/modules/portal/src/com/haulmont/rest/demo/rest-services-v2.xml b/test/restapi-demo/modules/portal/src/com/haulmont/rest/demo/rest-services-v2.xml index 5a9af17..039755f 100644 --- a/test/restapi-demo/modules/portal/src/com/haulmont/rest/demo/rest-services-v2.xml +++ b/test/restapi-demo/modules/portal/src/com/haulmont/rest/demo/rest-services-v2.xml @@ -21,6 +21,7 @@ + diff --git a/test/restapi-demo/modules/portal/test/com/haulmont/rest/demo/http/rest/data/serviceWithDateParams.json b/test/restapi-demo/modules/portal/test/com/haulmont/rest/demo/http/rest/data/serviceWithDateParams.json index 53642b7..7b36e53 100644 --- a/test/restapi-demo/modules/portal/test/com/haulmont/rest/demo/http/rest/data/serviceWithDateParams.json +++ b/test/restapi-demo/modules/portal/test/com/haulmont/rest/demo/http/rest/data/serviceWithDateParams.json @@ -3,5 +3,6 @@ "localDateTime": "2021-02-24 15:15:15.053", "localTime": "15:15:15", "offsetDateTime": "2021-02-24 15:15:15.053 +0400", - "offsetTime": "15:15:15 +0400" + "offsetTime": "15:15:15 +0400", + "time": "15:15:15" } \ No newline at end of file diff --git a/test/restapi-demo/modules/web/src/com/haulmont/rest/demo/rest-services-v2.xml b/test/restapi-demo/modules/web/src/com/haulmont/rest/demo/rest-services-v2.xml index 5a9af17..039755f 100644 --- a/test/restapi-demo/modules/web/src/com/haulmont/rest/demo/rest-services-v2.xml +++ b/test/restapi-demo/modules/web/src/com/haulmont/rest/demo/rest-services-v2.xml @@ -21,6 +21,7 @@ +