+ public Set<Timeslot> getTimeslots() {
+ return timeslots;
+ }
+
+ public void setTimeslots(Set<Timeslot> timeslots) {
+ this.timeslots = timeslots;
+ }
+
+ static class TimeslotsSerializer extends StdSerializer<Set<Timeslot>> {
+
+ public TimeslotsSerializer() {
+ this(null);
+ }
+
+ public TimeslotsSerializer(Class<Set<Timeslot>> tclass) {
+ super(tclass);
+ }
+
+ @Override
+ public void serialize(Set<Timeslot> timeslots, com.fasterxml.jackson.core.JsonGenerator gen,
+ SerializerProvider provider) throws IOException {
+ Set<Timeslot> results = new HashSet<>();
+ for (Timeslot timeslot : timeslots) {
+ try {
+ Timeslot result = new Timeslot();
+ result.setDuration(timeslot.getDuration());
+ result.setLabInfo(timeslot.getLabInfo());
+ result.setStartDateTime(timeslot.getStartDateTime());
+ result.setTimeslotId(timeslot.getTimeslotId());
+ results.add(result);
+ } catch (Exception ex) {
+ LOGGER.error(EELFLoggerDelegate.errorLogger,
+ "Error when serializing." + UserUtils.getStackTrace(ex));
+ }
+ }
+ gen.writeObject(results);
+ }
+ }
+