@Override public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException { String text = jsonObject.getString("loggingType"); if (text != null) { loggingType = LOGGING_TYPE_CODES.getId(text); if (loggingType == -1) throw new TranslatableJsonException( "emport.error.invalid", "loggingType", text, LOGGING_TYPE_CODES.getCodeList()); } text = jsonObject.getString("intervalLoggingPeriodType"); if (text != null) { intervalLoggingPeriodType = Common.TIME_PERIOD_CODES.getId(text); if (intervalLoggingPeriodType == -1) throw new TranslatableJsonException( "emport.error.invalid", "intervalLoggingPeriodType", text, Common.TIME_PERIOD_CODES.getCodeList()); } text = jsonObject.getString("intervalLoggingType"); if (text != null) { intervalLoggingType = INTERVAL_LOGGING_TYPE_CODES.getId(text); if (intervalLoggingType == -1) throw new TranslatableJsonException( "emport.error.invalid", "intervalLoggingType", text, INTERVAL_LOGGING_TYPE_CODES.getCodeList()); } text = jsonObject.getString("purgeType"); if (text != null) { purgeType = Common.TIME_PERIOD_CODES.getId(text); if (purgeType == -1) throw new TranslatableJsonException( "emport.error.invalid", "purgeType", text, Common.TIME_PERIOD_CODES.getCodeList()); } JsonObject locatorJson = jsonObject.getJsonObject("pointLocator"); if (locatorJson != null) reader.readInto(pointLocator, locatorJson); JsonArray pedArray = jsonObject.getJsonArray("eventDetectors"); if (pedArray != null) { for (JsonValue jv : pedArray) { JsonObject pedObject = jv.toJsonObject(); String pedXid = pedObject.getString("xid"); if (StringUtils.isBlank(pedXid)) throw new TranslatableJsonException("emport.error.ped.missingAttr", "xid"); // Use the ped xid to lookup an existing ped. PointEventDetectorVO ped = null; for (PointEventDetectorVO existing : eventDetectors) { if (StringUtils.equals(pedXid, existing.getXid())) { ped = existing; break; } } if (ped == null) { // Create a new one ped = new PointEventDetectorVO(); ped.setId(Common.NEW_ID); ped.setXid(pedXid); ped.njbSetDataPoint(this); eventDetectors.add(ped); } reader.readInto(ped, pedObject); } } text = jsonObject.getString("engineeringUnits"); if (text != null) { engineeringUnits = ENGINEERING_UNITS_CODES.getId(text); if (engineeringUnits == -1) engineeringUnits = ENGINEERING_UNITS_DEFAULT; } text = jsonObject.getString("plotType"); if (text != null) { plotType = PLOT_TYPE_CODES.getId(text); if (plotType == -1) throw new TranslatableJsonException( "emport.error.invalid", "plotType", text, PLOT_TYPE_CODES.getCodeList()); } }