Omaha #5723 - Add safety check to IFPClient.saveReferenceData.

Change-Id: I245b97dc52d2252203ea465f930a0a2167e959e4
This commit is contained in:
David Gillingham 2016-06-30 13:27:29 -05:00 committed by Michael James
parent 361e05a3f7
commit 5189ac5297
3 changed files with 16 additions and 8 deletions

View file

@ -116,6 +116,8 @@ import com.vividsolutions.jts.geom.Envelope;
* Nov 18, 2015 5129 dgilling Use new IFPClient for get/save/delete
* of reference data.
* Dec 14, 2015 4816 dgilling Support refactored PythonJobCoordinator API.
* Jun 30, 2016 #5723 dgilling Move safety check from saveRefSet to
* IFPClient.saveReferenceData.
*
* </pre>
*
@ -835,13 +837,6 @@ public class ReferenceSetManager implements IReferenceSetManager,
"SaveRefSet id=" + orefData.getId());
ReferenceData refData = new ReferenceData(orefData);
if (!refData.isQuery()) {
refData.getPolygons(CoordinateType.LATLON);
} else {
refData.setPolygons(null, CoordinateType.LATLON);
}
ServerResponse<?> sr = dataManager.getClient().saveReferenceData(
Arrays.asList(refData));
if (!sr.isOkay()) {

View file

@ -13,6 +13,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin.gfe;bundle-version="1.15.0",
com.raytheon.uf.common.site;bundle-version="1.14.0",
com.raytheon.uf.common.status;bundle-version="1.15.0",
com.raytheon.uf.common.serialization;bundle-version="1.15.1",
com.raytheon.uf.common.time;bundle-version="1.15.0"
com.raytheon.uf.common.time;bundle-version="1.15.0",
org.geotools;bundle-version="10.5.0"
Export-Package: com.raytheon.uf.common.gfe.ifpclient,
com.raytheon.uf.common.gfe.ifpclient.exception

View file

@ -37,6 +37,7 @@ import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteDefinition;
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteKey;
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData;
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData.CoordinateType;
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceID;
import com.raytheon.uf.common.dataplugin.gfe.request.AbstractGfeRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.CommitGridsRequest;
@ -122,6 +123,7 @@ import com.raytheon.uf.common.time.TimeRange;
* Feb 05, 2016 #5242 dgilling Replace calls to deprecated Localization APIs.
* Feb 24, 2016 #5129 dgilling Change how PyFPClient is constructed.
* Apr 28, 2016 #5618 randerso Fix getGridData to handle "chunked" response.
* Jun 30, 2016 #5723 dgilling Add safety check to saveReferenceData.
*
* </pre>
*
@ -691,6 +693,16 @@ public class IFPClient {
LocalizationContext ctx = pm.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.USER);
for (ReferenceData refData : referenceData) {
/*
* A safety check to ensure our XML-format ReferenceData has only
* either the polygons or query field populated.
*/
if (!refData.isQuery()) {
refData.getPolygons(CoordinateType.LATLON);
} else {
refData.setPolygons(null, CoordinateType.LATLON);
}
ILocalizationFile lf = pm.getLocalizationFile(ctx, EDIT_AREAS_DIR
+ IPathManager.SEPARATOR + refData.getId().getName()
+ ".xml");