Import Errors
-
I've encountered a few errors trying to duplicate mango instances for testing and backup purposes.
1.If a point fails to import, because of an invalid data source XID or bad point event detector, the entire point hierarchy also fails to import if one referenced datapoint is missing. Would it be possible to change this behaviour so the missing point is left out of the point hierarchy but the rest of the point hierarchy is imported?
2.It appears that Multistate points with High Limit Point Event Detectors are exported with a "state" property on the point event detector instead of a "limit", generating this error:
Data point 'DP_728959': Point event detector must have a 'limit'. ```The point import fails in JsonReader.populateObject. 3. I've modified some VOs, such as reports and HttpImagePointLocatorVO. The new properties get exported, but import fails at JsonReader.populateObject.
Data point 'DP_551301': 'JsonException reading property 'overlayPoints' of type java.util.List', caused by: 'List type provided without innerType definition'
4. The SNMP data source fails to import if it is SNMP version 1 but this is an easy fix: It looks like in SnmpDataSourceVo.validate()
if (snmpVersion < 1 || snmpVersion > 3) response.addContextualMessage("snmpVersion", "validate.invalidValue");
should be
if (snmpVersion < 0 || snmpVersion > 3) response.addContextualMessage("snmpVersion", "validate.invalidValue");
since in jsp/datasourceEdit/editSnmp.jsp
<td class="formLabelRequired"><fmt:message key="dsEdit.snmp.version"/></td> <td class="formField"> <sst:select id="snmpVersion" value="${dataSource.snmpVersion}" onchange="versionChange()"> <sst:option value="<%= Integer.toString(SnmpConstants.version1) %>">1</sst:option> <sst:option value="<%= Integer.toString(SnmpConstants.version2c) %>">2c</sst:option> <sst:option value="<%= Integer.toString(SnmpConstants.version3) %>">3</sst:option> </sst:select>
outputs
<select id="snmpVersion" onchange="versionChange()"> <option value="0" selected="selected">1</option> <option value="1">2c</option> <option value="3">3</option> </select>
-
Hi Craig,
-
This would be a complicated change since the import doesn't have a "warning" mechanism, and i wouldn't be comfortable letting such a case pass without a notification to the user.
-
Multistate points can't have High/Low limit detectors. Check out PointEventDetectorVO in the method getImplementations for the detectors that support multistate points.
-
I can't comment too much on code i can't see, but yes, you should be exporting points using the XID. This is because you cannot be guaranteed on import that you will be able to get the same id on insert, or that existing points will have the same id.
-
Good catch. The code has been changed as follows:
if (snmpVersion != SnmpConstants.version1 && snmpVersion != SnmpConstants.version2c && snmpVersion != SnmpConstants.version3) response.addContextualMessage("snmpVersion", "validate.invalidValue");
-
-
@mlohbihler said:
- Multistate points can't have High/Low limit detectors. Check out PointEventDetectorVO in the method getImplementations for the detectors that support multistate points.
The point in question is a multistate point on a virtual data source. Here is the point as represented by the export data:
{ "enabled":true, "intervalLoggingPeriod":15, "loggingType":"ON_CHANGE", "purgePeriod":1, "xid":"DP_728959", "textRenderer":{ "multistateValues":[ { "colour":null, "text":"increasing row selector", "key":1 }, { "colour":null, "text":"expecting new row", "key":2 }, { "colour":null, "text":"new row read", "key":3 } ], "type":"MULTISTATE" }, "defaultCacheSize":1, "dataSourceXid":"DS_257956", "pointLocator":{ "changeType":{ "startValue":"0", "type":"NO_CHANGE" }, "dataType":"MULTISTATE", "settable":true }, "chartRenderer":{ "limit":50, "type":"TABLE" }, "eventDetectors":[ { "duration":1, "alias":"increasing row selector", "alarmLevel":"NONE", "state":1, "xid":"PED_175363", "durationType":"SECONDS", "type":"HIGH_LIMIT" }, { "duration":1, "alias":"expecting new row", "alarmLevel":"NONE", "state":2, "xid":"PED_997600", "durationType":"SECONDS", "type":"HIGH_LIMIT" }, { "duration":1, "alias":"new row read", "alarmLevel":"NONE", "state":3, "xid":"PED_986113", "durationType":"SECONDS", "type":"HIGH_LIMIT" } ], "name":"data table state", "tolerance":0.0, "intervalLoggingType":"INSTANT", "intervalLoggingPeriodType":"MINUTES", "purgeType":"YEARS" }
And the error I was getting on the multistate point was "point event detector must have a 'limit'", but in the export data above it has a state and is of type HIGH_LIMIT.
So maybe the problem is in PointEventDetectorVO.java:
private static final ExportCodes TYPE_CODES = new ExportCodes(); static { TYPE_CODES.addElement(TYPE_ANALOG_HIGH_LIMIT, "HIGH_LIMIT"); TYPE_CODES.addElement(TYPE_ANALOG_LOW_LIMIT, "LOW_LIMIT"); TYPE_CODES.addElement(TYPE_BINARY_STATE, "BINARY_STATE"); TYPE_CODES.addElement(TYPE_MULTISTATE_STATE, "HIGH_LIMIT"); TYPE_CODES.addElement(TYPE_POINT_CHANGE, "POINT_CHANGE"); TYPE_CODES.addElement(TYPE_STATE_CHANGE_COUNT, "STATE_CHANGE_COUNT"); TYPE_CODES.addElement(TYPE_NO_CHANGE, "NO_CHANGE"); TYPE_CODES.addElement(TYPE_NO_UPDATE, "NO_UPDATE"); TYPE_CODES.addElement(TYPE_ALPHANUMERIC_STATE, "ALPHANUMERIC_STATE"); TYPE_CODES.addElement(TYPE_POSITIVE_CUSUM, "POSITIVE_CUSUM"); TYPE_CODES.addElement(TYPE_NEGATIVE_CUSUM, "NEGATIVE_CUSUM"); }
maybe
TYPE_CODES.addElement(TYPE_MULTISTATE_STATE, "HIGH_LIMIT");
should be
TYPE_CODES.addElement(TYPE_MULTISTATE_STATE, "MULTISTATE_STATE");or anything other than "HIGH_LIMIT" so it has a different value than TYPE_ANALOG_HIGH_LIMIT?
-
Yes, you're correct. I've changed the code accordingly. Thanks for pointing this out.
-
As per #3. above I was missing code to translate the list of integer data point id to a list of String xid in the point locator jsonSerialize method. I borrowed from metapointlocatorVo and now 1. is no longer an issue since we've taken care of 2,3, and 4.
-
Sweet. Thanks for the update.