List of usage examples for java.util Map values
Collection<V> values();
From source file:ee.ria.xroad.proxyui.WSDLParser.java
private static Collection<ServiceInfo> internalParseWSDL(String wsdlUrl) throws Exception { WSDLFactory wsdlFactory = WSDLFactory.newInstance("com.ibm.wsdl.factory.WSDLFactoryImpl"); WSDLReader wsdlReader = wsdlFactory.newWSDLReader(); wsdlReader.setFeature("javax.wsdl.importDocuments", false); wsdlReader.setFeature("com.ibm.wsdl.parseXMLSchemas", false); Definition definition = wsdlReader.readWSDL(new TrustAllSslCertsWsdlLocator(wsdlUrl)); Collection<Service> services = definition.getServices().values(); Map<String, ServiceInfo> result = new HashMap<>(); for (Service service : services) { for (Port port : (Collection<Port>) service.getPorts().values()) { if (!hasSoapOverHttpBinding(port)) { continue; }//from www . j a va 2 s. c o m String url = getUrl(port); for (BindingOperation operation : (List<BindingOperation>) port.getBinding() .getBindingOperations()) { String title = getChildValue("title", operation.getOperation().getDocumentationElement()); String version = getVersion(operation); result.put(operation.getName() + version, new ServiceInfo(operation.getName(), title, url, version)); } } } return result.values(); }
From source file:com.kixeye.chassis.transport.MetricsConfiguration.java
/*** * Initializes the health check registry * * @return health check registry bean/*from w w w . j av a2 s . c om*/ */ @Bean public HealthCheckRegistry healthCheckRegistry(ApplicationContext context) { final HealthCheckRegistry bean = new HealthCheckRegistry(); // auto-register beans implementing health checks Map<String, HealthCheck> healthChecks = context.getBeansOfType(HealthCheck.class); for (HealthCheck check : healthChecks.values()) { bean.register(check.getClass().getName(), check); } return bean; }
From source file:org.pentaho.aggdes.ui.UIMain.java
@SuppressWarnings("unchecked") public void start(ApplicationContext context) throws XulException { XulDomContainer container;// ww w.ja v a 2 s.c o m //check to see if they've specified an alternate resource bundle String bundleStr = configuration.getResourceBundle(); ResourceBundle bundle = null; if (bundleStr != null) { try { bundle = ResourceBundle.getBundle(bundleStr); } catch (MissingResourceException e) { logger.error("Could not load Resource Bundle: " + bundleStr); //$NON-NLS-1$ } } //Set the look and feel based on configuration setLAF(); if (bundle != null) { container = xulLoader.loadXul("org/pentaho/aggdes/ui/resources/mainFrame.xul", bundle); //$NON-NLS-1$ } else { container = xulLoader.loadXul("org/pentaho/aggdes/ui/resources/mainFrame.xul"); //$NON-NLS-1$ } //generically register all Spring-initialized XulEventHandlers Map handlerMap = context.getBeansOfType(XulEventHandler.class); for (Object handler : handlerMap.values()) { container.addEventHandler((XulEventHandler) handler); } xulRunner.addContainer(container); xulRunner.initialize(); xulRunner.start(); }
From source file:org.obiba.onyx.core.batch.JobTriggerListFactoryBean.java
@SuppressWarnings("unchecked") public Object getObject() throws Exception { if (jobTriggers == null) { jobTriggers = new ArrayList<Trigger>(); Map<String, Trigger> triggersInContext = applicationContext.getBeansOfType(Trigger.class); for (Trigger trigger : triggersInContext.values()) { if (!(trigger instanceof NullTrigger)) { jobTriggers.add(trigger); }/*from w w w. jav a2 s . c o m*/ } } return jobTriggers; }
From source file:com.chiorichan.util.WebFunc.java
@SuppressWarnings("unchecked") public static String createTable(Map<Object, Object> tableData, Collection<String> headerArray, String tableId, String altTableClass) {// w w w . j a v a 2 s . c o m if (tableId == null) tableId = ""; if (tableData == null) return ""; if (altTableClass == null || altTableClass.isEmpty()) altTableClass = "altrowstable"; StringBuilder sb = new StringBuilder(); int x = 0; sb.append("<table id=\"" + tableId + "\" class=\"" + altTableClass + "\">\n"); if (headerArray != null) { sb.append("<tr>\n"); for (String col : headerArray) sb.append("<th>" + col + "</th>\n"); sb.append("</tr>\n"); } int colLength = headerArray != null ? headerArray.size() : tableData.size(); for (Object row : tableData.values()) if (row instanceof Map) colLength = Math.max(((Map<String, Object>) row).size(), colLength); for (Object row : tableData.values()) { String clss = x % 2 == 0 ? "evenrowcolor" : "oddrowcolor"; x++; if (row instanceof Map || row instanceof Collection) { Map<Object, Object> map = Maps.newLinkedHashMap(); if (row instanceof Map) map = (Map<Object, Object>) row; else { int y = 0; for (Object o : (Collection<Object>) row) { map.put(Integer.toString(y), o); y++; } } sb.append("<tr"); for (Entry<Object, Object> e : map.entrySet()) try { if (ObjectFunc.castToStringWithException(e.getKey()).startsWith(":")) { map.remove(e.getKey()); sb.append(" " + ObjectFunc.castToStringWithException(e.getKey()).substring(1) + "=\"" + ObjectFunc.castToStringWithException(e.getValue()) + "\""); } } catch (ClassCastException ex) { ex.printStackTrace(); } sb.append(" class=\"" + clss + "\">\n"); if (map.size() == 1) sb.append("<td style=\"text-align: center; font-weight: bold;\" class=\"\" colspan=\"" + colLength + "\">" + map.get(0) + "</td>\n"); else { int cc = 0; for (Object col : map.values()) if (col != null) { String subclass = col instanceof String && ((String) col).isEmpty() ? " emptyCol" : ""; sb.append("<td id=\"col_" + cc + "\" class=\"" + subclass + "\">" + col + "</td>\n"); cc++; } } sb.append("</tr>\n"); } else if (row instanceof String) sb.append("<tr><td class=\"" + clss + "\" colspan=\"" + colLength + "\"><b><center>" + (String) row + "</b></center></td></tr>\n"); else sb.append("<tr><td class=\"" + clss + "\" colspan=\"" + colLength + "\"><b><center>" + row.toString() + "</b></center></td></tr>\n"); } sb.append("</table>\n"); return sb.toString(); }
From source file:ch.digitalfondue.npjt.QueryType.java
@SuppressWarnings("unchecked") private static <T> AffectedRowCountAndKey<T> executeUpdateAndKeepKeys(String template, Method method, NamedParameterJdbcTemplate jdbc, SqlParameterSource parameters) { Class<T> keyClass = (Class<T>) ((ParameterizedType) method.getGenericReturnType()) .getActualTypeArguments()[0]; KeyHolder keyHolder = new GeneratedKeyHolder(); int result = jdbc.update(template, parameters, keyHolder); Map<String, Object> keys = keyHolder.getKeys(); Object key;/*from w w w . j a v a 2 s . co m*/ if (keys.size() > 1) { AutoGeneratedKey spec = Objects.requireNonNull(method.getDeclaredAnnotation(AutoGeneratedKey.class), "more than one key for query " + template + ": annotation @AutoGeneratedKey required"); key = Objects.requireNonNull(keys.get(spec.value()), "the key with name " + spec.value() + " has returned null for query " + template + ": required a non null key"); } else if (Number.class.isAssignableFrom(keyClass)) { Class<? extends Number> c = (Class<? extends Number>) keyClass; return new AffectedRowCountAndKey<>(result, (T) NumberUtils.convertNumberToTargetClass(keyHolder.getKey(), c)); } else { key = keys.values().iterator().next(); } return new AffectedRowCountAndKey<>(result, keyClass.cast(key)); }
From source file:org.kee.ssf.service.sys.BrandService.java
/** * ???./*w w w. j a v a 2s . co m*/ */ private Specification<Brand> buildSpecification(Map<String, Object> searchParams) { Map<String, SearchFilter> filters = SearchFilter.parse(searchParams); Specification<Brand> spec = DynamicSpecifications.bySearchFilter(filters.values(), Brand.class); return spec; }
From source file:org.mitre.openid.connect.view.JWKSetView.java
@Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {//from w w w . j a v a2 s . c o m response.setContentType(MediaType.APPLICATION_JSON_VALUE); //BiMap<String, PublicKey> keyMap = (BiMap<String, PublicKey>) model.get("keys"); Map<String, JWK> keys = (Map<String, JWK>) model.get("keys"); JWKSet jwkSet = new JWKSet(new ArrayList<>(keys.values())); try { Writer out = response.getWriter(); out.write(jwkSet.toString()); } catch (IOException e) { logger.error("IOException in JWKSetView.java: ", e); } }
From source file:org.reallysqs.server.views.QueueListView.java
@SuppressWarnings("unchecked") @Override/*ww w .ja v a 2 s .co m*/ protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { response.setContentType("text/xml"); Map<String, Queue> queues = (Map<String, Queue>) model.get("queues"); Collection<Queue> queueList = queues.values(); ServletOutputStream outputStream = response.getOutputStream(); outputStream.print(prelude); for (Queue queue : queueList) { outputStream.print("<QueueUrl>"); outputStream.print("http://" + request.getLocalName() + ":" + request.getLocalPort() + request.getContextPath() + request.getServletPath() + "/queues/" + queue.getName()); outputStream.print("</QueueUrl>"); } outputStream.print(epilogue); }
From source file:com.smbtec.xo.tinkerpop.blueprints.impl.TinkerPopDatastore.java
@Override public void init(Map<Class<?>, TypeMetadata> registeredMetadata) { for (TypeMetadata typeMetadata : registeredMetadata.values()) { if (typeMetadata instanceof EntityTypeMetadata && graph.getFeatures().supportsKeyIndices) { @SuppressWarnings("unchecked") EntityTypeMetadata<VertexMetadata> entityTypeMetadata = (EntityTypeMetadata<VertexMetadata>) typeMetadata; for (MethodMetadata<?, ?> methodMetadata : entityTypeMetadata.getProperties()) { if (methodMetadata instanceof PrimitivePropertyMethodMetadata<?>) { @SuppressWarnings("unchecked") PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMetadata = (PrimitivePropertyMethodMetadata<PropertyMetadata>) methodMetadata; ensureIndex(entityTypeMetadata.getDatastoreMetadata().getDiscriminator(), propertyMetadata); }/*from www. j av a 2 s. c o m*/ } } } }