From 7d3f479031643aea5292bdda688900c4cc7e9ca4 Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Mon, 12 Nov 2012 15:14:40 -0600 Subject: [PATCH] Issue #1108 make ZAGL level deprecated since it is in use in derived parameters, modify derived parameters to handle deprecated master levels. Former-commit-id: 2242eefb25cd65edb4378b47b9cafbcab8510c53 --- .../META-INF/MANIFEST.MF | 5 ++-- .../derivedParameters/definitions/Tstk.xml | 2 +- .../derivedParameters/definitions/Twstk.xml | 2 +- .../library/ValidLevelGenerator.java | 22 ++++++++++++++++-- .../base/level/alias/deprecated.xml | 23 +++++++++++++++++++ 5 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.level/utility/common_static/base/level/alias/deprecated.xml diff --git a/cave/com.raytheon.uf.viz.derivparam/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.derivparam/META-INF/MANIFEST.MF index 312116ae84..20faa2eb66 100644 --- a/cave/com.raytheon.uf.viz.derivparam/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.derivparam/META-INF/MANIFEST.MF @@ -9,13 +9,14 @@ Require-Bundle: org.eclipse.core.runtime, javax.measure, com.raytheon.uf.viz.core;bundle-version="1.12.1174", com.raytheon.uf.common.datastorage;bundle-version="1.12.1174", - com.raytheon.uf.common.pointdata;bundle-version="1.12.1174" + com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", + com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", + com.raytheon.uf.common.util;bundle-version="1.12.1174" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Import-Package: com.raytheon.uf.common.comm, com.raytheon.uf.common.dataplugin, - com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.derivparam.tree, com.raytheon.uf.common.geospatial, com.raytheon.uf.common.localization, diff --git a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Tstk.xml b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Tstk.xml index e8e1e04ac2..6b5e4375b1 100644 --- a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Tstk.xml +++ b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Tstk.xml @@ -31,7 +31,7 @@ - + diff --git a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Twstk.xml b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Twstk.xml index d3466d4dd0..468e3a403d 100644 --- a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Twstk.xml +++ b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Twstk.xml @@ -27,7 +27,7 @@ - + diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/ValidLevelGenerator.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/ValidLevelGenerator.java index 2e7888f7a6..9a394f5b83 100644 --- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/ValidLevelGenerator.java +++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/ValidLevelGenerator.java @@ -33,6 +33,9 @@ import com.raytheon.uf.common.dataplugin.level.CompareType; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.LevelFactory; import com.raytheon.uf.common.dataplugin.level.MasterLevel; +import com.raytheon.uf.common.dataplugin.level.mapping.LevelMapper; +import com.raytheon.uf.common.util.mapping.Mapper; +import com.raytheon.uf.common.util.mapping.MultipleMappingException; import com.raytheon.uf.viz.core.exception.VizCommunicationException; import com.raytheon.uf.viz.core.level.LevelMapping; import com.raytheon.uf.viz.core.level.LevelMappingFactory; @@ -62,6 +65,8 @@ public class ValidLevelGenerator { private LevelFactory lf; + private LevelMapper lm; + private Map> masterLevels; private Set validLevels; @@ -71,6 +76,7 @@ public class ValidLevelGenerator { public ValidLevelGenerator() { lmf = LevelMappingFactory.getInstance(); lf = LevelFactory.getInstance(); + lm = LevelMapper.getInstance(); } public Set generateLevels(String validLevelsString) @@ -78,7 +84,6 @@ public class ValidLevelGenerator { masterLevels = new HashMap>(); validLevels = new HashSet(); masterLevelsHandled = new HashSet(); - if (validLevelsString != null && validLevelsString.length() > 0) { String[] levelTokenArray = validLevelsString.split(","); List tokensToProcess = new ArrayList( @@ -291,7 +296,13 @@ public class ValidLevelGenerator { } case MasterLevel: { MasterLevel ml = lf.getMasterLevel(token); - + if (ml == null) { + try { + ml = lm.lookupMasterLevel(token, Mapper.DEPRECATED); + } catch (MultipleMappingException e) { + ml = lf.getMasterLevel(e.getArbitraryMapping()); + } + } if (negate) { for (Entry> entry : masterLevels .entrySet()) { @@ -340,6 +351,13 @@ public class ValidLevelGenerator { } else { // plane was not a group, see if it is a master level MasterLevel ml = lf.getMasterLevel(token); + if (ml == null) { + try { + ml = lm.lookupMasterLevel(token, Mapper.DEPRECATED); + } catch (MultipleMappingException e) { + ml = lf.getMasterLevel(e.getArbitraryMapping()); + } + } if (ml != null) { rval = Type.MasterLevel; } else { diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.level/utility/common_static/base/level/alias/deprecated.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.level/utility/common_static/base/level/alias/deprecated.xml new file mode 100644 index 0000000000..0e1b02deff --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.level/utility/common_static/base/level/alias/deprecated.xml @@ -0,0 +1,23 @@ + + + + ZAGL + \ No newline at end of file