From ff7250b0977120060aab382e7f5a5cf41541fe1c Mon Sep 17 00:00:00 2001 From: Chip Gobs Date: Wed, 4 Feb 2015 14:15:14 -0500 Subject: [PATCH 1/2] VLab Issue #6312 - RM 17094 - MPE - mapx_field_type too long for RWResult table; fixes #6312 Change-Id: I320c052a7d7a1579a668935e848aa378874c3ad5 Former-commit-id: 8e8e6cf1ce5cdb903ac608058d2847125da3dddb [formerly 2da6f9022d5f04b2eb0b81034b3c11006f59412e [formerly 9f66b0830de2377da2dc3e5598d264afc631b517]] Former-commit-id: 2da6f9022d5f04b2eb0b81034b3c11006f59412e Former-commit-id: bf4f6be9c09386b9e0fb3be72e748e47205bb7f2 --- .../viz/mpe/ui/actions/SaveBestEstimate.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveBestEstimate.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveBestEstimate.java index 4b94128770..24d650f837 100644 --- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveBestEstimate.java +++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveBestEstimate.java @@ -23,6 +23,7 @@ * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 7, 2015 16954 cgobs Fix for cv_use issue - using getFieldName() in certain parts. + * Feb 4, 2015 17094 cgobs Fix for fieldType being too long for mapx_field_type column in RWResult table. * **/ package com.raytheon.viz.mpe.ui.actions; @@ -33,8 +34,10 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import javax.imageio.ImageIO; import javax.imageio.ImageWriter; @@ -337,6 +340,9 @@ public class SaveBestEstimate { Rwresult pRWResultNode = pRWResultHead.get(0); /* Update the elements in the RWResult node. */ + + fldtype = checkAndModifyMapxFieldType(fldtype); + pRWResultNode.setMapxFieldType(fldtype); pRWResultNode.setAutoSave(asave); pRWResultNode.setDrawPrecip(drpr); @@ -359,4 +365,32 @@ public class SaveBestEstimate { } } + + private static String checkAndModifyMapxFieldType(String fieldType) { + + // This method changes fieldType to lowercase. + // It also shortens fieldTypes as needed to fit into the mapx_field_type column in the RWResult table. + // Note: the mapx_field_type column is informational only. It is not used by the code + // other than reading and writing from and to the database. + + String newFieldType = null; + String lowerCaseFieldType = fieldType.toLowerCase(); + + final Map conversionTable = new HashMap(); + + conversionTable.put("localfield1", "localfld1"); + conversionTable.put("localfield2", "localfld2"); + conversionTable.put("localfield3", "localfld3"); + + conversionTable.put("avgrdmosaic", "avgrdmos"); + conversionTable.put("maxrdmosaic", "maxrdmos"); + + + newFieldType = conversionTable.get(lowerCaseFieldType); + if (newFieldType == null) + { + newFieldType = lowerCaseFieldType; + } + return newFieldType; + } } From d70f3628bf64e4db70a058e7269a9778889cc28d Mon Sep 17 00:00:00 2001 From: Chip Gobs Date: Wed, 4 Feb 2015 14:27:26 -0500 Subject: [PATCH 2/2] VLab Issue #6313 - RM 17069 - MPE mpe_generate_list token length too short; fixes #6313 Change-Id: I198f6016f10cdaf6c105c89bd7a4c9e445b9a98b Former-commit-id: ca7afdcf6cd76366f3c80e28e0cca634c663aee2 [formerly c60c8ed57174b87eaa403725319e5a18576db21b [formerly 919269c680602c639de54811dd1a65d4aa67fdad]] Former-commit-id: c60c8ed57174b87eaa403725319e5a18576db21b Former-commit-id: cdf7c63ce1d48c77f16c4fafd274b17e89ee8b69 --- .../src/MPEUtil/TEXT/get_mpe_product_state.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nativeLib/rary.ohd.pproc/src/MPEUtil/TEXT/get_mpe_product_state.c b/nativeLib/rary.ohd.pproc/src/MPEUtil/TEXT/get_mpe_product_state.c index bb67230ab0..2e82710bcd 100644 --- a/nativeLib/rary.ohd.pproc/src/MPEUtil/TEXT/get_mpe_product_state.c +++ b/nativeLib/rary.ohd.pproc/src/MPEUtil/TEXT/get_mpe_product_state.c @@ -30,6 +30,7 @@ * new local fields to * mpe_qpe_fields and * mpe_qpe_dependencies +* 2/4/2015 C Gobs DR 17069 - mpe_generate_list - token value too short ******************************************************************************** */ #include @@ -130,6 +131,7 @@ const static char * mpe_qpe_dependencies [ NUM_BEST_PRODUCTS ] = /* GageOnly Generation rule in case mpe_del_gage_zeros token is OFF. */ const static char * gageonly_del_gages_off = "" ; +#define MPE_GENERATE_LIST_REPLY_LEN 512 /******************************************************************************* * MODULE NUMBER: 1 @@ -514,7 +516,7 @@ void get_mpe_product_state ( const char * product , const int * product_len , char mpe_del_gage_zeros_reply [ MPE_PRODUCT_REPLY_LEN ] = { '\0' } ; char mpe_generate_areal_qpe_reply [ MPE_PRODUCT_REPLY_LEN ] = {'\0'}; static char * mpe_generate_list_token = MPE_GENERATE_LIST_TOKEN ; - char mpe_generate_list_reply [ MPE_PRODUCT_REPLY_LEN ] = { '\0' } ; + char mpe_generate_list_reply [ MPE_GENERATE_LIST_REPLY_LEN ] = { '\0' } ; static char mpe_qpe_fieldtype [ BESTFIELD_LEN] = { '\0' } ; char * pChar = NULL ; char * pString = NULL ; @@ -598,9 +600,10 @@ void get_mpe_product_state ( const char * product , const int * product_len , "empty.\n" , mpe_generate_list_token ) ; } - memset ( mpe_generate_list_reply , '\0' , MPE_PRODUCT_REPLY_LEN ) ; + memset ( mpe_generate_list_reply , '\0' , MPE_GENERATE_LIST_REPLY_LEN ) ; } - printf("get_mpe_product_state(): mpe_generate_list_reply = :%s: \n", mpe_generate_list_reply); + printf("get_mpe_product_state(): mpe_generate_list_reply = :%s: characters in mpe_generate_list_reply = %d max = %d\n", mpe_generate_list_reply, + strlen(mpe_generate_list_reply), MPE_GENERATE_LIST_REPLY_LEN); /* Get the value of the mpe_del_gage_zeros token. */ request_len = strlen ( mpe_del_gage_zeros_token ) ;