diff --git a/WebContent/WEB-INF/springDispatcher-servlet.xml b/WebContent/WEB-INF/springDispatcher-servlet.xml index 38bbea3af..d4ba5a5fc 100644 --- a/WebContent/WEB-INF/springDispatcher-servlet.xml +++ b/WebContent/WEB-INF/springDispatcher-servlet.xml @@ -232,6 +232,8 @@ + + diff --git a/src/com/serotonin/mango/web/dwr/BaseDwr.java b/src/com/serotonin/mango/web/dwr/BaseDwr.java index 7522600a4..d001552f1 100644 --- a/src/com/serotonin/mango/web/dwr/BaseDwr.java +++ b/src/com/serotonin/mango/web/dwr/BaseDwr.java @@ -51,7 +51,7 @@ import org.scada_lts.mango.adapter.MangoEvent; import org.scada_lts.mango.service.EventService; import org.scada_lts.mango.service.SystemSettingsService; -import org.scada_lts.web.contnet.SnippetContentGenerator; +import org.scada_lts.web.content.SnippetContentGenerator; abstract public class BaseDwr { public static final String MODEL_ATTR_EVENTS = "events"; diff --git a/src/org/scada_lts/web/beans/serializer/ChronologySerializer.java b/src/org/scada_lts/web/beans/serializer/ChronologySerializer.java new file mode 100644 index 000000000..515ad7203 --- /dev/null +++ b/src/org/scada_lts/web/beans/serializer/ChronologySerializer.java @@ -0,0 +1,24 @@ +package org.scada_lts.web.beans.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +import java.io.IOException; +import java.time.chrono.Chronology; + + +public class ChronologySerializer extends StdSerializer { + + public ChronologySerializer() { + super(Chronology.class); + } + + @Override + public void serialize(Chronology value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeStartObject(); + jgen.writeStringField("id", value.getId()); + jgen.writeStringField("calendarType", value.getCalendarType()); + jgen.writeEndObject(); + } +} \ No newline at end of file diff --git a/src/org/scada_lts/web/beans/serializer/LocalDateTimeSerializer.java b/src/org/scada_lts/web/beans/serializer/LocalDateTimeSerializer.java new file mode 100644 index 000000000..8577f1d09 --- /dev/null +++ b/src/org/scada_lts/web/beans/serializer/LocalDateTimeSerializer.java @@ -0,0 +1,33 @@ +package org.scada_lts.web.beans.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +import java.io.IOException; +import java.time.LocalDateTime; + + +public class LocalDateTimeSerializer extends StdSerializer { + + public LocalDateTimeSerializer() { + super(LocalDateTime.class); + } + + @Override + public void serialize(LocalDateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeStartObject(); + jgen.writeNumberField("nano", value.getNano()); + jgen.writeNumberField("year", value.getYear()); + jgen.writeNumberField("monthValue", value.getMonthValue()); + jgen.writeNumberField("dayOfMonth", value.getDayOfMonth()); + jgen.writeNumberField("hour", value.getHour()); + jgen.writeNumberField("minute", value.getMinute()); + jgen.writeNumberField("second", value.getSecond()); + jgen.writeStringField("month", value.getMonth().name()); + jgen.writeStringField("dayOfWeek", value.getDayOfWeek().name()); + jgen.writeNumberField("dayOfYear", value.getDayOfYear()); + jgen.writeObjectField("chronology", value.getChronology()); + jgen.writeEndObject(); + } +} \ No newline at end of file diff --git a/src/org/scada_lts/web/contnet/SnippetContentGenerator.java b/src/org/scada_lts/web/content/SnippetContentGenerator.java similarity index 99% rename from src/org/scada_lts/web/contnet/SnippetContentGenerator.java rename to src/org/scada_lts/web/content/SnippetContentGenerator.java index b87a887af..950ba6a09 100644 --- a/src/org/scada_lts/web/contnet/SnippetContentGenerator.java +++ b/src/org/scada_lts/web/content/SnippetContentGenerator.java @@ -1,4 +1,4 @@ -package org.scada_lts.web.contnet; +package org.scada_lts.web.content; import java.io.IOException; import java.util.HashMap; diff --git a/src/org/scada_lts/web/contnet/SnippetServletResponse.java b/src/org/scada_lts/web/content/SnippetServletResponse.java similarity index 99% rename from src/org/scada_lts/web/contnet/SnippetServletResponse.java rename to src/org/scada_lts/web/content/SnippetServletResponse.java index 24bd961df..d28d858c7 100644 --- a/src/org/scada_lts/web/contnet/SnippetServletResponse.java +++ b/src/org/scada_lts/web/content/SnippetServletResponse.java @@ -1,4 +1,4 @@ -package org.scada_lts.web.contnet; +package org.scada_lts.web.content; import java.io.IOException; import java.io.PrintWriter; diff --git a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java index 7f67d3a56..09708facd 100644 --- a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java +++ b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java @@ -15,7 +15,7 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.scada_lts.dao.SystemSettingsDAO; import org.scada_lts.mango.service.EventService; -import org.scada_lts.web.contnet.SnippetContentGenerator; +import org.scada_lts.web.content.SnippetContentGenerator; import org.springframework.mock.web.MockHttpSession; import utils.TestConcurrentUtils; import utils.mock.EventServiceMock; diff --git a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java index 633e9af0b..10d7d860b 100644 --- a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java +++ b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java @@ -30,7 +30,7 @@ import org.scada_lts.dao.SystemSettingsDAO; import org.scada_lts.mango.service.EventService; import org.scada_lts.mango.service.ViewService; -import org.scada_lts.web.contnet.SnippetContentGenerator; +import org.scada_lts.web.content.SnippetContentGenerator; import org.springframework.mock.web.MockHttpSession; import utils.*; import utils.mock.ChangePointValueDataPointRtMock;