Issue #1504 GFE: Model data not always appearing automatically without CAVE restart

Change-Id: I1e52c111ec50a860a226d85bed6f0ab6dfebed58

Former-commit-id: 62671efc2a [formerly 1fe63a2d5e20226f6124a9ca27b9f6272c49226c]
Former-commit-id: 20b0761048
This commit is contained in:
Ron Anderson 2013-01-21 16:53:47 -06:00
parent 1057580201
commit 44807ba0d5
11 changed files with 273 additions and 323 deletions

View file

@ -73,6 +73,7 @@ import com.raytheon.viz.gfe.core.griddata.IGridData;
* to use IFPClient * to use IFPClient
* 02/23/12 #346 dgilling Implement a dispose method. * 02/23/12 #346 dgilling Implement a dispose method.
* 03/01/12 #346 dgilling Re-order dispose method. * 03/01/12 #346 dgilling Re-order dispose method.
* 01/21/12 #1504 randerso Cleaned up old debug logging to improve performance
* *
* </pre> * </pre>
* *
@ -411,6 +412,7 @@ public class DbParm extends Parm {
// normal mode // normal mode
if (normal) { if (normal) {
Arrays.sort(grids); Arrays.sort(grids);
// Now replace the existing grids with the new ones // Now replace the existing grids with the new ones
replaceGrids(affectedTimeRange, grids); replaceGrids(affectedTimeRange, grids);
@ -757,10 +759,10 @@ public class DbParm extends Parm {
List<LockRequest> lreq = new ArrayList<LockRequest>(timesToSave.size()); List<LockRequest> lreq = new ArrayList<LockRequest>(timesToSave.size());
for (int i = 0; i < timesToSave.size(); i++) { for (int i = 0; i < timesToSave.size(); i++) {
String msg = "Reverting " + getParmID() + " tr=" // String msg = "Reverting " + getParmID() + " tr="
+ timesToSave.get(i); // + timesToSave.get(i);
statusHandler.handle(Priority.DEBUG, msg, new Exception("Debug: " // statusHandler.handle(Priority.DEBUG, msg, new Exception("Debug: "
+ msg)); // + msg));
boolean success = true; boolean success = true;
IGridData[] grids = null; IGridData[] grids = null;

View file

@ -97,24 +97,6 @@ class ParmID(JUtil.JavaWrapperClass):
def getParmId(self): def getParmId(self):
return self.__pid.getParmId() return self.__pid.getParmId()
def setParmName(self, parmName):
self.__pid.setParmName(parmName)
def setParmLevel(self, parmLevel):
self.__pid.setParmLevel(parmLevel)
def setDbId(self, dbId):
self.__pid.setDbId(dbId.toJavaObj())
def setCompositeName(self, compositeName):
self.__pid.setCompositeName(compositeName)
def setShortParmId(self, shortParmId):
self.__pid.setShortParmId(shortParmId)
def setParmId(self, parmId):
self.__pid.setParmId(parmId)
@staticmethod @staticmethod
def shortSerializer(parmID): def shortSerializer(parmID):
return JavaParmID.shortSerializer(parmID.javaParmId()) return JavaParmID.shortSerializer(parmID.javaParmId())

View file

@ -108,7 +108,7 @@
<route id="gfeVtecChangeNotification"> <route id="gfeVtecChangeNotification">
<from uri="jms-generic:topic:edex.alerts.vtec"/> <from uri="jms-generic:topic:edex.alerts.vtec"/>
<doTry> <doTry>
<bean ref="serializationUtil" method="transformFromThrift" /> <bean ref="serializationUtil" method="transformFromThrift" />
<bean ref="vtecChangeListener" method="handleNotification" /> <bean ref="vtecChangeListener" method="handleNotification" />
<doCatch> <doCatch>
<exception>java.lang.Throwable</exception> <exception>java.lang.Throwable</exception>
@ -130,7 +130,7 @@
</doTry> </doTry>
</route> </route>
</camelContext> </camelContext>
<!-- Beans to define a custom jms connection which will allow a durable subscription --> <!-- Beans to define a custom jms connection which will allow a durable subscription -->
<bean id="gfeNotifyConnectionFactory" class="org.apache.qpid.client.AMQConnectionFactory"> <bean id="gfeNotifyConnectionFactory" class="org.apache.qpid.client.AMQConnectionFactory">
<constructor-arg type="java.lang.String" value="amqp://guest:guest@gfeNotify/edex?brokerlist='tcp://${broker.addr}?retries='9999'&amp;connecttimeout='5000'&amp;connectdelay='5000''&amp;maxprefetch='0'&amp;sync_publish='all'&amp;sync_ack='true'"/> <constructor-arg type="java.lang.String" value="amqp://guest:guest@gfeNotify/edex?brokerlist='tcp://${broker.addr}?retries='9999'&amp;connecttimeout='5000'&amp;connectdelay='5000''&amp;maxprefetch='0'&amp;sync_publish='all'&amp;sync_ack='true'"/>

View file

@ -21,6 +21,7 @@
package com.raytheon.edex.plugin.gfe.cache.d2dparms; package com.raytheon.edex.plugin.gfe.cache.d2dparms;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -40,15 +41,18 @@ import com.raytheon.edex.plugin.gfe.server.database.D2DGridDatabase;
import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabase; import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabase;
import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabaseManager; import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabaseManager;
import com.raytheon.edex.plugin.gfe.server.database.GridDatabase; import com.raytheon.edex.plugin.gfe.server.database.GridDatabase;
import com.raytheon.edex.plugin.gfe.util.SendNotifications;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException; import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
import com.raytheon.uf.common.parameter.mapping.ParameterMapper; import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotification;
import com.raytheon.uf.common.message.WsId;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.mapping.MultipleMappingException; import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.site.SiteAwareRegistry; import com.raytheon.uf.edex.site.SiteAwareRegistry;
@ -62,6 +66,10 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry;
* 01/08/09 1674 bphillip Initial creation * 01/08/09 1674 bphillip Initial creation
* 11/05/12 #1310 dgilling Modify cache to listen to plugin * 11/05/12 #1310 dgilling Modify cache to listen to plugin
* purged topic. * purged topic.
* 01/18/13 #1504 randerso Moved D2D to GFE parameter name translation from
* D2DParmIdCache toGfeIngestNotificationFilter.
* Added code to match wind components and send
* GridUpdateNotifications.
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -77,8 +85,19 @@ public class D2DParmIdCache {
private static final Pattern RangeFilter = Pattern private static final Pattern RangeFilter = Pattern
.compile("(.*?)\\d{1,2}hr"); .compile("(.*?)\\d{1,2}hr");
private static final Map<String, String> WIND_COMP_PARMS;
static {
WIND_COMP_PARMS = new HashMap<String, String>();
WIND_COMP_PARMS.put("uw", "vw");
WIND_COMP_PARMS.put("vw", "uw");
WIND_COMP_PARMS.put("ws", "wd");
WIND_COMP_PARMS.put("wd", "ws");
}
/** Map containing the ParmIDs */ /** Map containing the ParmIDs */
private Map<String, Set<String>> parmIds; private Map<DatabaseID, Set<ParmID>> parmIds;
private Map<ParmID, Set<TimeRange>> windComps;
private static D2DParmIdCache instance; private static D2DParmIdCache instance;
@ -93,7 +112,8 @@ public class D2DParmIdCache {
* Constructs a new D2DParmIdCache * Constructs a new D2DParmIdCache
*/ */
public D2DParmIdCache() { public D2DParmIdCache() {
parmIds = new HashMap<String, Set<String>>(); parmIds = new HashMap<DatabaseID, Set<ParmID>>();
windComps = new HashMap<ParmID, Set<TimeRange>>();
} }
/** /**
@ -140,53 +160,18 @@ public class D2DParmIdCache {
} }
private void putParmIDInternal(ParmID parmId) { private void putParmIDInternal(ParmID parmId) {
DatabaseID dbId = parmId.getDbId();
synchronized (parmIds) { synchronized (parmIds) {
Set<ParmID> dbParms = parmIds.get(dbId);
// Add the database entry to the map if it does not exist // Add the database entry to the map if it does not exist
if (!parmIds.containsKey(parmId.getDbId().toString())) { if (dbParms == null) {
parmIds.put(parmId.getDbId().toString(), new HashSet<String>()); dbParms = new HashSet<ParmID>();
parmIds.put(dbId, dbParms);
} }
// Insert the ParmID into the map
String parmStr = parmId.toString();
// Ensure that the staticTopo parameter has the correct
// capitalization, or the smart init scripts will not be able to
// find it
String parmName = parmId.getParmName();
if (parmName.equalsIgnoreCase("staticTopo")) {
parmStr = parmStr.replace("statictopo", "staticTopo");
} else if (parmName.equalsIgnoreCase("staticspacing")) {
parmStr = parmStr.replace("staticspacing", "staticSpacing");
} else if (parmName.equalsIgnoreCase("staticXspacing")) {
parmStr = parmStr.replace("staticxspacing", "staticXspacing");
} else if (parmName.equalsIgnoreCase("staticYspacing")) {
parmStr = parmStr.replace("staticyspacing", "staticYspacing");
} else if (parmName.equalsIgnoreCase("staticCoriolis")) {
parmStr = parmStr.replace("staticcoriolis", "staticCoriolis");
} else {
String gfeParamName = null;
try {
gfeParamName = ParameterMapper.getInstance().lookupAlias(
parmId.getParmName(), "gfeParamName");
} catch (MultipleMappingException e) {
statusHandler.handle(Priority.WARN,
e.getLocalizedMessage(), e);
gfeParamName = e.getArbitraryMapping();
}
parmStr = parmStr.replaceFirst(
parmId.getParmName(),
gfeParamName);
}
parmIds.get(parmId.getDbId().toString()).add(parmStr);
}
}
/** // Insert the ParmID into the map
* Places a parmId into the cache dbParms.add(parmId);
* }
* @param parmId
* String representation of a ParmID
*/
public void putParmID(String parmId) {
putParmID(new ParmID(parmId));
} }
/** /**
@ -209,18 +194,10 @@ public class D2DParmIdCache {
* @return The ParmIDs in the given DatabaseID * @return The ParmIDs in the given DatabaseID
*/ */
public List<ParmID> getParmIDs(DatabaseID dbId) { public List<ParmID> getParmIDs(DatabaseID dbId) {
Set<String> parmStrings = null; List<ParmID> parms = Collections.emptyList();
synchronized (parmIds) { synchronized (parmIds) {
if (parmIds.containsKey(dbId.toString())) { if (parmIds.containsKey(dbId.toString())) {
parmStrings = new HashSet<String>(parmIds.get(dbId.toString())); parms = new ArrayList<ParmID>(parmIds.get(dbId));
}
}
List<ParmID> parms = Collections.emptyList();
if (parmStrings != null) {
parms = new ArrayList<ParmID>(parmStrings.size());
for (String parmStr : parmStrings) {
parms.add(new ParmID(parmStr));
} }
} }
return parms; return parms;
@ -244,14 +221,9 @@ public class D2DParmIdCache {
* @return The list of DatabaseIDs * @return The list of DatabaseIDs
*/ */
public List<DatabaseID> getDatabaseIDs() { public List<DatabaseID> getDatabaseIDs() {
Set<String> dbStrs; List<DatabaseID> dbIds = null;
synchronized (parmIds) { synchronized (parmIds) {
dbStrs = new HashSet<String>(parmIds.keySet()); dbIds = new ArrayList<DatabaseID>(parmIds.keySet());
}
List<DatabaseID> dbIds = new ArrayList<DatabaseID>(dbStrs.size());
for (String dbId : dbStrs) {
dbIds.add(new DatabaseID(dbId));
} }
return dbIds; return dbIds;
} }
@ -382,6 +354,19 @@ public class D2DParmIdCache {
for (DatabaseID dbId : dbsToRemove) { for (DatabaseID dbId : dbsToRemove) {
GridParmManager.removeDbFromMap(dbId); GridParmManager.removeDbFromMap(dbId);
} }
// purge the windComps
List<ParmID> wcToRemove = new ArrayList<ParmID>();
synchronized (windComps) {
for (ParmID id : windComps.keySet()) {
if (dbsToRemove.contains(id.getDbId())) {
wcToRemove.add(id);
}
}
for (ParmID id : wcToRemove) {
windComps.remove(id);
}
}
statusHandler.handle(Priority.EVENTA, statusHandler.handle(Priority.EVENTA,
"Total time to build D2DParmIdCache for " + siteID "Total time to build D2DParmIdCache for " + siteID
+ " took " + (System.currentTimeMillis() - start) + " took " + (System.currentTimeMillis() - start)
@ -397,7 +382,7 @@ public class D2DParmIdCache {
public long getSize() { public long getSize() {
long size = 0; long size = 0;
synchronized (parmIds) { synchronized (parmIds) {
for (Set<String> parms : parmIds.values()) { for (Set<ParmID> parms : parmIds.values()) {
size += parms.size(); size += parms.size();
} }
} }
@ -410,4 +395,63 @@ public class D2DParmIdCache {
buildCache(null); buildCache(null);
} }
} }
public void processGridUpdateNotification(GridUpdateNotification gun) {
ParmID parmId = gun.getParmId();
String otherCompName = WIND_COMP_PARMS.get(parmId.getParmName());
if (otherCompName == null) {
// if it's not a wind component just add it to the cache
putParmID(parmId);
} else {
Set<TimeRange> windTrs = null;
synchronized (windComps) {
// add this parms times to windComps map
Set<TimeRange> trs = windComps.get(parmId);
if (trs == null) {
trs = new HashSet<TimeRange>();
windComps.put(parmId, trs);
}
trs.addAll(gun.getHistories().keySet());
// get the other components times
ParmID otherCompId = new ParmID(otherCompName,
parmId.getDbId(), parmId.getParmLevel());
Set<TimeRange> otherTrs = windComps.get(otherCompId);
// if we have both components
if (otherTrs != null) {
// find times where we have both components
windTrs = new HashSet<TimeRange>(trs);
windTrs.retainAll(otherTrs);
// remove the matching times since we don't need them
// anymore
trs.removeAll(windTrs);
otherTrs.removeAll(windTrs);
}
}
// if we found any matching times for both components
if (windTrs != null && !windTrs.isEmpty()) {
// add the wind parmId to the cache
ParmID windId = new ParmID("wind", parmId.getDbId(),
parmId.getParmLevel());
putParmID(windId);
// create GridUpdateNotifications for the wind parm
Map<TimeRange, List<GridDataHistory>> history = new HashMap<TimeRange, List<GridDataHistory>>();
ArrayList<GridUpdateNotification> guns = new ArrayList<GridUpdateNotification>(
windTrs.size());
for (TimeRange tr : windTrs) {
history.put(tr, Arrays.asList(new GridDataHistory(
GridDataHistory.OriginType.INITIALIZED, windId, tr,
null, (WsId) null)));
guns.add(new GridUpdateNotification(windId, tr, history,
null, windId.getDbId().getSiteId()));
}
SendNotifications.send(guns);
}
}
}
} }

View file

@ -34,7 +34,9 @@ import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotificatio
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 1/10/09 1674 bphillip Initial creation * 1/10/09 1674 bphillip Initial creation
* 10/06/09 3172 njensen Based on grib notification * 10/06/09 3172 njensen Based on grib notification
* 01/18/13 #1504 randerso Changed to send full GridUpdateNotification
* to D2DParmIdCache
* *
* </pre> * </pre>
* *
@ -53,8 +55,8 @@ public class D2DParmIdFilter {
public void updateParmIdCache(List<? extends GfeNotification> notifications) { public void updateParmIdCache(List<? extends GfeNotification> notifications) {
for (GfeNotification notify : notifications) { for (GfeNotification notify : notifications) {
if (notify instanceof GridUpdateNotification) { if (notify instanceof GridUpdateNotification) {
D2DParmIdCache.getInstance().putParmID( D2DParmIdCache.getInstance().processGridUpdateNotification(
((GridUpdateNotification) notify).getParmId()); (GridUpdateNotification) notify);
} }
} }
} }

View file

@ -105,9 +105,11 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* 08/07/09 #2763 njensen Refactored queryByD2DParmId * 08/07/09 #2763 njensen Refactored queryByD2DParmId
* 09/10/12 DR15137 ryu Changed for MOSGuide D2D mxt/mnt grids for consistency * 09/10/12 DR15137 ryu Changed for MOSGuide D2D mxt/mnt grids for consistency
* with A1. * with A1.
* 10/10/12 #1260 randerso Added check to ensure db can be created before * 10/10/12 #1260 randerso Added check to ensure db can be created before
* adding it to the inventory * adding it to the inventory
* 12/06/12 #1394 rjpeter Optimized D2D grid access. * 12/06/12 #1394 rjpeter Optimized D2D grid access.
* 01/21/12 #1504 randerso Back ported change to use ParameterMapper into 13.1.2
*
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -321,13 +323,13 @@ public class GFEDao extends DefaultPluginDao {
} }
if (sess != null) { if (sess != null) {
try { try {
sess.close(); sess.close();
} catch (Exception e) { } catch (Exception e) {
statusHandler.error( statusHandler.error(
"Error occurred closing database session", e); "Error occurred closing database session", e);
}
} }
} }
}
return failedToSave.toArray(new GFERecord[failedToSave.size()]); return failedToSave.toArray(new GFERecord[failedToSave.size()]);
@ -460,9 +462,9 @@ public class GFEDao extends DefaultPluginDao {
dataStore.delete(groupsToDelete); dataStore.delete(groupsToDelete);
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) { if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
statusHandler.handle(Priority.DEBUG, statusHandler.handle(Priority.DEBUG,
"Deleted: " + Arrays.toString(groupsToDelete) "Deleted: " + Arrays.toString(groupsToDelete)
+ " from " + hdf5File.getName()); + " from " + hdf5File.getName());
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle( statusHandler.handle(
@ -657,10 +659,10 @@ public class GFEDao extends DefaultPluginDao {
s = getHibernateTemplate().getSessionFactory().openSession(); s = getHibernateTemplate().getSessionFactory().openSession();
// TODO: clean up so we only make one db query // TODO: clean up so we only make one db query
SortedMap<DataTime, Integer> rawTimes = queryByD2DParmId(id, s); SortedMap<DataTime, Integer> rawTimes = queryByD2DParmId(id, s);
List<TimeRange> gribTimes = new ArrayList<TimeRange>(); List<TimeRange> gribTimes = new ArrayList<TimeRange>();
for (DataTime dt : rawTimes.keySet()) { for (DataTime dt : rawTimes.keySet()) {
gribTimes.add(dt.getValidPeriod()); gribTimes.add(dt.getValidPeriod());
} }
try { try {
if (isMos(id)) { if (isMos(id)) {
@ -670,26 +672,26 @@ public class GFEDao extends DefaultPluginDao {
.getValidPeriod(); .getValidPeriod();
TimeRange time = info.getTimeConstraints() TimeRange time = info.getTimeConstraints()
.constraintTime(gribTime.getEnd()); .constraintTime(gribTime.getEnd());
if (timeRange.getEnd().equals(time.getEnd()) if (timeRange.getEnd().equals(time.getEnd())
|| !info.getTimeConstraints().anyConstraints()) { || !info.getTimeConstraints().anyConstraints()) {
GridRecord retVal = (GridRecord) s.get( GridRecord retVal = (GridRecord) s.get(
GridRecord.class, timeEntry.getValue()); GridRecord.class, timeEntry.getValue());
retVal.setPluginName(GridConstants.GRID); retVal.setPluginName(GridConstants.GRID);
return retVal; return retVal;
} }
} }
} else if (D2DGridDatabase.isNonAccumDuration(id, gribTimes)) { } else if (D2DGridDatabase.isNonAccumDuration(id, gribTimes)) {
for (Map.Entry<DataTime, Integer> timeEntry : rawTimes for (Map.Entry<DataTime, Integer> timeEntry : rawTimes
.entrySet()) { .entrySet()) {
TimeRange gribTime = timeEntry.getKey() TimeRange gribTime = timeEntry.getKey()
.getValidPeriod(); .getValidPeriod();
if (timeRange.getStart().equals(gribTime.getEnd()) if (timeRange.getStart().equals(gribTime.getEnd())
|| timeRange.equals(gribTime)) { || timeRange.equals(gribTime)) {
GridRecord retVal = (GridRecord) s.get( GridRecord retVal = (GridRecord) s.get(
GridRecord.class, timeEntry.getValue()); GridRecord.class, timeEntry.getValue());
retVal.setPluginName(GridConstants.GRID); retVal.setPluginName(GridConstants.GRID);
return retVal; return retVal;
} }
} }
} else { } else {
for (Map.Entry<DataTime, Integer> timeEntry : rawTimes for (Map.Entry<DataTime, Integer> timeEntry : rawTimes
@ -698,15 +700,15 @@ public class GFEDao extends DefaultPluginDao {
.getValidPeriod(); .getValidPeriod();
TimeRange time = info.getTimeConstraints() TimeRange time = info.getTimeConstraints()
.constraintTime(gribTime.getStart()); .constraintTime(gribTime.getStart());
if ((timeRange.getStart().equals(time.getStart()) || !info if ((timeRange.getStart().equals(time.getStart()) || !info
.getTimeConstraints().anyConstraints())) { .getTimeConstraints().anyConstraints())) {
GridRecord retVal = (GridRecord) s.get( GridRecord retVal = (GridRecord) s.get(
GridRecord.class, timeEntry.getValue()); GridRecord.class, timeEntry.getValue());
retVal.setPluginName(GridConstants.GRID); retVal.setPluginName(GridConstants.GRID);
return retVal; return retVal;
}
} }
} }
}
} catch (GfeConfigurationException e) { } catch (GfeConfigurationException e) {
throw new DataAccessLayerException( throw new DataAccessLayerException(
"Error getting configuration for " "Error getting configuration for "
@ -720,7 +722,7 @@ public class GFEDao extends DefaultPluginDao {
statusHandler.error( statusHandler.error(
"Error occurred closing database session", e); "Error occurred closing database session", e);
} }
} }
} }
return null; return null;
@ -743,48 +745,48 @@ public class GFEDao extends DefaultPluginDao {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public SortedMap<DataTime, Integer> queryByD2DParmId(ParmID id, Session s) public SortedMap<DataTime, Integer> queryByD2DParmId(ParmID id, Session s)
throws DataAccessLayerException { throws DataAccessLayerException {
String levelName = GridTranslator.getLevelName(id.getParmLevel()); String levelName = GridTranslator.getLevelName(id.getParmLevel());
double[] levelValues = GridTranslator.getLevelValue(id.getParmLevel()); double[] levelValues = GridTranslator.getLevelValue(id.getParmLevel());
boolean levelOnePresent = (levelValues[0] != Level boolean levelOnePresent = (levelValues[0] != Level
.getInvalidLevelValue()); .getInvalidLevelValue());
boolean levelTwoPresent = (levelValues[1] != Level boolean levelTwoPresent = (levelValues[1] != Level
.getInvalidLevelValue()); .getInvalidLevelValue());
Level level = null; Level level = null;
// to have a level 2, must have a level one // to have a level 2, must have a level one
try { try {
if (levelOnePresent && levelTwoPresent) { if (levelOnePresent && levelTwoPresent) {
level = LevelFactory.getInstance().getLevel(levelName, level = LevelFactory.getInstance().getLevel(levelName,
levelValues[0], levelValues[1]); levelValues[0], levelValues[1]);
} else if (levelOnePresent) { } else if (levelOnePresent) {
level = LevelFactory.getInstance().getLevel(levelName, level = LevelFactory.getInstance().getLevel(levelName,
levelValues[0]); levelValues[0]);
} else { } else {
level = LevelFactory.getInstance().getLevel(levelName, 0.0); level = LevelFactory.getInstance().getLevel(levelName, 0.0);
}
} catch (CommunicationException e) {
logger.error(e.getLocalizedMessage(), e);
} }
} catch (CommunicationException e) { if (level == null) {
logger.error(e.getLocalizedMessage(), e); logger.warn("Unable to query D2D parms, ParmID " + id
} + " does not map to a level");
if (level == null) {
logger.warn("Unable to query D2D parms, ParmID " + id
+ " does not map to a level");
return new TreeMap<DataTime, Integer>(); return new TreeMap<DataTime, Integer>();
} }
SQLQuery modelQuery = s.createSQLQuery(SQL_D2D_GRID_PARM_QUERY); SQLQuery modelQuery = s.createSQLQuery(SQL_D2D_GRID_PARM_QUERY);
modelQuery.setLong("level_id", level.getId()); modelQuery.setLong("level_id", level.getId());
DatabaseID dbId = id.getDbId(); DatabaseID dbId = id.getDbId();
try { try {
IFPServerConfig config = IFPServerConfigManager IFPServerConfig config = IFPServerConfigManager
.getServerConfig(dbId.getSiteId()); .getServerConfig(dbId.getSiteId());
modelQuery.setString(GridInfoConstants.DATASET_ID, modelQuery.setString(GridInfoConstants.DATASET_ID,
config.d2dModelNameMapping(dbId.getModelName())); config.d2dModelNameMapping(dbId.getModelName()));
} catch (GfeConfigurationException e) { } catch (GfeConfigurationException e) {
throw new DataAccessLayerException( throw new DataAccessLayerException(
"Error occurred looking up model name mapping", e); "Error occurred looking up model name mapping", e);
} }
String abbreviation = null; String abbreviation = null;
try { try {
@ -793,38 +795,38 @@ public class GFEDao extends DefaultPluginDao {
} catch (MultipleMappingException e) { } catch (MultipleMappingException e) {
statusHandler.handle(Priority.WARN, e.getLocalizedMessage(), e); statusHandler.handle(Priority.WARN, e.getLocalizedMessage(), e);
abbreviation = e.getArbitraryMapping(); abbreviation = e.getArbitraryMapping();
} }
abbreviation = abbreviation.toLowerCase(); abbreviation = abbreviation.toLowerCase();
modelQuery.setString("abbrev", abbreviation); modelQuery.setString("abbrev", abbreviation);
modelQuery.setString("hourAbbrev", abbreviation + "%hr"); modelQuery.setString("hourAbbrev", abbreviation + "%hr");
List<?> results = modelQuery.list(); List<?> results = modelQuery.list();
Integer modelId = null; Integer modelId = null;
if (results.size() == 0) { if (results.size() == 0) {
return new TreeMap<DataTime, Integer>(); return new TreeMap<DataTime, Integer>();
} else if (results.size() > 1) { } else if (results.size() > 1) {
// hours matched, take hour with least number that matches exact // hours matched, take hour with least number that matches exact
// param // param
Pattern p = Pattern.compile("^" + abbreviation + "(\\d+)hr$"); Pattern p = Pattern.compile("^" + abbreviation + "(\\d+)hr$");
int lowestHr = -1; int lowestHr = -1;
for (Object[] rows : (List<Object[]>) results) { for (Object[] rows : (List<Object[]>) results) {
String param = ((String) rows[0]).toLowerCase(); String param = ((String) rows[0]).toLowerCase();
if (param.equals(abbreviation) && (lowestHr < 0)) { if (param.equals(abbreviation) && (lowestHr < 0)) {
modelId = (Integer) rows[1]; modelId = (Integer) rows[1];
} else { } else {
Matcher matcher = p.matcher(param); Matcher matcher = p.matcher(param);
if (matcher.matches()) { if (matcher.matches()) {
int hr = Integer.parseInt(matcher.group(1)); int hr = Integer.parseInt(matcher.group(1));
if ((lowestHr < 0) || (hr < lowestHr)) { if ((lowestHr < 0) || (hr < lowestHr)) {
modelId = (Integer) rows[1]; modelId = (Integer) rows[1];
lowestHr = hr; lowestHr = hr;
}
} }
} }
} }
} } else {
} else {
modelId = (Integer) ((Object[]) results.get(0))[1]; modelId = (Integer) ((Object[]) results.get(0))[1];
} }
Query timeQuery = s.createQuery(HQL_D2D_GRID_TIME_QUERY); Query timeQuery = s.createQuery(HQL_D2D_GRID_TIME_QUERY);
timeQuery.setInteger("info_id", modelId); timeQuery.setInteger("info_id", modelId);
@ -832,7 +834,7 @@ public class GFEDao extends DefaultPluginDao {
List<Object[]> timeResults = timeQuery.list(); List<Object[]> timeResults = timeQuery.list();
if (timeResults.isEmpty()) { if (timeResults.isEmpty()) {
return new TreeMap<DataTime, Integer>(); return new TreeMap<DataTime, Integer>();
} }
SortedMap<DataTime, Integer> dataTimes = new TreeMap<DataTime, Integer>(); SortedMap<DataTime, Integer> dataTimes = new TreeMap<DataTime, Integer>();
for (Object[] rows : timeResults) { for (Object[] rows : timeResults) {
@ -848,7 +850,7 @@ public class GFEDao extends DefaultPluginDao {
try { try {
s = getHibernateTemplate().getSessionFactory().openSession(); s = getHibernateTemplate().getSessionFactory().openSession();
if (id.getParmName().equalsIgnoreCase("wind")) { if (id.getParmName().equalsIgnoreCase("wind")) {
String idString = id.toString(); String idString = id.toString();
Matcher idWindMatcher = WIND_PATTERN.matcher(idString); Matcher idWindMatcher = WIND_PATTERN.matcher(idString);
@ -858,53 +860,53 @@ public class GFEDao extends DefaultPluginDao {
List<TimeRange> uTimeList = new ArrayList<TimeRange>( List<TimeRange> uTimeList = new ArrayList<TimeRange>(
results.size()); results.size());
for (DataTime o : results.keySet()) { for (DataTime o : results.keySet()) {
uTimeList.add(new TimeRange(o.getValidPeriod().getStart(), uTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000)); 3600 * 1000));
} }
ParmID vWindId = new ParmID(idWindMatcher.replaceAll("vW")); ParmID vWindId = new ParmID(idWindMatcher.replaceAll("vW"));
results = queryByD2DParmId(vWindId, s); results = queryByD2DParmId(vWindId, s);
Set<TimeRange> vTimeList = new HashSet<TimeRange>( Set<TimeRange> vTimeList = new HashSet<TimeRange>(
results.size(), 1); results.size(), 1);
for (DataTime o : results.keySet()) { for (DataTime o : results.keySet()) {
vTimeList.add(new TimeRange(o.getValidPeriod().getStart(), vTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000)); 3600 * 1000));
} }
for (TimeRange tr : uTimeList) { for (TimeRange tr : uTimeList) {
if (vTimeList.contains(tr)) { if (vTimeList.contains(tr)) {
timeList.add(new TimeRange(tr.getStart(), tr.getStart())); timeList.add(new TimeRange(tr.getStart(), tr.getStart()));
}
} }
}
if (!timeList.isEmpty()) { if (!timeList.isEmpty()) {
return timeList; return timeList;
} }
ParmID sWindId = new ParmID(idWindMatcher.replaceAll("ws")); ParmID sWindId = new ParmID(idWindMatcher.replaceAll("ws"));
results = queryByD2DParmId(sWindId, s); results = queryByD2DParmId(sWindId, s);
List<TimeRange> sTimeList = new ArrayList<TimeRange>( List<TimeRange> sTimeList = new ArrayList<TimeRange>(
results.size()); results.size());
for (DataTime o : results.keySet()) { for (DataTime o : results.keySet()) {
sTimeList.add(new TimeRange(o.getValidPeriod().getStart(), sTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000)); 3600 * 1000));
} }
ParmID dWindId = new ParmID(idWindMatcher.replaceAll("wd")); ParmID dWindId = new ParmID(idWindMatcher.replaceAll("wd"));
results = queryByD2DParmId(dWindId, s); results = queryByD2DParmId(dWindId, s);
Set<TimeRange> dTimeList = new HashSet<TimeRange>( Set<TimeRange> dTimeList = new HashSet<TimeRange>(
results.size(), 1); results.size(), 1);
for (DataTime o : results.keySet()) { for (DataTime o : results.keySet()) {
dTimeList.add(new TimeRange(o.getValidPeriod().getStart(), dTimeList.add(new TimeRange(o.getValidPeriod().getStart(),
3600 * 1000)); 3600 * 1000));
} }
for (TimeRange tr : sTimeList) { for (TimeRange tr : sTimeList) {
if (dTimeList.contains(tr)) { if (dTimeList.contains(tr)) {
timeList.add(new TimeRange(tr.getStart(), tr.getStart())); timeList.add(new TimeRange(tr.getStart(), tr.getStart()));
}
} }
} else { }
} else {
SortedMap<DataTime, Integer> results = queryByD2DParmId(id, s); SortedMap<DataTime, Integer> results = queryByD2DParmId(id, s);
if (isMos(id)) { if (isMos(id)) {
for (DataTime o : results.keySet()) { for (DataTime o : results.keySet()) {
@ -913,10 +915,10 @@ public class GFEDao extends DefaultPluginDao {
} }
} else { } else {
for (DataTime o : results.keySet()) { for (DataTime o : results.keySet()) {
timeList.add(o.getValidPeriod()); timeList.add(o.getValidPeriod());
}
} }
} }
}
} finally { } finally {
if (s != null) { if (s != null) {
try { try {

View file

@ -21,7 +21,6 @@ package com.raytheon.edex.plugin.gfe.server.notify;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -54,10 +53,13 @@ import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotificatio
import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.grid.GridRecord;
import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord; import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord;
import com.raytheon.uf.common.message.WsId; import com.raytheon.uf.common.message.WsId;
import com.raytheon.uf.common.parameter.mapping.ParameterMapper;
import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.util.mapping.MultipleMappingException;
import com.raytheon.uf.edex.core.EDEXUtil; import com.raytheon.uf.edex.core.EDEXUtil;
/** /**
@ -71,6 +73,8 @@ import com.raytheon.uf.edex.core.EDEXUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 12, 2011 dgilling Initial creation * Aug 12, 2011 dgilling Initial creation
* Sep 19, 2012 jdynina DR 15442 fix * Sep 19, 2012 jdynina DR 15442 fix
* Jan 18, 2013 #1504 randerso Moved D2D to GFE parameter name translation from
* D2DParmIdCache to GfeIngestNotificationFilter
* *
* </pre> * </pre>
* *
@ -80,7 +84,7 @@ import com.raytheon.uf.edex.core.EDEXUtil;
public class GfeIngestNotificationFilter { public class GfeIngestNotificationFilter {
private static final transient IUFStatusHandler handler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GfeIngestNotificationFilter.class); .getHandler(GfeIngestNotificationFilter.class);
private SmartInitQueue smartInitQueue = null; private SmartInitQueue smartInitQueue = null;
@ -106,8 +110,7 @@ public class GfeIngestNotificationFilter {
} }
} }
public void filterGridRecords(List<GridRecord> gridRecords, public void filterGridRecords(List<GridRecord> gridRecords, Date arrivalTime)
Date arrivalTime)
throws Exception { throws Exception {
StringBuilder initNameBuilder = new StringBuilder(120); StringBuilder initNameBuilder = new StringBuilder(120);
@ -126,7 +129,8 @@ public class GfeIngestNotificationFilter {
try { try {
config = IFPServerConfigManager.getServerConfig(site); config = IFPServerConfigManager.getServerConfig(site);
} catch (GfeConfigurationException e) { } catch (GfeConfigurationException e) {
handler.error("Unable to retrieve site config for " + site, e); statusHandler.error("Unable to retrieve site config for "
+ site, e);
continue; continue;
} }
for (GridRecord grid : gridRecords) { for (GridRecord grid : gridRecords) {
@ -152,24 +156,30 @@ public class GfeIngestNotificationFilter {
} }
String abbrev = grid.getParameter().getAbbreviation(); String abbrev = grid.getParameter().getAbbreviation();
String level = GridTranslator.getShortLevelName( String gfeParmName = null;
grid try {
.getLevel().getMasterLevel().getName(), grid gfeParmName = ParameterMapper.getInstance()
.getLevel().getLevelonevalue(), grid.getLevel() .lookupAlias(abbrev, "gfeParamName");
.getLeveltwovalue()); } catch (MultipleMappingException e) {
ParmID parmID = new ParmID(abbrev, dbId, level); statusHandler.handle(Priority.WARN,
e.getLocalizedMessage(), e);
gfeParmName = e.getArbitraryMapping();
}
if (!gridInv.containsKey(parmID)) { String level = GridTranslator.getShortLevelName(grid
gridInv.put(parmID, new ArrayList<TimeRange>()); ParmID parmID = new ParmID(gfeParmName, dbId, level);
List<TimeRange> trs = gridInv.get(parmID);
if (trs == null) {
trs = new ArrayList<TimeRange>();
gridInv.put(parmID, trs);
} }
TimeRange validPeriod = grid.getDataTime().getValidPeriod(); TimeRange validPeriod = grid.getDataTime().getValidPeriod();
if (validPeriod.getDuration() > 0) { if (validPeriod.getDuration() > 0) {
gridInv.get(parmID).add(validPeriod); trs.add(validPeriod);
} else { } else {
gridInv.get(parmID).add( trs.add(new TimeRange(grid.getDataTime()
new TimeRange(grid.getDataTime() .getValidPeriod().getStart(), 3600 * 1000));
.getValidPeriod().getStart(),
3600 * 1000));
} }
List<String> siteInitModules = config.initModels(gfeModel); List<String> siteInitModules = config.initModels(gfeModel);
@ -201,23 +211,20 @@ grid
// DR 15442 - move last for loop out of the for loop at line 110 // DR 15442 - move last for loop out of the for loop at line 110
for (ParmID parmId : gridInv.keySet()) { for (ParmID parmId : gridInv.keySet()) {
Map<TimeRange, List<GridDataHistory>> hist = new HashMap<TimeRange, List<GridDataHistory>>();
try { try {
List<TimeRange> trs = gridInv.get(parmId); List<TimeRange> trs = gridInv.get(parmId);
Collections.sort(trs);
for (TimeRange time : trs) { for (TimeRange time : trs) {
List<GridDataHistory> histList = new ArrayList<GridDataHistory>(); List<GridDataHistory> histList = new ArrayList<GridDataHistory>();
histList.add(new GridDataHistory( histList.add(new GridDataHistory(
GridDataHistory.OriginType.INITIALIZED, GridDataHistory.OriginType.INITIALIZED, parmId,
parmId, time, null, (WsId) null)); time, null, (WsId) null));
Map<TimeRange, List<GridDataHistory>> hist = new HashMap<TimeRange, List<GridDataHistory>>();
hist.put(time, histList); hist.put(time, histList);
guns.add(new GridUpdateNotification(parmId, time, hist,
null, parmId.getDbId().getSiteId()));
} }
guns.add(new GridUpdateNotification(parmId,
new TimeRange(trs.get(0).getStart(), trs.get(
trs.size() - 1).getEnd()), hist, null,
parmId.getDbId().getSiteId()));
} catch (Exception e) { } catch (Exception e) {
handler.error("Unable to retrieve grid history for " statusHandler.error("Unable to retrieve grid history for "
+ parmId.toString(), e); + parmId.toString(), e);
} }
} }
@ -225,7 +232,8 @@ grid
try { try {
sendNotifications(guns); sendNotifications(guns);
} catch (Exception e) { } catch (Exception e) {
handler.error("Unable to send grib ingest notifications", e); statusHandler.error("Unable to send grib ingest notifications",
e);
} }
smartInitQueue.addInits(inits.values()); smartInitQueue.addInits(inits.values());
@ -233,8 +241,7 @@ grid
} }
public void filterSatelliteRecords(List<SatelliteRecord> records, public void filterSatelliteRecords(List<SatelliteRecord> records,
Date arrivalTime) Date arrivalTime) throws Exception {
throws Exception {
StringBuilder initNameBuilder = new StringBuilder(120); StringBuilder initNameBuilder = new StringBuilder(120);
Set<String> activeSites = GFESiteActivation.getInstance() Set<String> activeSites = GFESiteActivation.getInstance()
@ -249,7 +256,8 @@ grid
try { try {
config = IFPServerConfigManager.getServerConfig(site); config = IFPServerConfigManager.getServerConfig(site);
} catch (GfeConfigurationException e) { } catch (GfeConfigurationException e) {
handler.error("Error retrieiving site config for " + site, e); statusHandler.error(
"Error retrieiving site config for " + site, e);
continue; continue;
} }
@ -298,8 +306,8 @@ grid
try { try {
sendNotifications(guns); sendNotifications(guns);
} catch (Exception e) { } catch (Exception e) {
handler.error("Unable to send satellite ingest notifications", statusHandler.error(
e); "Unable to send satellite ingest notifications", e);
} }
smartInitQueue.addInits(inits.values()); smartInitQueue.addInits(inits.values());

View file

@ -62,7 +62,7 @@
<pipeline> <pipeline>
<bean ref="stringToFile" /> <bean ref="stringToFile" />
<bean ref="satelliteDecoder" method="decode" /> <bean ref="satelliteDecoder" method="decode" />
<to uri="directvm:persistIndexAlert" /> <to uri="directvm:persistIndexAlert" />
</pipeline> </pipeline>
<doCatch> <doCatch>
<exception>java.lang.Throwable</exception> <exception>java.lang.Throwable</exception>

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeTypeAdap
* 8/19/09 2899 njensen Rewrote equals() for performance * 8/19/09 2899 njensen Rewrote equals() for performance
* 5/08/12 #600 dgilling Implement clone(). * 5/08/12 #600 dgilling Implement clone().
* 6/25/12 #766 dgilling Fix isValid(). * 6/25/12 #766 dgilling Fix isValid().
* 01/18/13 #1504 randerso Removed setters since class should be immutable
* *
* </pre> * </pre>
* *
@ -487,42 +488,6 @@ public class DatabaseID implements Serializable, Comparable<DatabaseID>,
return date; return date;
} }
public void setSiteId(String siteId) {
this.siteId = siteId;
}
public void setFormat(DataType format) {
this.format = format;
}
public void setFormat(String format) {
if (format.equals("GRID")) {
this.format = DataType.GRID;
} else {
this.format = DataType.NONE;
}
}
public void setDbType(String dbType) {
this.dbType = dbType;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
public void setModelTime(String modelTime) {
this.modelTime = modelTime;
}
public void setModelId(String modelId) {
this.modelId = modelId.intern();
}
public void setShortModelId(String shortModelId) {
this.shortModelId = shortModelId;
}
public Date getModelTimeAsDate() { public Date getModelTimeAsDate() {
if (this.modelTime.equals(NO_MODEL_TIME)) { if (this.modelTime.equals(NO_MODEL_TIME)) {
return new Date(0); return new Date(0);

View file

@ -47,6 +47,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeTypeAdap
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 3/6/08 875 bphillip Initial Creation * 3/6/08 875 bphillip Initial Creation
* 5/8/12 #600 dgilling Implement clone(). * 5/8/12 #600 dgilling Implement clone().
* 01/18/13 #1504 randerso Removed setters since class should be immutable
* *
* </pre> * </pre>
* *
@ -95,12 +96,7 @@ public class ParmID implements Comparable<ParmID>, Serializable,
@Override @Override
public String toString() { public String toString() {
StringBuffer buffer = new StringBuffer(); return this.parmId;
buffer.append(parmName).append("_");
buffer.append(parmLevel).append(":");
buffer.append(dbId.toString());
return buffer.toString();
} }
/* /*
@ -140,7 +136,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName; this.parmName = parmName;
this.parmLevel = defaultLevel(); this.parmLevel = defaultLevel();
this.dbId = new DatabaseID(parmModel); this.dbId = new DatabaseID(parmModel);
this.compositeName = parmName + "_" + defaultLevel();
encodeIdentifier(); encodeIdentifier();
} }
@ -158,7 +153,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName; this.parmName = parmName;
this.parmLevel = level; this.parmLevel = level;
this.dbId = new DatabaseID(parmModel); this.dbId = new DatabaseID(parmModel);
this.compositeName = parmName + "_" + level;
encodeIdentifier(); encodeIdentifier();
} }
@ -170,7 +164,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
*/ */
public ParmID(String parmIdentifier) { public ParmID(String parmIdentifier) {
decodeIdentifier(parmIdentifier); decodeIdentifier(parmIdentifier);
this.compositeName = this.parmName + "_" + this.parmLevel;
encodeIdentifier(); encodeIdentifier();
} }
@ -186,7 +179,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName; this.parmName = parmName;
this.parmLevel = defaultLevel(); this.parmLevel = defaultLevel();
this.dbId = dbId; this.dbId = dbId;
this.compositeName = parmName + "_" + defaultLevel();
encodeIdentifier(); encodeIdentifier();
} }
@ -204,7 +196,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
this.parmName = parmName; this.parmName = parmName;
this.parmLevel = level; this.parmLevel = level;
this.dbId = dbId; this.dbId = dbId;
this.compositeName = parmName + "_" + level;
encodeIdentifier(); encodeIdentifier();
} }
@ -333,11 +324,9 @@ public class ParmID implements Comparable<ParmID>, Serializable,
*/ */
private void encodeIdentifier() { private void encodeIdentifier() {
this.compositeName = this.parmName + "_" + this.parmLevel;
shortParmId = this.compositeName + ":" + dbId.getShortModelId(); shortParmId = this.compositeName + ":" + dbId.getShortModelId();
parmId = this.compositeName + ":" + dbId.getModelId();
if (parmId == null || parmId.length() == 0) {
parmId = this.compositeName + ":" + dbId.getModelId();
}
} }
/** /**
@ -442,30 +431,6 @@ public class ParmID implements Comparable<ParmID>, Serializable,
return true; return true;
} }
public void setParmName(String parmName) {
this.parmName = parmName;
}
public void setParmLevel(String parmLevel) {
this.parmLevel = parmLevel;
}
public void setDbId(DatabaseID dbId) {
this.dbId = dbId;
}
public void setCompositeName(String compositeName) {
this.compositeName = compositeName;
}
public void setShortParmId(String shortParmId) {
this.shortParmId = shortParmId;
}
public void setParmId(String parmId) {
this.parmId = parmId;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

View file

@ -48,50 +48,30 @@ class ParmID(object):
else: else:
self.parmLevel = level self.parmLevel = level
self.compositeName = self.parmName + "_" + self.parmLevel
self.__encodeIdentifier() self.__encodeIdentifier()
elif parmIdentifier is not None: elif parmIdentifier is not None:
self.__decodeIdentifier(parmIdentifier) self.__decodeIdentifier(parmIdentifier)
self.compositeName = self.parmName + "_" + self.parmLevel
self.__encodeIdentifier() self.__encodeIdentifier()
def getParmName(self): def getParmName(self):
return self.parmName return self.parmName
def setParmName(self, parmName):
self.parmName = parmName
def getParmLevel(self): def getParmLevel(self):
return self.parmLevel return self.parmLevel
def setParmLevel(self, parmLevel):
self.parmLevel = parmLevel
def getDbId(self): def getDbId(self):
return self.dbId return self.dbId
def setDbId(self, dbId):
self.dbId = dbId
def getCompositeName(self): def getCompositeName(self):
return self.compositeName return self.compositeName
def setCompositeName(self, compositeName):
self.compositeName = compositeName
def getShortParmId(self): def getShortParmId(self):
return self.shortParmId return self.shortParmId
def setShortParmId(self, shortParmId):
self.shortParmId = shortParmId
def getParmId(self): def getParmId(self):
return self.parmId return self.parmId
def setParmId(self, parmId):
self.parmId = parmId
def __decodeIdentifier(self, parmIdentifier): def __decodeIdentifier(self, parmIdentifier):
parts = parmIdentifier.split(":") parts = parmIdentifier.split(":")
nameLevel = parts[0].split("_") nameLevel = parts[0].split("_")
@ -104,9 +84,9 @@ class ParmID(object):
self.parmLevel = self.defaultLevel() self.parmLevel = self.defaultLevel()
def __encodeIdentifier(self): def __encodeIdentifier(self):
self.compositeName = self.parmName + "_" + self.parmLevel
self.shortParmId = self.compositeName + ":" + self.dbId.getShortModelId() self.shortParmId = self.compositeName + ":" + self.dbId.getShortModelId()
if self.parmId is None or len(self.parmId) == 0: self.parmId = self.compositeName + ":" + self.dbId.getModelId()
self.parmId = self.compositeName + ":" + self.dbId.getModelId()
def isValid(self): def isValid(self):
if len(self.parmName) is None or len(self.parmLevel) is None or self.dbId is None: if len(self.parmName) is None or len(self.parmLevel) is None or self.dbId is None: