RED-8615: fix for state PENDING
This commit is contained in:
parent
772ab45605
commit
43eb49399d
@ -6,7 +6,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -15,8 +14,6 @@ import java.util.stream.Collectors;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.Change;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.ChangeType;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLog;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLogEntry;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog.EntityLogLegalBasis;
|
||||
@ -31,7 +28,6 @@ import com.iqser.red.service.redaction.report.v1.server.client.DossierClient;
|
||||
import com.iqser.red.service.redaction.report.v1.server.client.EntityLogClient;
|
||||
import com.iqser.red.service.redaction.report.v1.server.model.ReportRedactionEntry;
|
||||
import com.iqser.red.service.redaction.report.v1.server.settings.ReportTemplateSettings;
|
||||
import com.iqser.red.service.redaction.report.v1.server.storage.ReportStorageService;
|
||||
import com.iqser.red.storage.commons.exception.StorageObjectDoesNotExist;
|
||||
|
||||
import io.micrometer.core.annotation.Timed;
|
||||
@ -47,8 +43,6 @@ public class EntityLogConverterService {
|
||||
|
||||
private final DictionaryClient dictionaryClient;
|
||||
|
||||
private final ReportStorageService reportStorageService;
|
||||
|
||||
private final EntityLogClient entityLogClient;
|
||||
|
||||
private final ReportTemplateSettings settings;
|
||||
@ -102,7 +96,7 @@ public class EntityLogConverterService {
|
||||
entityLog.getEntityLogEntry()
|
||||
.forEach(entry -> {
|
||||
|
||||
if (entry.getState().equals(EntryState.REMOVED)) {
|
||||
if (!entry.getState().equals(EntryState.APPLIED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -122,21 +116,11 @@ public class EntityLogConverterService {
|
||||
return;
|
||||
}
|
||||
|
||||
// This is due to recategorize on images leading to a wrong legal basis.
|
||||
if (!entry.getManualChanges().isEmpty()
|
||||
&& (entry.getEntryType() == EntryType.IMAGE || entry.getEntryType() == EntryType.IMAGE_HINT)
|
||||
&& entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1).getProcessedDate() == null
|
||||
&& entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1).getManualRedactionType().equals(ManualRedactionType.RECATEGORIZE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entry.getManualChanges().isEmpty()
|
||||
&& (entry.isDictionaryEntry() || entry.isDossierDictionaryEntry())
|
||||
&& entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1).getProcessedDate() == null
|
||||
&& entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1).getManualRedactionType().equals(ManualRedactionType.ADD_TO_DICTIONARY)) {
|
||||
&& getLastManualChange(entry).getProcessedDate() == null
|
||||
&& getLastManualChange(entry).getManualRedactionType().equals(ManualRedactionType.RECATEGORIZE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -207,11 +191,17 @@ public class EntityLogConverterService {
|
||||
}
|
||||
|
||||
|
||||
private static ManualChange getLastManualChange(EntityLogEntry entry) {
|
||||
|
||||
return entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1);
|
||||
}
|
||||
|
||||
|
||||
private String determineValue(EntityLogEntry entry) {
|
||||
|
||||
if (entry.getManualChanges() != null && !entry.getManualChanges().isEmpty()) {
|
||||
ManualChange lastChange = entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1);
|
||||
ManualChange lastChange = getLastManualChange(entry);
|
||||
if ((lastChange.getManualRedactionType().equals(ManualRedactionType.RESIZE) || lastChange.getManualRedactionType().equals(ManualRedactionType.RESIZE_IN_DICTIONARY))
|
||||
&& lastChange.getPropertyChanges() != null) {
|
||||
return lastChange.getPropertyChanges()
|
||||
@ -267,17 +257,4 @@ public class EntityLogConverterService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private boolean lastChangeIsRemoved(List<Change> changes) {
|
||||
|
||||
return last(changes).map(c -> c.getType() == ChangeType.REMOVED)
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
|
||||
private <T> Optional<T> last(List<T> list) {
|
||||
|
||||
return list == null || list.isEmpty() ? Optional.empty() : Optional.of(list.get(list.size() - 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user