Add ability to load text products in the text workstation

-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)
-Brought back logic that looks at the site level for the DefaultSiteAlarms.xml if it doesn't exist at the workstation level
-Copy DefaultSiteAlarms.xml to the site level during rpm install (awips2-localization rpm)
This commit is contained in:
ucar-tmeyer 2023-09-13 18:11:03 +00:00
parent 27ad6ec134
commit 9b881145a7
3 changed files with 42 additions and 15 deletions

View file

@ -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
*
*
* </pre>
@ -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;
}

View file

@ -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)
*
* </pre>
*
@ -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<AFOSProductId> 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();
}
}

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<aapaCombined/>