List of usage examples for org.springframework.util StringUtils commaDelimitedListToSet
public static Set<String> commaDelimitedListToSet(@Nullable String str)
From source file:org.cloudfoundry.identity.uaa.login.test.ProfileActiveUtils.java
private static boolean isTestEnabledInThisEnvironment(ProfileValueSource profileValueSource, IfProfileActive ifProfileActive, UnlessProfileActive unlessProfileActive) { if (ifProfileActive == null && unlessProfileActive == null) { return true; }/* ww w .ja v a 2s. c o m*/ List<String> blacklist = getBlacklist(unlessProfileActive); Set<String> activeProfiles = StringUtils .commaDelimitedListToSet(profileValueSource.get("spring.profiles.active")); boolean enabled = true; if (ifProfileActive != null && StringUtils.hasText(ifProfileActive.value())) { enabled = activeProfiles.contains(ifProfileActive.value()); } for (String profile : blacklist) { if (activeProfiles.contains(profile)) { enabled = false; continue; } } return enabled; }
From source file:org.eclipse.gemini.blueprint.test.internal.util.jar.ManifestUtils.java
/** * Determine the Import-Package value based on the Export-Package entries in * the jars given as Resources./*from w w w .j a va2 s . com*/ * @param resources * @return */ public static String[] determineImportPackages(Resource[] resources) { Set collection = new LinkedHashSet(); // for each resource for (int i = 0; i < resources.length; i++) { Resource resource = resources[i]; Manifest man = JarUtils.getManifest(resource); if (man != null) { // read the manifest // get the Export-Package Attributes attrs = man.getMainAttributes(); String exportedPackages = attrs.getValue(Constants.EXPORT_PACKAGE); // add it to the StringBuilder if (StringUtils.hasText(exportedPackages)) { collection.addAll(StringUtils.commaDelimitedListToSet(exportedPackages)); } } } // return the result as string String[] array = (String[]) collection.toArray(new String[collection.size()]); // clean whitespace just in case for (int i = 0; i < array.length; i++) { array[i] = StringUtils.trimWhitespace(array[i]); } return array; }
From source file:io.pivotal.poc.dispatcher.MessageDispatcherApplication.java
@Bean public MessageDispatcher messageDispatcher(BinderAwareChannelResolver resolver) { Set<String> requestHeadersToMap = StringUtils .commaDelimitedListToSet(headerMappingConfigurationProperties.getRequest()); return new MessageDispatcher(resolver, requestHeadersToMap); }
From source file:org.smf4j.spring.JmxExporterBeanDefinitionParser.java
@Override protected void doParse(Element element, ParserContext context, BeanDefinitionBuilder builder) { String tmp = element.getAttribute(AUTOPUBLISH_ATTR); if (StringUtils.hasLength(tmp)) { builder.addPropertyValue(AUTOPUBLISH_PROP, tmp); }//from w w w . j av a 2 s. com tmp = element.getAttribute(DEPENDSON_ATTR); if (StringUtils.hasLength(tmp)) { for (String id : StringUtils.commaDelimitedListToSet(tmp)) { builder.addDependsOn(id); } } else { builder.addDependsOn(RegistrarBeanDefinitionParser.MASTER_REGISTRAR_ID); } builder.setLazyInit(false); }
From source file:org.smf4j.spring.ResolveBeanDefinitionParser.java
@Override protected void doParse(Element element, ParserContext context, BeanDefinitionBuilder builder) { // The path path.to.node.accumulator to the accumulator we're looking // up./*w w w .j a va2 s . c om*/ String path = element.getAttribute(PATH_ATTR); if (!StringUtils.hasLength(path)) { context.getReaderContext().error("'resolve' elements must have a 'path' attribute.", element); } // Set the path builder.addPropertyValue(PATH_ATTR, path); // Make sure that spring knows we depend on the given beans, which are // probably <registrar> nodes. String dependsOn = element.getAttribute(DEPENDSON_ATTR); if (StringUtils.hasLength(dependsOn)) { for (String id : StringUtils.commaDelimitedListToSet(dependsOn)) { // Depend on the indicated registrar name builder.addDependsOn(id); } } else { // Depend on the default registrar name builder.addDependsOn(RegistrarBeanDefinitionParser.MASTER_REGISTRAR_ID); } }
From source file:com.epam.cme.storefront.util.CSRFHandlerInterceptor.java
protected boolean isCSRFExemptUrl(final String servletPath) { if (servletPath != null) { final String allowedUrlPatterns = Config.getParameter(CSRF_ALLOWED_URLS); final Set<String> allowedUrls = StringUtils.commaDelimitedListToSet(allowedUrlPatterns); for (final String pattern : allowedUrls) { if (servletPath.matches(pattern)) { return true; }//from ww w .j a va 2s. c om } } return false; }
From source file:com.acc.storefront.util.CSRFHandlerInterceptor.java
protected boolean isCSRFExemptUrl(final String servletPath) { if (servletPath != null) { final String allowedUrlPatterns = Config.getParameter(CSRF_ALLOWED_URLS); final Set<String> allowedUrls = StringUtils.commaDelimitedListToSet(allowedUrlPatterns); for (final String pattern : allowedUrls) { if (servletPath.matches(pattern)) { return true; }/* w ww.j a va2 s. c om*/ } } return false; }
From source file:net.prasenjit.auth.domain.Client.java
/** {@inheritDoc} */ @Override public Set<String> getScope() { return StringUtils.commaDelimitedListToSet(scopes); }
From source file:org.apigw.monitoring.web.controller.ActionsController.java
@RequestMapping("/auth") @ResponseStatus(HttpStatus.OK)/* www . ja va 2 s . c o m*/ public Actions getAllActions(@RequestParam(value = "user", required = false) String user) { log.debug("Listing actions for user: " + user); List<Action> actions = new ArrayList<Action>(); List<AuthEvent> authEvents = authEventRepository.findByUser(user); for (AuthEvent authEvent : authEvents) { Action action = new Action(); action.setClient(authEvent.getClient()); action.setUser(authEvent.getUser()); action.setService(authEvent.getEventType().toString()); action.setId(authEvent.getId().toString()); action.setMessage(authEvent.getMessage()); action.setScope(StringUtils.commaDelimitedListToSet(authEvent.getScopes())); if (authEvent.getRequestState() != null) { action.setState(authEvent.getRequestState().toString()); } else { action.setState(""); } action.setTimestamp(authEvent.getTimestamp()); action.setToken(authEvent.getToken()); actions.add(action); } return new Actions(actions); }
From source file:net.prasenjit.auth.domain.Client.java
/** {@inheritDoc} */ @Override public Set<String> getAuthorizedGrantTypes() { return StringUtils.commaDelimitedListToSet(grantTypes); }