19 package org.sleuthkit.autopsy.datamodel.hosts;
 
   21 import java.util.Collection;
 
   23 import java.util.stream.Collectors;
 
   24 import java.util.stream.Stream;
 
   25 import org.apache.commons.lang3.StringUtils;
 
   26 import org.openide.util.NbBundle;
 
   46         "HostNameValidator_getValidationMessage_onEmpty=Please provide some text for the host name.",
 
   47         "HostNameValidator_getValidationMessage_sameAsOriginal=Please provide a new name for this host.",
 
   48         "HostNameValidator_getValidationMessage_onDuplicate=Another host already has the same name.  Please choose a different name.",})
 
   49     public static String 
getValidationMessage(String curName, String initialName, Set<String> currentHostsTrimmedUpper) {
 
   51         if (StringUtils.isBlank(curName)) {
 
   52             return Bundle.HostNameValidator_getValidationMessage_onEmpty();
 
   55         if (StringUtils.equalsIgnoreCase(initialName, curName)) {
 
   56             return Bundle.HostNameValidator_getValidationMessage_sameAsOriginal();
 
   59         if (currentHostsTrimmedUpper.contains(curName.trim().toUpperCase())) {
 
   60             return Bundle.HostNameValidator_getValidationMessage_onDuplicate();
 
   74         Stream<Host> hostsStream = hosts != null ? hosts.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 String getValidationMessage(String curName, String initialName, Set< String > currentHostsTrimmedUpper)
static Set< String > getSanitizedHostNames(Collection< Host > hosts)