Go to the documentation of this file.
19package org.sleuthkit.autopsy.datamodel.persons;
21import java.util.Collection;
23import java.util.stream.Collectors;
24import java.util.stream.Stream;
25import org.apache.commons.lang3.StringUtils;
26import org.openide.util.NbBundle;
27import org.sleuthkit.datamodel.Person;
46 "PersonNameValidator_getValidationMessage_onEmpty=Please provide some text for the person name.",
47 "PersonNameValidator_getValidationMessage_sameAsOriginal=Please provide a new name for this person.",
48 "PersonNameValidator_getValidationMessage_onDuplicate=Another person already has the same name. Please choose a different name.",})
49 public static String
getValidationMessage(String curName, String initialName, Set<String> currentPersonsTrimmedUpper) {
51 if (StringUtils.isBlank(curName)) {
52 return Bundle.PersonNameValidator_getValidationMessage_onEmpty();
55 if (StringUtils.equalsIgnoreCase(initialName, curName)) {
56 return Bundle.PersonNameValidator_getValidationMessage_sameAsOriginal();
59 if (currentPersonsTrimmedUpper.contains(curName.trim().toUpperCase())) {
60 return Bundle.PersonNameValidator_getValidationMessage_onDuplicate();
74 Stream<Person> personsStream =
persons !=
null ?
persons.stream() : Stream.empty();
76 .map(h -> h ==
null ?
null : h.getName())
77 .filter(hName -> StringUtils.isNotBlank(hName))
78 .map(hName -> hName.trim().toUpperCase())
79 .collect(Collectors.toSet());
static Set< String > getSanitizedPersonNames(Collection< Person > persons)
static String getValidationMessage(String curName, String initialName, Set< String > currentPersonsTrimmedUpper)
Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.