Merge "Issue #1400 fix for local and regional warnings, made the WatchesResource better handle extension" into development
Former-commit-id:823bedcebd
[formerly67d30566c0
[formerly e7b347563598a3f4809cc74096de1f2dc0ef0788]] Former-commit-id:67d30566c0
Former-commit-id:acccca74eb
This commit is contained in:
commit
7490c6cc42
3 changed files with 65 additions and 41 deletions
|
@ -28,7 +28,7 @@ import com.vividsolutions.jts.io.WKBReader;
|
||||||
import com.vividsolutions.jts.io.WKTReader;
|
import com.vividsolutions.jts.io.WKTReader;
|
||||||
|
|
||||||
|
|
||||||
public class CWASPSResource extends WarningsResource {
|
public class CWASPSResource extends WatchesResource {
|
||||||
|
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(CWASPSResource.class);
|
.getHandler(CWASPSResource.class);
|
||||||
|
|
|
@ -34,12 +34,17 @@ public class WarningRecordComparator implements
|
||||||
public int compare(AbstractWarningRecord wr1, AbstractWarningRecord wr2) {
|
public int compare(AbstractWarningRecord wr1, AbstractWarningRecord wr2) {
|
||||||
int rval = 0;
|
int rval = 0;
|
||||||
|
|
||||||
|
if (wr1.getPhensig() != null && wr2.getPhensig() != null) {
|
||||||
rval = wr1.getPhensig().compareTo(wr2.getPhensig());
|
rval = wr1.getPhensig().compareTo(wr2.getPhensig());
|
||||||
|
}
|
||||||
|
|
||||||
if (rval == 0) {
|
if (rval == 0) {
|
||||||
|
if (wr1.getEtn() != null && wr2.getEtn() != null) {
|
||||||
rval = Double.compare(Double.parseDouble(wr1.getEtn()),
|
rval = Double.compare(Double.parseDouble(wr1.getEtn()),
|
||||||
Double.parseDouble(wr2.getEtn()));
|
Double.parseDouble(wr2.getEtn()));
|
||||||
|
}
|
||||||
if (rval == 0) {
|
if (rval == 0) {
|
||||||
|
if (wr1.getAct() != null && wr2.getAct() != null) {
|
||||||
WarningAction act1 = WarningAction.valueOf(wr1.getAct());
|
WarningAction act1 = WarningAction.valueOf(wr1.getAct());
|
||||||
WarningAction act2 = WarningAction.valueOf(wr2.getAct());
|
WarningAction act2 = WarningAction.valueOf(wr2.getAct());
|
||||||
if (act1 == act2) {
|
if (act1 == act2) {
|
||||||
|
@ -57,16 +62,19 @@ public class WarningRecordComparator implements
|
||||||
} else {
|
} else {
|
||||||
rval = wr1.getAct().compareTo(wr2.getAct());
|
rval = wr1.getAct().compareTo(wr2.getAct());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rval == 0) {
|
if (rval == 0) {
|
||||||
rval = wr1.getStartTime().compareTo(wr2.getStartTime());
|
rval = wr1.getStartTime().compareTo(wr2.getStartTime());
|
||||||
// sort warnings in descending order
|
// sort warnings in descending order
|
||||||
|
if (wr1.getSig() != null) {
|
||||||
if (!wr1.getSig().equals("A")) {
|
if (!wr1.getSig().equals("A")) {
|
||||||
rval *= -1;
|
rval *= -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,10 +221,23 @@ public class WatchesResource extends AbstractWWAResource {
|
||||||
|
|
||||||
if (watchact != WarningAction.NEW) {
|
if (watchact != WarningAction.NEW) {
|
||||||
AbstractWarningRecord createShape = null;
|
AbstractWarningRecord createShape = null;
|
||||||
|
if (watchact == null || watchact.toString() == null) {
|
||||||
|
createShape = watchrec;
|
||||||
|
}
|
||||||
for (String entryKey : entryMap.keySet()) {
|
for (String entryKey : entryMap.keySet()) {
|
||||||
WarningEntry entry = entryMap.get(entryKey);
|
WarningEntry entry = entryMap.get(entryKey);
|
||||||
AbstractWarningRecord rec = entry.record;
|
AbstractWarningRecord rec = entry.record;
|
||||||
|
|
||||||
|
// checks for any possible null pointer exceptions in
|
||||||
|
// the following block of code, since there is the
|
||||||
|
// possibility of null values
|
||||||
|
if (rec.getPhensig() != null
|
||||||
|
&& watchrec.getPhensig() != null
|
||||||
|
&& rec.getOfficeid() != null
|
||||||
|
&& watchrec.getOfficeid() != null
|
||||||
|
&& rec.getUgczones() != null
|
||||||
|
&& rec.getStartTime() != null
|
||||||
|
&& watchrec.getStartTime() != null) {
|
||||||
if (rec.getPhensig().equals(watchrec.getPhensig())
|
if (rec.getPhensig().equals(watchrec.getPhensig())
|
||||||
&& rec.getOfficeid().equals(
|
&& rec.getOfficeid().equals(
|
||||||
watchrec.getOfficeid())
|
watchrec.getOfficeid())
|
||||||
|
@ -234,20 +247,23 @@ public class WatchesResource extends AbstractWWAResource {
|
||||||
if (watchact == WarningAction.EXP
|
if (watchact == WarningAction.EXP
|
||||||
|| watchact == WarningAction.CAN) {
|
|| watchact == WarningAction.CAN) {
|
||||||
entry.partialCancel = true;
|
entry.partialCancel = true;
|
||||||
entry.record.setEndTime((Calendar) watchrec
|
entry.record
|
||||||
|
.setEndTime((Calendar) watchrec
|
||||||
.getStartTime().clone());
|
.getStartTime().clone());
|
||||||
} else if (watchact == WarningAction.CON
|
} else if (watchact == WarningAction.CON
|
||||||
&& recSize > watchSize
|
&& recSize > watchSize
|
||||||
&& watchrec.getStartTime().after(
|
&& watchrec.getStartTime().after(
|
||||||
rec.getStartTime())) {
|
rec.getStartTime())) {
|
||||||
entry.partialCancel = true;
|
entry.partialCancel = true;
|
||||||
entry.record.setEndTime((Calendar) watchrec
|
entry.record
|
||||||
|
.setEndTime((Calendar) watchrec
|
||||||
.getStartTime().clone());
|
.getStartTime().clone());
|
||||||
createShape = watchrec;
|
createShape = watchrec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (createShape != null) {
|
if (createShape != null) {
|
||||||
WarningEntry entry = entryMap.get(createShape
|
WarningEntry entry = entryMap.get(createShape
|
||||||
|
|
Loading…
Add table
Reference in a new issue