From 81b914ad9f829876644636106b3cb7933fd70335 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Wed, 7 May 2014 15:30:13 -0500 Subject: [PATCH] Issue #2060 fix grid updates and performance Change-Id: I0937d7360e456f08fb613be547f7b488ebe05b50 Former-commit-id: c71edb2d4ca98aff99c9d59a6f8cfdea5e7b3831 [formerly e39378e5f0c8c6e75eed3037f933a30ed75092ba] [formerly acfbce58d1fea02490c25e7154c6d9aa27db9fe8 [formerly a430e85f283b3e41b8520d241f675eff3c6c32e3]] Former-commit-id: acfbce58d1fea02490c25e7154c6d9aa27db9fe8 Former-commit-id: 5099fd6463797cae374e379fe426ab46ac36ef57 --- .../dataplugin/grid/GridInfoRecord.java | 3 +- .../uf/common/dataplugin/grid/GridRecord.java | 10 ++++ .../uf/common/parameter/Parameter.java | 2 + .../common/parameter/ParameterConverter.java | 59 ------------------- 4 files changed, 13 insertions(+), 61 deletions(-) delete mode 100644 edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java index 1ed01e29bb..7a40edd823 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridInfoRecord.java @@ -36,7 +36,6 @@ import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.gridcoverage.GridCoverage; import com.raytheon.uf.common.gridcoverage.convert.GridCoverageConverter; import com.raytheon.uf.common.parameter.Parameter; -import com.raytheon.uf.common.parameter.ParameterConverter; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @@ -107,7 +106,7 @@ public class GridInfoRecord extends PersistableDataObject { @ManyToOne @PrimaryKeyJoinColumn - @DataURI(position = 4, converter = ParameterConverter.class) + @DataURI(position = 4, embedded = true) @DynamicSerializeElement private Parameter parameter; diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java index eed4f41d18..807e7fa89e 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grid/src/com/raytheon/uf/common/dataplugin/grid/GridRecord.java @@ -41,6 +41,7 @@ import com.raytheon.uf.common.geospatial.ISpatialEnabled; import com.raytheon.uf.common.geospatial.ISpatialObject; import com.raytheon.uf.common.gridcoverage.GridCoverage; import com.raytheon.uf.common.parameter.Parameter; +import com.raytheon.uf.common.parameter.lookup.ParameterLookup; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @@ -66,6 +67,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Dec 16, 2013 2574 bsteffen Remove getDecoderGettable. * Apr 15, 2014 2060 njensen Remove dataURI column + * May 07, 2014 2060 njensen GridRecord(String) will do parameter lookup * * * @@ -117,6 +119,14 @@ public class GridRecord extends PersistablePluginDataObject implements public GridRecord(String uri) { super(uri); + String abbrev = this.getInfo().getParameter().getAbbreviation(); + if (abbrev != null) { + Parameter paramWithUnits = ParameterLookup.getInstance() + .getParameter(abbrev); + if (paramWithUnits != null) { + this.getInfo().setParameter(paramWithUnits); + } + } } public GridInfoRecord getInfo() { diff --git a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java index 6479a8a49b..b7ecd7d3bb 100644 --- a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java +++ b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/Parameter.java @@ -34,6 +34,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; @@ -70,6 +71,7 @@ public class Parameter extends PersistableDataObject implements @Id @DynamicSerializeElement @XmlElement + @DataURI(position = 0) private String abbreviation; @Column(nullable = false) diff --git a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java b/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java deleted file mode 100644 index 7ebeab9c80..0000000000 --- a/edexOsgi/com.raytheon.uf.common.parameter/src/com/raytheon/uf/common/parameter/ParameterConverter.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.common.parameter; - -import com.raytheon.uf.common.dataplugin.annotations.DataURIFieldConverter; -import com.raytheon.uf.common.parameter.lookup.ParameterLookup; - -/** - * A DataURIFieldConverter that ensures that a String parameter abbreviation - * will be looked up to potentially contain all the fields. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * May 6, 2014  2060       njensen     Initial creation
- * 
- * 
- * - * @author njensen - * @version 1.0 - */ - -public class ParameterConverter implements DataURIFieldConverter { - - @Override - public String toString(Parameter field) { - return field.getAbbreviation(); - } - - @Override - public Parameter fromString(String string) { - Parameter p = ParameterLookup.getInstance().getParameter(string); - if (p == null) { - p = new Parameter(string); - } - return p; - } - -}