13.5.1-17 baseline

Former-commit-id: b210c90245 [formerly c5d75a6473b2659b9ac1054a1160c921bd8c1c16]
Former-commit-id: 9dd7dc5d20
This commit is contained in:
Steve Harris 2013-08-19 16:34:24 -04:00
parent 6818d80085
commit 2d882ccb54
6 changed files with 92 additions and 20 deletions

View file

@ -42,6 +42,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.AbstractTimeMatcher;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.VizConstants;
import com.raytheon.uf.viz.core.comm.PerspectiveSpecificLoadProperties;
@ -192,8 +193,10 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
@Override
public void redoTimeMatching(IDescriptor descriptor) throws VizException {
synchronized (this) {
if (timeMatchBasis != null && ! validateTimeMatchBasis(descriptor.getResourceList()))
timeMatchBasis = null;
if (timeMatchBasis != null && timeMatchBasis.getDescriptor() == descriptor &&
! validateTimeMatchBasis(descriptor)) {
changeTimeMatchBasis(null);
}
if (timeMatchBasis != null) {
IDescriptor tmDescriptor = timeMatchBasis.getDescriptor();
if (tmDescriptor != null && tmDescriptor != descriptor) {
@ -993,6 +996,33 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
configFactory.resetMultiload();
}
private boolean validateTimeMatchBasis(IDescriptor descriptor ) {
/*
* If a resource is shared by multiple panels (this can be the case with
* tools, at least), then it is necessary to search all of them as
* resource.descriptor() may not contain resource. TODO: Don't allow
* this condition to occur?
*/
IRenderableDisplay display = descriptor.getRenderableDisplay();
IDisplayPaneContainer container = display != null ?
display.getContainer() : null;
if (container != null) {
for (IDisplayPane pane : container.getDisplayPanes()) {
IRenderableDisplay paneDisplay = pane.getRenderableDisplay();
IDescriptor paneDescriptor = paneDisplay != null ?
paneDisplay.getDescriptor() : null;
if (paneDescriptor != null
&& validateTimeMatchBasis(paneDescriptor
.getResourceList())) {
return true;
}
}
} else {
return validateTimeMatchBasis(descriptor.getResourceList());
}
return false;
}
private boolean validateTimeMatchBasis(ResourceList list) {
for (ResourcePair rp : list) {
AbstractVizResource<?, ?> rsc = rp.getResource();

View file

@ -715,7 +715,7 @@ public class FFMPMonitor extends ResourceMonitor {
FFMPRecord record = siteDataMap.get(siteKey).getSourceData(sourceName)
.getRecord();
if ((record != null) && (record.getBasinData().getBasins().size() > 0)) {
if ((record != null) && (record.getBasinData().hasAnyBasins())) {
SourceXML sourceXML = getSourceConfig().getSource(sourceName);

View file

@ -277,7 +277,7 @@ public class FFMPDataGenerator {
statusHandler.handle(Priority.PROBLEM,
"Couldn't create table row", e);
"Couldn't create table row", e);
}
}
}
@ -414,14 +414,14 @@ public class FFMPDataGenerator {
try {
if (rateRecord != null) {
rateBasin = rateRecord.getBasinData();
if (!rateBasin.getBasins().isEmpty()) {
if (rateBasin.hasAnyBasins()) {
field = FIELDS.RATE;
baseRec = rateRecord;
}
}
if (qpeRecord != null) {
qpeBasin = qpeRecord.getBasinData();
if (!qpeBasin.getBasins().isEmpty()) {
if (qpeBasin.hasAnyBasins()) {
field = FIELDS.QPE;
if (baseRec == null) {

View file

@ -32,6 +32,7 @@ import javax.xml.bind.annotation.XmlType;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
@ -95,6 +96,12 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
/** Performance log entry prefix */
private static final String prefix = "FFMP ResourceData:";
/** Number of hours back from the most recent time to load data for **/
private static final int HOURS_BACK = 24;
/** Number of hours a background data job should request data for **/
private static final int LOAD_INCREMENT = 1;
/** Performance logger */
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler(prefix);
@ -227,14 +234,52 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
initialJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
Date backgroundStartTime = new Date(mostRecentTime
.getTime() - (24 * TimeUtil.MILLIS_PER_HOUR));
BackgroundLoadJob backgroundJob = new BackgroundLoadJob(
"Background FFMP Load", FFMPResourceData.this,
backgroundStartTime, timeBack, onlyAllHuc);
backgroundJob.setPreloadAvailableUris(true);
backgroundJob.schedule();
// step back in time in increments and
// load the data in chunks all the way
// back to 24 hours
// before the current time
Date farthestBack = new Date(mostRecentTime.getTime()
- (HOURS_BACK * TimeUtil.MILLIS_PER_HOUR));
int hourBack = (int) configTimeFrame;
Date loadedUpTo = new Date(timeBack.getTime());
BackgroundLoadJob firstJob = null;
Job previousJob = null;
while (loadedUpTo.after(farthestBack)) {
Date startTime = new Date(
loadedUpTo.getTime()
- (LOAD_INCREMENT * TimeUtil.MILLIS_PER_HOUR));
hourBack += LOAD_INCREMENT;
if (startTime.before(farthestBack)) {
startTime = farthestBack;
hourBack = HOURS_BACK;
}
String jobName = "FFMP loading to hr " + hourBack;
if (previousJob == null) {
firstJob = new BackgroundLoadJob(jobName,
FFMPResourceData.this, startTime,
loadedUpTo, onlyAllHuc);
firstJob.setPreloadAvailableUris(true);
previousJob = firstJob;
} else {
final BackgroundLoadJob nextJob = new BackgroundLoadJob(
jobName, FFMPResourceData.this,
startTime, loadedUpTo, onlyAllHuc);
nextJob.setPreloadAvailableUris(true);
previousJob
.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(
IJobChangeEvent event) {
nextJob.schedule();
}
});
previousJob = nextJob;
}
loadedUpTo = startTime;
}
firstJob.schedule();
}
});
initialJob.schedule();

View file

@ -1130,7 +1130,7 @@ public class GFEDao extends DefaultPluginDao {
DatabaseQuery query = new DatabaseQuery(this.daoClass);
query.addQueryParam("parmId.dbId.siteId", dbId.getSiteId(),
QueryOperand.EQUALS);
query.addQueryParam("parmId.dbId.format", dbId.getFormat(),
query.addQueryParam("parmId.dbId.dbType", dbId.getDbType(),
QueryOperand.EQUALS);
query.addQueryParam("parmId.dbId.modelName", dbId.getModelName(),
QueryOperand.EQUALS);

View file

@ -214,11 +214,11 @@ public class FFMPBasinData implements ISerializableObject {
* @return
*/
public float getAverageValue(ArrayList<Long> pfaf_ids, Date date) {
float tvalue = 0.0f;
int i = 0;
for (Long pfaf : pfaf_ids) {
FFMPBasin basin = getBasins().get(pfaf);
Map<Long, FFMPBasin> localBasins = getBasins();
for (long pfaf : pfaf_ids) {
FFMPBasin basin = localBasins.get(pfaf);
if (basin != null) {
tvalue += basin.getValue(date);
i++;
@ -295,7 +295,6 @@ public class FFMPBasinData implements ISerializableObject {
*/
public float getAccumAverageValue(List<Long> pfaf_ids, Date beforeDate,
Date afterDate, long expirationTime, boolean rate) {
float tvalue = 0.0f;
int i = 0;
Map<Long, FFMPBasin> localBasins = getBasins();
@ -321,7 +320,6 @@ public class FFMPBasinData implements ISerializableObject {
*/
public float getMaxValue(ArrayList<Long> pfaf_ids, Date beforeDate,
Date afterDate) {
float tvalue = 0.0f;
Map<Long, FFMPBasin> localBasins = getBasins();
for (Long pfaf : pfaf_ids) {
@ -690,7 +688,6 @@ public class FFMPBasinData implements ISerializableObject {
* @param times
*/
public void populate(List<Long> times) {
if (mapFactory == null) {
mapFactory = new BasinMapFactory<Date>(Collections.reverseOrder(),
getBasins().size());