added MPE checks in the mergeOAFDataInfo method

This commit is contained in:
Claudio Atzori 2022-03-25 15:05:17 +01:00
parent b073935a64
commit ffa6bbf392
1 changed files with 8 additions and 3 deletions

View File

@ -70,9 +70,14 @@ public abstract class Oaf implements Serializable {
} }
public void mergeOAFDataInfo(Oaf o) { public void mergeOAFDataInfo(Oaf o) {
Optional.ofNullable(o)
if (o.getDataInfo() != null && (compareTrust(this, o) < 0 || this.getDataInfo().getInvisible())) .ifPresent(other -> Optional.ofNullable(other.getDataInfo())
dataInfo = o.getDataInfo(); .ifPresent(otherDataInfo -> Optional.ofNullable(this.getDataInfo())
.ifPresent(thisDataInfo -> {
if (compareTrust(this, other) < 0 || thisDataInfo.getInvisible()) {
setDataInfo(otherDataInfo);
}
})));
} }
protected String extractTrust(Oaf e) { protected String extractTrust(Oaf e) {