diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/util/AlarmAlertFunctions.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/util/AlarmAlertFunctions.java index e00d996f92..c76b39f04c 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/util/AlarmAlertFunctions.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/util/AlarmAlertFunctions.java @@ -90,6 +90,9 @@ import org.locationtech.jts.geom.GeometryFactory; * code cleanup * 07/05/2016 19153 mgamazaychikov Fix disappearance of AlarmAlert Bell after initial close * Jan 24, 2018 7132 tgurney Add destroyAlarmAlertBell() + * Sep 13, 2023 tiffanym@ucar Brought back logic that looks at the site level for the + * DefaultSiteAlarms.xml if it doesn't exist at the workstation + * level * * * @@ -667,21 +670,44 @@ public class AlarmAlertFunctions { } /* - * Try to load the site file. + * Try to load the workstation file. If there is no workstation file then + * try to load the site file and create a new workstation file from it. If + * there is no site file, then create a new default workstation file. */ - public static AAPACombined loadSiteAlarms(ILocalizationFileObserver listener) { + public static AAPACombined loadSiteAlarms( + ILocalizationFileObserver listener) { + LocalizationFile workstationFile = getFile( + initLocalization(LocalizationLevel.SITE), SITE_FILE); AAPACombined aapaCombined = null; - LocalizationFile siteFile = getFile(initSiteLocalization(), SITE_FILE); - if (siteFile == null) { - aapaCombined = createDefaultAAPACombined(); + if (workstationFile == null || !workstationFile.exists()) { + // no workstation file found. try the site file + LocalizationFile siteFile = getFile(initSiteLocalization(), + SITE_FILE); + if (siteFile == null) { + aapaCombined = createDefaultAAPACombined(); + } else { + try { + aapaCombined = loadFile(siteFile.getFile()); + } catch (FileNotFoundException e) { + aapaCombined = createDefaultAAPACombined(); + } + } + // save work file + if (workstationFile != null) { + saveAlarms(aapaCombined, workstationFile); + } + } else { try { - aapaCombined = loadFile(siteFile.getFile()); + aapaCombined = loadFile(workstationFile.getFile()); } catch (FileNotFoundException e) { aapaCombined = createDefaultAAPACombined(); } } + if (workstationFile != null) { + workstationFile.addFileUpdatedObserver(listener); + } return aapaCombined; } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java b/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java index e21423877f..0dcbb52215 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java @@ -126,6 +126,10 @@ import com.raytheon.uf.edex.plugin.text.impl.TextDBStaticData; * Nov 09, 2021 22859 zalberts Added additional sort by datacrc to * AFOS_QUERY_STMT for consistent results * when reftime and inserttime are equal. + * Sep 13, 2023 tiffanym@@ucar Force text workstation requests to look at the + * operational stdtextproducts db table instead + * of practicestdtxtproducts db table when CAVE + * is running in practice mode (Unidata default) * * * @@ -237,10 +241,8 @@ public class StdTextProductDao extends CoreDao { * true for operational table, false for practice table */ public StdTextProductDao(boolean operationalModeFlag) { - super(DaoConfig.forClass("fxa", - (operationalModeFlag ? OperationalStdTextProduct.class - : PracticeStdTextProduct.class))); - this.operationalMode = operationalModeFlag; + super(DaoConfig.forClass("fxa", OperationalStdTextProduct.class)); + this.operationalMode = true; } /** @@ -1073,9 +1075,7 @@ public class StdTextProductDao extends CoreDao { public List doInTransaction( TransactionStatus status) { Session sess = getCurrentSession(); - Criteria crit = sess.createCriteria(operationalMode - ? OperationalStdTextProduct.class - : PracticeStdTextProduct.class); + Criteria crit = sess.createCriteria(OperationalStdTextProduct.class); ProjectionList fields = Projections.projectionList(); fields.add(Projections.property(CCC_ID)); fields.add(Projections.property(ProdNNN_ID)); @@ -1598,7 +1598,6 @@ public class StdTextProductDao extends CoreDao { * @return StdTextProduct, an */ private StdTextProduct getStdTextProductInstance() { - return this.operationalMode ? new OperationalStdTextProduct() - : new PracticeStdTextProduct(); + return new OperationalStdTextProduct(); } } diff --git a/localization/utility/common_static/site/OAX/alarms/DefaultSiteAlarms.xml b/localization/utility/common_static/site/OAX/alarms/DefaultSiteAlarms.xml new file mode 100644 index 0000000000..38e0906aa9 --- /dev/null +++ b/localization/utility/common_static/site/OAX/alarms/DefaultSiteAlarms.xml @@ -0,0 +1,2 @@ + +