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 051d55a573..fd9f70a287 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.toLowerCase()); 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; + } } 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 ) ;