Issue #1400 fix for local and regional warnings, made the WatchesResource better handle extension
Change-Id: I6cc0d8eb6079efc224136b67962903b75330c8e1 Former-commit-id:124beb0449
[formerly9d35cdf724
] [formerlyc992d831af
] [formerly124beb0449
[formerly9d35cdf724
] [formerlyc992d831af
] [formerly3ff52fb9ff
[formerlyc992d831af
[formerly 8e1660c65bbb6ad76bdc44c3327819170c3244f5]]]] Former-commit-id:3ff52fb9ff
Former-commit-id:a34462a41c
[formerly3f76c7ab62
] [formerly c78eb61c2fba2fc5c9840c27da3bf7ec82bebc91 [formerly7d5f78c785
]] Former-commit-id: b71d32010308296d1afcc69fa9c013f5c54b5886 [formerly86b7a7de3d
] Former-commit-id:4284d53e3b
This commit is contained in:
parent
d7931f4adf
commit
527ea263ab
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;
|
||||
|
||||
|
||||
public class CWASPSResource extends WarningsResource {
|
||||
public class CWASPSResource extends WatchesResource {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(CWASPSResource.class);
|
||||
|
|
|
@ -34,35 +34,43 @@ public class WarningRecordComparator implements
|
|||
public int compare(AbstractWarningRecord wr1, AbstractWarningRecord wr2) {
|
||||
int rval = 0;
|
||||
|
||||
rval = wr1.getPhensig().compareTo(wr2.getPhensig());
|
||||
if (wr1.getPhensig() != null && wr2.getPhensig() != null) {
|
||||
rval = wr1.getPhensig().compareTo(wr2.getPhensig());
|
||||
}
|
||||
|
||||
if (rval == 0) {
|
||||
rval = Double.compare(Double.parseDouble(wr1.getEtn()),
|
||||
Double.parseDouble(wr2.getEtn()));
|
||||
if (wr1.getEtn() != null && wr2.getEtn() != null) {
|
||||
rval = Double.compare(Double.parseDouble(wr1.getEtn()),
|
||||
Double.parseDouble(wr2.getEtn()));
|
||||
}
|
||||
if (rval == 0) {
|
||||
WarningAction act1 = WarningAction.valueOf(wr1.getAct());
|
||||
WarningAction act2 = WarningAction.valueOf(wr2.getAct());
|
||||
if (act1 == act2) {
|
||||
rval = 0;
|
||||
} else if (act1 == WarningAction.NEW) {
|
||||
rval = -1;
|
||||
} else if (act2 == WarningAction.NEW) {
|
||||
rval = 1;
|
||||
} else if (act1 == WarningAction.CON
|
||||
&& (act2 == WarningAction.CAN || act2 == WarningAction.EXP)) {
|
||||
return -1;
|
||||
} else if (act2 == WarningAction.CON
|
||||
&& (act1 == WarningAction.CAN || act1 == WarningAction.EXP)) {
|
||||
return 1;
|
||||
} else {
|
||||
rval = wr1.getAct().compareTo(wr2.getAct());
|
||||
if (wr1.getAct() != null && wr2.getAct() != null) {
|
||||
WarningAction act1 = WarningAction.valueOf(wr1.getAct());
|
||||
WarningAction act2 = WarningAction.valueOf(wr2.getAct());
|
||||
if (act1 == act2) {
|
||||
rval = 0;
|
||||
} else if (act1 == WarningAction.NEW) {
|
||||
rval = -1;
|
||||
} else if (act2 == WarningAction.NEW) {
|
||||
rval = 1;
|
||||
} else if (act1 == WarningAction.CON
|
||||
&& (act2 == WarningAction.CAN || act2 == WarningAction.EXP)) {
|
||||
return -1;
|
||||
} else if (act2 == WarningAction.CON
|
||||
&& (act1 == WarningAction.CAN || act1 == WarningAction.EXP)) {
|
||||
return 1;
|
||||
} else {
|
||||
rval = wr1.getAct().compareTo(wr2.getAct());
|
||||
}
|
||||
}
|
||||
|
||||
if (rval == 0) {
|
||||
rval = wr1.getStartTime().compareTo(wr2.getStartTime());
|
||||
// sort warnings in descending order
|
||||
if (!wr1.getSig().equals("A")) {
|
||||
rval *= -1;
|
||||
if (wr1.getSig() != null) {
|
||||
if (!wr1.getSig().equals("A")) {
|
||||
rval *= -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,29 +221,45 @@ public class WatchesResource extends AbstractWWAResource {
|
|||
|
||||
if (watchact != WarningAction.NEW) {
|
||||
AbstractWarningRecord createShape = null;
|
||||
if (watchact == null || watchact.toString() == null) {
|
||||
createShape = watchrec;
|
||||
}
|
||||
for (String entryKey : entryMap.keySet()) {
|
||||
WarningEntry entry = entryMap.get(entryKey);
|
||||
AbstractWarningRecord rec = entry.record;
|
||||
|
||||
if (rec.getPhensig().equals(watchrec.getPhensig())
|
||||
&& rec.getOfficeid().equals(
|
||||
watchrec.getOfficeid())
|
||||
&& rec.getEtn().equals(watchrec.getEtn())) {
|
||||
int recSize = rec.getUgczones().size();
|
||||
if (!entry.partialCancel) {
|
||||
if (watchact == WarningAction.EXP
|
||||
|| watchact == WarningAction.CAN) {
|
||||
entry.partialCancel = true;
|
||||
entry.record.setEndTime((Calendar) watchrec
|
||||
.getStartTime().clone());
|
||||
} else if (watchact == WarningAction.CON
|
||||
&& recSize > watchSize
|
||||
&& watchrec.getStartTime().after(
|
||||
rec.getStartTime())) {
|
||||
entry.partialCancel = true;
|
||||
entry.record.setEndTime((Calendar) watchrec
|
||||
.getStartTime().clone());
|
||||
createShape = watchrec;
|
||||
// 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())
|
||||
&& rec.getOfficeid().equals(
|
||||
watchrec.getOfficeid())
|
||||
&& rec.getEtn().equals(watchrec.getEtn())) {
|
||||
int recSize = rec.getUgczones().size();
|
||||
if (!entry.partialCancel) {
|
||||
if (watchact == WarningAction.EXP
|
||||
|| watchact == WarningAction.CAN) {
|
||||
entry.partialCancel = true;
|
||||
entry.record
|
||||
.setEndTime((Calendar) watchrec
|
||||
.getStartTime().clone());
|
||||
} else if (watchact == WarningAction.CON
|
||||
&& recSize > watchSize
|
||||
&& watchrec.getStartTime().after(
|
||||
rec.getStartTime())) {
|
||||
entry.partialCancel = true;
|
||||
entry.record
|
||||
.setEndTime((Calendar) watchrec
|
||||
.getStartTime().clone());
|
||||
createShape = watchrec;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue