use of org.apache.commons.lang3.StringUtils.equalsIgnoreCase in project molgenis by molgenis.
the class LexicalCategoryMapper method findBestCategoryMatch.
public Category findBestCategoryMatch(Category sourceCategory, List<Category> targetCategories) {
String sourceCategoryLabel = sourceCategory.getLabel().toLowerCase();
Category bestCategory = null;
double bestNGramScore = -1;
for (Category targetCategory : targetCategories) {
String targetCategoryLabel = targetCategory.getLabel();
if (StringUtils.equalsIgnoreCase(sourceCategoryLabel, targetCategoryLabel)) {
return targetCategory;
}
double ngramScore = NGramDistanceAlgorithm.stringMatching(sourceCategoryLabel, targetCategoryLabel);
if (bestNGramScore == -1 || bestNGramScore < ngramScore) {
bestNGramScore = ngramScore;
bestCategory = targetCategory;
}
}
if (bestNGramScore < DEFAULT_THRESHOLD) {
Optional<?> findFirst = targetCategories.stream().map(targetCategory -> applyCustomRules(sourceCategory, targetCategory)).filter(Objects::nonNull).sorted().findFirst();
if (findFirst.isPresent() && findFirst.get() instanceof CategoryMatchQuality) {
bestCategory = ((CategoryMatchQuality<?>) findFirst.get()).getTargetCategory();
}
}
return bestCategory;
}
use of org.apache.commons.lang3.StringUtils.equalsIgnoreCase in project azure-tools-for-java by Microsoft.
the class CreateRedisCacheForm method getData.
private RedisConfig getData() {
RedisConfig redisConfig = new RedisConfig();
redisConfig.setSubscription(this.currentSub);
redisConfig.setRegion(Region.fromName(selectedLocationValue));
redisConfig.setResourceGroup(newResGrp ? new DraftResourceGroup(this.currentSub, selectedResGrpValue) : com.microsoft.azure.toolkit.lib.Azure.az(AzureGroup.class).get(this.currentSub.getId(), selectedResGrpValue));
redisConfig.setEnableNonSslPort(noSSLPort);
redisConfig.setPricingTier(PricingTier.values().stream().filter(pricingTier -> StringUtils.equalsIgnoreCase(pricingTier.toString(), selectedPriceTierValue)).findFirst().orElse(null));
redisConfig.setName(dnsNameValue);
return redisConfig;
}
use of org.apache.commons.lang3.StringUtils.equalsIgnoreCase in project azure-tools-for-java by Microsoft.
the class SqlServerPropertyView method showProperty.
// @Override
public void showProperty(SqlServerProperty property) {
SqlServerEntity entity = property.getServer().entity();
Subscription subscription = Azure.az(AzureAccount.class).account().getSubscription(entity.getSubscriptionId());
if (subscription != null) {
overview.getSubscriptionTextField().setText(subscription.getName());
}
databaseComboBox.setServer(property.getServer());
overview.getResourceGroupTextField().setText(entity.getResourceGroupName());
overview.getStatusTextField().setText(entity.getState());
overview.getLocationTextField().setText(entity.getRegion().getLabel());
overview.getSubscriptionIDTextField().setText(entity.getSubscriptionId());
overview.getServerNameTextField().setText(entity.getFullyQualifiedDomainName());
overview.getServerNameTextField().setCaretPosition(0);
overview.getServerAdminLoginNameTextField().setText(entity.getAdministratorLoginName() + "@" + entity.getName());
overview.getServerAdminLoginNameTextField().setCaretPosition(0);
overview.getVersionTextField().setText(entity.getVersion());
if ("Ready".equals(entity.getState())) {
List<FirewallRuleEntity> firewallRules = property.getFirewallRules();
originalAllowAccessToAzureServices = firewallRules.stream().anyMatch(e -> FirewallRuleEntity.ACCESS_FROM_AZURE_SERVICES_FIREWALL_RULE_NAME.equalsIgnoreCase(e.getName()));
connectionSecurity.getAllowAccessFromAzureServicesCheckBox().setSelected(originalAllowAccessToAzureServices);
originalAllowAccessToLocal = firewallRules.stream().anyMatch(e -> StringUtils.equalsIgnoreCase(FirewallRuleEntity.getAccessFromLocalFirewallRuleName(), e.getName()));
connectionSecurity.getAllowAccessFromLocalMachineCheckBox().setSelected(originalAllowAccessToLocal);
} else {
connectionSecuritySeparator.collapse();
connectionSecuritySeparator.setEnabled(false);
connectionStringsSeparator.collapse();
connectionStringsSeparator.setEnabled(false);
}
}
use of org.apache.commons.lang3.StringUtils.equalsIgnoreCase in project cas by apereo.
the class CasDocumentationApplication method main.
public static void main(final String[] args) throws Exception {
var options = new Options();
var dt = new Option("d", "data", true, "Data directory");
dt.setRequired(true);
options.addOption(dt);
var ver = new Option("v", "version", true, "Project version");
ver.setRequired(true);
options.addOption(ver);
var root = new Option("r", "root", true, "Project root directory");
root.setRequired(true);
options.addOption(root);
var ft = new Option("f", "filter", true, "Property filter pattern");
ft.setRequired(false);
options.addOption(ft);
var act = new Option("a", "actuators", true, "Generate data for actuator endpoints");
act.setRequired(false);
options.addOption(act);
var tp = new Option("tp", "thirdparty", true, "Generate data for third party");
tp.setRequired(false);
options.addOption(tp);
var sp = new Option("sp", "serviceproperties", true, "Generate data for registered services properties");
sp.setRequired(false);
options.addOption(sp);
var feats = new Option("ft", "features", true, "Generate data for feature toggles and descriptors");
feats.setRequired(false);
options.addOption(feats);
new HelpFormatter().printHelp("CAS Documentation", options);
var cmd = new DefaultParser().parse(options, args);
var dataDirectory = cmd.getOptionValue("data");
var projectVersion = cmd.getOptionValue("version");
var projectRootDirectory = cmd.getOptionValue("root");
var propertyFilter = cmd.getOptionValue("filter", ".+");
var results = CasConfigurationMetadataCatalog.query(ConfigurationMetadataCatalogQuery.builder().queryType(ConfigurationMetadataCatalogQuery.QueryTypes.CAS).queryFilter(property -> RegexUtils.find(propertyFilter, property.getName())).build());
var groups = new HashMap<String, Set<CasReferenceProperty>>();
results.properties().stream().filter(property -> StringUtils.isNotBlank(property.getModule())).peek(property -> {
var desc = cleanDescription(property);
property.setDescription(desc);
}).forEach(property -> {
if (groups.containsKey(property.getModule())) {
groups.get(property.getModule()).add(property);
} else {
var values = new TreeSet<CasReferenceProperty>();
values.add(property);
groups.put(property.getModule(), values);
}
});
var dataPath = new File(dataDirectory, projectVersion);
if (dataPath.exists()) {
FileUtils.deleteQuietly(dataPath);
}
dataPath.mkdirs();
groups.forEach((key, value) -> {
var destination = new File(dataPath, key);
destination.mkdirs();
var configFile = new File(destination, "config.yml");
CasConfigurationMetadataCatalog.export(configFile, value);
});
var thirdparty = cmd.getOptionValue("thirdparty", "true");
if (StringUtils.equalsIgnoreCase("true", thirdparty)) {
exportThirdPartyConfiguration(dataPath, propertyFilter);
}
var registeredServicesProps = cmd.getOptionValue("serviceproperties", "true");
if (StringUtils.equalsIgnoreCase("true", registeredServicesProps)) {
exportRegisteredServiceProperties(dataPath);
}
exportTemplateViews(projectRootDirectory, dataPath);
exportThemeProperties(projectRootDirectory, dataPath);
var actuators = cmd.getOptionValue("actuators", "true");
if (StringUtils.equalsIgnoreCase("true", actuators)) {
exportActuatorEndpoints(dataPath);
}
var features = cmd.getOptionValue("features", "true");
if (StringUtils.equalsIgnoreCase("true", features)) {
exportFeatureToggles(dataPath);
}
}
use of org.apache.commons.lang3.StringUtils.equalsIgnoreCase in project cas by apereo.
the class DefaultDelegatedClientAuthenticationWebflowManager method storeDelegatedClientAuthenticationRequest.
/**
* Store delegated client authentication request.
*
* @param webContext the web context
* @return the transient session ticket
* @throws Exception the exception
*/
protected TransientSessionTicket storeDelegatedClientAuthenticationRequest(final JEEContext webContext) throws Exception {
val properties = buildTicketProperties(webContext);
val originalService = configContext.getArgumentExtractor().extractService(webContext.getNativeRequest());
val service = configContext.getAuthenticationRequestServiceSelectionStrategies().resolveService(originalService);
properties.put(CasProtocolConstants.PARAMETER_SERVICE, originalService);
properties.put(CasProtocolConstants.PARAMETER_TARGET_SERVICE, service);
val registeredService = configContext.getServicesManager().findServiceBy(service);
webContext.getRequestParameter(RedirectionActionBuilder.ATTRIBUTE_FORCE_AUTHN).or(() -> Optional.of(Boolean.toString(RegisteredServiceProperties.DELEGATED_AUTHN_FORCE_AUTHN.isAssignedTo(registeredService)))).filter(value -> StringUtils.equalsIgnoreCase(value, "true")).ifPresent(attr -> properties.put(RedirectionActionBuilder.ATTRIBUTE_FORCE_AUTHN, true));
webContext.getRequestParameter(RedirectionActionBuilder.ATTRIBUTE_PASSIVE).or(() -> Optional.of(Boolean.toString(RegisteredServiceProperties.DELEGATED_AUTHN_PASSIVE_AUTHN.isAssignedTo(registeredService)))).filter(value -> StringUtils.equalsIgnoreCase(value, "true")).ifPresent(attr -> properties.put(RedirectionActionBuilder.ATTRIBUTE_PASSIVE, true));
val transientFactory = (TransientSessionTicketFactory) configContext.getTicketFactory().get(TransientSessionTicket.class);
val ticket = transientFactory.create(originalService, properties);
LOGGER.debug("Storing delegated authentication request ticket [{}] for service [{}] with properties [{}]", ticket.getId(), ticket.getService(), ticket.getProperties());
configContext.getCentralAuthenticationService().addTicket(ticket);
webContext.setRequestAttribute(PARAMETER_CLIENT_ID, ticket.getId());
if (properties.containsKey(RedirectionActionBuilder.ATTRIBUTE_FORCE_AUTHN)) {
webContext.setRequestAttribute(RedirectionActionBuilder.ATTRIBUTE_FORCE_AUTHN, true);
}
if (properties.containsKey(RedirectionActionBuilder.ATTRIBUTE_PASSIVE)) {
webContext.setRequestAttribute(RedirectionActionBuilder.ATTRIBUTE_PASSIVE, true);
}
return ticket;
}
Aggregations