List of usage examples for org.springframework.util StringUtils arrayToCommaDelimitedString
public static String arrayToCommaDelimitedString(@Nullable Object[] arr)
From source file:org.parancoe.web.util.ReloadableResourceBundleMessageSource.java
@Override public String toString() { return getClass().getName() + ": basenames=[" + StringUtils.arrayToCommaDelimitedString(this.basenames) + "]"; }
From source file:com.netflix.spinnaker.orca.pipelinetemplate.tasks.v2.UpdateV2PipelineTemplateTask.java
@SuppressWarnings("unchecked") @Override/* ww w . j a va2s. c o m*/ public TaskResult execute(Stage stage) { if (front50Service == null) { throw new UnsupportedOperationException( "Front50 is not enabled, no way to save pipeline templates. Fix this by setting front50.enabled: true"); } if (!stage.getContext().containsKey("pipelineTemplate")) { throw new IllegalArgumentException("Missing required task parameter (pipelineTemplate)"); } if (!(stage.getContext().get("pipelineTemplate") instanceof String) || !Base64.isBase64((String) stage.getContext().get("pipelineTemplate"))) { throw new IllegalArgumentException( "'pipelineTemplate' context key must be a base64-encoded string: Ensure you're on the most recent version of gate"); } List<String> missingParams = new ArrayList<>(); if (!stage.getContext().containsKey("id")) { missingParams.add("id"); } if (!stage.getContext().containsKey("pipelineTemplate")) { missingParams.add("pipelineTemplate"); } if (!missingParams.isEmpty()) { throw new IllegalArgumentException("Missing required task parameter (" + StringUtils.arrayToCommaDelimitedString(missingParams.toArray()) + ")"); } V2PipelineTemplate pipelineTemplate = stage.decodeBase64("/pipelineTemplate", V2PipelineTemplate.class, pipelineTemplateObjectMapper); validate(pipelineTemplate); // TODO(jacobkiefer): move this to an update call to front50. Response response = front50Service.updateV2PipelineTemplate((String) stage.getContext().get("id"), (Map<String, Object>) stage.decodeBase64("/pipelineTemplate", Map.class)); Map<String, Object> outputs = new HashMap<>(); outputs.put("notification.type", "updatepipelinetemplate"); outputs.put("pipelineTemplate.id", pipelineTemplate.getId()); if (response.getStatus() == HttpStatus.OK.value()) { return new TaskResult(ExecutionStatus.SUCCEEDED, outputs); } return new TaskResult(ExecutionStatus.TERMINAL, outputs); }
From source file:com.test.utils.Dummy.java
/** * Set the Tiles definitions, i.e. the list of files containing the definitions. * Default is "/WEB-INF/tiles.xml"./*from w w w .j a va2 s . com*/ */ public void setDefinitions(String[] definitions) { if (definitions != null) { String defs = StringUtils.arrayToCommaDelimitedString(definitions); if (logger.isInfoEnabled()) { logger.info("TilesConfigurer: adding definitions [" + defs + "]"); } this.tilesPropertyMap.put(BasicTilesContainer.DEFINITIONS_CONFIG, defs); } }
From source file:com.xchanging.support.batch.admin.service.SimpleJobServiceFactoryBean.java
public void afterPropertiesSet() throws Exception { Assert.notNull(dataSource, "DataSource must not be null."); Assert.notNull(jobRepository, "JobRepository must not be null."); Assert.notNull(jobLocator, "JobLocator must not be null."); Assert.notNull(jobLauncher, "JobLauncher must not be null."); jdbcTemplate = new SimpleJdbcTemplate(dataSource); if (incrementerFactory == null) { incrementerFactory = new DefaultDataFieldMaxValueIncrementerFactory(dataSource); }//from w ww . j a va2 s. c o m if (databaseType == null) { databaseType = DatabaseType.fromMetaData(dataSource).name(); logger.info("No database type set, using meta data indicating: " + databaseType); } if (lobHandler == null) { lobHandler = new DefaultLobHandler(); } Assert.isTrue(incrementerFactory.isSupportedIncrementerType(databaseType), "'" + databaseType + "' is an unsupported database type. The supported database types are " + StringUtils.arrayToCommaDelimitedString(incrementerFactory.getSupportedIncrementerTypes())); }
From source file:it.smartcommunitylab.aac.apimanager.APIProviderManager.java
/** * @return */ private String defaultGrantTypes() { return StringUtils.arrayToCommaDelimitedString(GRANT_TYPES); }
From source file:it.smartcommunitylab.aac.controller.AuthController.java
/** * Redirect to the login type selection page. * /*from w ww. j a v a 2s. c om*/ * @param req * @return * @throws Exception */ @RequestMapping("/login") public ModelAndView login(HttpServletRequest req, HttpServletResponse res) throws Exception { Map<String, Object> model = new HashMap<String, Object>(); Map<String, String> authorities = attributesAdapter.getWebAuthorityUrls(); SavedRequest savedRequest = requestCache.getRequest(req, res); String target = savedRequest != null ? savedRequest.getRedirectUrl() : prepareRedirect(req, "/dev"); req.getSession().setAttribute("redirect", target); Map<String, String> resultAuthorities = authorities; // If original request has client_id parameter, reduce the authorities to the ones of the client app if (savedRequest != null) { String[] clientIds = savedRequest.getParameterValues(OAuth2Utils.CLIENT_ID); if (clientIds != null && clientIds.length > 0) { String clientId = clientIds[0]; Set<String> idps = clientDetailsAdapter.getIdentityProviders(clientId); String[] loginAuthoritiesParam = savedRequest.getParameterValues("authorities"); String loginAuthorities = ""; if (loginAuthoritiesParam != null && loginAuthoritiesParam.length > 0) { loginAuthorities = StringUtils.arrayToCommaDelimitedString(loginAuthoritiesParam); } Set<String> all = null; if (StringUtils.hasText(loginAuthorities)) { all = new HashSet<String>(Arrays.asList(loginAuthorities.split(","))); } else { all = new HashSet<String>(authorities.keySet()); } resultAuthorities = new HashMap<String, String>(); for (String idp : all) { if (authorities.containsKey(idp) && idps.contains(idp)) resultAuthorities.put(idp, authorities.get(idp)); } if (resultAuthorities.isEmpty()) { model.put("message", "No Identity Providers assigned to the app"); return new ModelAndView("oauth_error", model); } req.getSession().setAttribute(OAuth2Utils.CLIENT_ID, clientId); if (resultAuthorities.size() == 1 && !resultAuthorities.containsKey(Config.IDP_INTERNAL)) { return new ModelAndView( "redirect:" + Utils.filterRedirectURL(resultAuthorities.keySet().iterator().next())); } } } req.getSession().setAttribute("authorities", resultAuthorities); return new ModelAndView("login", model); }
From source file:org.apache.cloud.rdf.web.sail.RdfController.java
@RequestMapping(value = "/queryrdf", method = { RequestMethod.GET, RequestMethod.POST }) public void queryRdf(@RequestParam("query") final String query, @RequestParam(value = RdfCloudTripleStoreConfiguration.CONF_QUERY_AUTH, required = false) String auth, @RequestParam(value = RdfCloudTripleStoreConfiguration.CONF_CV, required = false) final String vis, @RequestParam(value = RdfCloudTripleStoreConfiguration.CONF_INFER, required = false) final String infer, @RequestParam(value = "nullout", required = false) final String nullout, @RequestParam(value = RdfCloudTripleStoreConfiguration.CONF_RESULT_FORMAT, required = false) final String emit, @RequestParam(value = "padding", required = false) final String padding, @RequestParam(value = "callback", required = false) final String callback, final HttpServletRequest request, final HttpServletResponse response) { // WARNING: if you add to the above request variables, // Be sure to validate and encode since they come from the outside and could contain odd damaging character sequences. SailRepositoryConnection conn = null; final Thread queryThread = Thread.currentThread(); auth = StringUtils.arrayToCommaDelimitedString(provider.getUserAuths(request)); final Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override//from www . j a va2s.c o m public void run() { log.debug("interrupting"); queryThread.interrupt(); } }, QUERY_TIME_OUT_SECONDS * 1000); try { final ServletOutputStream os = response.getOutputStream(); conn = repository.getConnection(); final Boolean isBlankQuery = StringUtils.isEmpty(query); final ParsedOperation operation = QueryParserUtil.parseOperation(QueryLanguage.SPARQL, query, null); final Boolean requestedCallback = !StringUtils.isEmpty(callback); final Boolean requestedFormat = !StringUtils.isEmpty(emit); if (!isBlankQuery) { if (operation instanceof ParsedGraphQuery) { // Perform Graph Query final RDFHandler handler = new RDFXMLWriter(os); response.setContentType("text/xml"); performGraphQuery(query, conn, auth, infer, nullout, handler); } else if (operation instanceof ParsedTupleQuery) { // Perform Tuple Query TupleQueryResultHandler handler; if (requestedFormat && emit.equalsIgnoreCase("json")) { handler = new SPARQLResultsJSONWriter(os); response.setContentType("application/json"); } else { handler = new SPARQLResultsXMLWriter(os); response.setContentType("text/xml"); } performQuery(query, conn, auth, infer, nullout, handler); } else if (operation instanceof ParsedUpdate) { // Perform Update Query performUpdate(query, conn, os, infer, vis); } else { throw new MalformedQueryException("Cannot process query. Query type not supported."); } } if (requestedCallback) { os.print(")"); } } catch (final Exception e) { log.error("Error running query", e); throw new RuntimeException(e); } finally { if (conn != null) { try { conn.close(); } catch (final RepositoryException e) { log.error("Error closing connection", e); } } } timer.cancel(); }
From source file:org.cloudfoundry.identity.uaa.client.ClientAdminBootstrap.java
private String getRedirectUris(Map<String, Object> map) { Set<String> redirectUris = new HashSet<>(); if (map.get("redirect-uri") != null) { redirectUris.add((String) map.get("redirect-uri")); }/*www . ja v a 2s . co m*/ if (map.get("signup_redirect_url") != null) { redirectUris.add((String) map.get("signup_redirect_url")); } if (map.get("change_email_redirect_url") != null) { redirectUris.add((String) map.get("change_email_redirect_url")); } return StringUtils.arrayToCommaDelimitedString(redirectUris.toArray(new String[] {})); }
From source file:org.esupportail.commons.batch.WebApplicationEnvironment.java
/** * Load context locations.//from ww w .ja v a 2 s . c om * @param locations : new String[]{ "classpath:properties/applicationContext.xml" } for example * @return the ApplicationContext loaded * @throws Exception */ @SuppressWarnings("unchecked") public ConfigurableApplicationContext loadContextLocations(final String[] locations) throws Exception { if (log.isInfoEnabled()) { log.info("Loading web application context for: " + StringUtils.arrayToCommaDelimitedString(locations)); } XmlWebApplicationContext ctx = new XmlWebApplicationContext(); ctx.setConfigLocations(locations); ctx.setServletContext(context); ctx.refresh(); MockExternalContext externalContext = (MockExternalContext) facesContext.getExternalContext(); Map applicationMap = new HashMap(); applicationMap.put(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ctx); externalContext.setApplicationMap(applicationMap); context.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ctx); ContextUtils.bindRequestAndContext(request, context); return ctx; }