List of usage examples for org.springframework.util MultiValueMap put
V put(K key, V value);
From source file:org.meruvian.yama.service.jpa.social.JpaSocialConnectionManager.java
@Override public MultiValueMap<String, Connection<?>> findAllConnections() { List<JpaSocialConnection> socialConnections = connectionRepository.findByUserIdOrderByRankAsc(userId); MultiValueMap<String, Connection<?>> connections = new LinkedMultiValueMap<String, Connection<?>>(); Set<String> registeredProviderIds = connectionFactoryLocator.registeredProviderIds(); for (String registeredProviderId : registeredProviderIds) { connections.put(registeredProviderId, Collections.<Connection<?>>emptyList()); }/*from www . j a v a2 s. c o m*/ for (SocialConnection uc : socialConnections) { Connection<?> connection = connectionMapper.mapRow(uc); String providerId = connection.getKey().getProviderId(); if (connections.get(providerId).size() == 0) { connections.put(providerId, new LinkedList<Connection<?>>()); } connections.add(providerId, connection); } return connections; }
From source file:com.lixiaocong.social.MyJdbcConnection.java
public MultiValueMap<String, Connection<?>> findAllConnections() { List<Connection<?>> resultList = jdbcTemplate.query( selectFromUserConnection() + " where userId = ? order by providerId, rank", connectionMapper, userId);/* w w w. j a v a2 s . com*/ MultiValueMap<String, Connection<?>> connections = new LinkedMultiValueMap<String, Connection<?>>(); Set<String> registeredProviderIds = connectionFactoryLocator.registeredProviderIds(); for (String registeredProviderId : registeredProviderIds) { connections.put(registeredProviderId, Collections.<Connection<?>>emptyList()); } for (Connection<?> connection : resultList) { String providerId = connection.getKey().getProviderId(); if (connections.get(providerId).size() == 0) { connections.put(providerId, new LinkedList<Connection<?>>()); } connections.add(providerId, connection); } return connections; }
From source file:com.jiwhiz.domain.account.impl.ConnectionRepositoryImpl.java
public MultiValueMap<String, Connection<?>> findAllConnections() { List<UserSocialConnection> userSocialConnectionList = userSocialConnectionRepository.findByUserId(userId); MultiValueMap<String, Connection<?>> connections = new LinkedMultiValueMap<String, Connection<?>>(); Set<String> registeredProviderIds = socialAuthenticationServiceLocator.registeredProviderIds(); for (String registeredProviderId : registeredProviderIds) { connections.put(registeredProviderId, Collections.<Connection<?>>emptyList()); }//from w w w . ja va2 s .c om for (UserSocialConnection userSocialConnection : userSocialConnectionList) { String providerId = userSocialConnection.getProviderId(); if (connections.get(providerId).size() == 0) { connections.put(providerId, new LinkedList<Connection<?>>()); } connections.add(providerId, buildConnection(userSocialConnection)); } return connections; }
From source file:com.jiwhiz.domain.account.impl.MongoConnectionRepositoryImpl.java
public MultiValueMap<String, Connection<?>> findAllConnections() { List<UserSocialConnection> userSocialConnectionList = this.userSocialConnectionRepository .findByUserId(userId);/* w w w .j av a2 s .co m*/ MultiValueMap<String, Connection<?>> connections = new LinkedMultiValueMap<String, Connection<?>>(); Set<String> registeredProviderIds = socialAuthenticationServiceLocator.registeredProviderIds(); for (String registeredProviderId : registeredProviderIds) { connections.put(registeredProviderId, Collections.<Connection<?>>emptyList()); } for (UserSocialConnection userSocialConnection : userSocialConnectionList) { String providerId = userSocialConnection.getProviderId(); if (connections.get(providerId).size() == 0) { connections.put(providerId, new LinkedList<Connection<?>>()); } connections.add(providerId, buildConnection(userSocialConnection)); } return connections; }
From source file:de.codecentric.boot.admin.zuul.filters.route.SimpleHostRoutingFilter.java
private MultiValueMap<String, String> revertHeaders(Header[] headers) { MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); for (Header header : headers) { String name = header.getName(); if (!map.containsKey(name)) { map.put(name, new ArrayList<String>()); }//from ww w .j a va 2s .co m map.get(name).add(header.getValue()); } return map; }
From source file:io.github.davejoyce.dao.composite.social.connect.jpa.JpaConnectionRepository.java
/** * {@inheritDoc}//from ww w . ja va 2s .com */ public MultiValueMap<String, Connection<?>> findAllConnections() { TypedQuery<AppUserSocialConnection> query = entityManager .createQuery(QUERY_FIND_ALL_CONNECTIONS, AppUserSocialConnection.class) .setParameter("userId", userId); List<Connection<?>> resultList = appUserSocialConnectionsToConnections(query.getResultList()); MultiValueMap<String, Connection<?>> connections = new LinkedMultiValueMap<String, Connection<?>>(); Set<String> registeredProviderIds = connectionFactoryLocator.registeredProviderIds(); for (String registeredProviderId : registeredProviderIds) { connections.put(registeredProviderId, Collections.<Connection<?>>emptyList()); } for (Connection<?> connection : resultList) { String providerId = connection.getKey().getProviderId(); if (connections.get(providerId).size() == 0) { connections.put(providerId, new LinkedList<Connection<?>>()); } connections.add(providerId, connection); } return connections; }
From source file:com.faujnet.mongo.repository.MongoConnectionRepository.java
/** * Find the connections the current user has to the given provider users. *//*from w ww . j av a2s . c o m*/ @Override public MultiValueMap<String, Connection<?>> findConnectionsToUsers( MultiValueMap<String, String> providerUsers) { if (providerUsers == null || providerUsers.isEmpty()) { throw new IllegalArgumentException("Unable to execute find: no providerUsers provided"); } List<Connection<?>> resultList = connService.getConnections(userId, providerUsers); MultiValueMap<String, Connection<?>> connectionsForUsers = new LinkedMultiValueMap<String, Connection<?>>(); for (Connection<?> connection : resultList) { String providerId = connection.getKey().getProviderId(); List<String> userIds = providerUsers.get(providerId); List<Connection<?>> connections = connectionsForUsers.get(providerId); if (connections == null) { connections = new ArrayList<Connection<?>>(userIds.size()); for (int i = 0; i < userIds.size(); i++) { connections.add(null); } connectionsForUsers.put(providerId, connections); } String providerUserId = connection.getKey().getProviderUserId(); int connectionIndex = userIds.indexOf(providerUserId); connections.set(connectionIndex, connection); } return connectionsForUsers; }
From source file:com.naver.template.social.connect.DaoConnectionRepository.java
public MultiValueMap<String, Connection<?>> findConnectionsToUsers( MultiValueMap<String, String> providerUsers) { if (providerUsers == null || providerUsers.isEmpty()) { throw new IllegalArgumentException("Unable to execute find: no providerUsers provided"); }/*ww w. ja v a 2s . com*/ // StringBuilder providerUsersCriteriaSql = new StringBuilder(); // MapSqlParameterSource parameters = new MapSqlParameterSource(); // parameters.addValue("userId", userId); // for (Iterator<Entry<String, List<String>>> it = providerUsers.entrySet().iterator(); it.hasNext();) { // Entry<String, List<String>> entry = it.next(); // String providerId = entry.getKey(); // providerUsersCriteriaSql.append("providerId = :providerId_").append(providerId).append(" and providerUserId in (:providerUserIds_").append(providerId).append(")"); // parameters.addValue("providerId_" + providerId, providerId); // parameters.addValue("providerUserIds_" + providerId, entry.getValue()); // if (it.hasNext()) { // providerUsersCriteriaSql.append(" or " ); // } // } //List<Connection<?>> resultList = new NamedParameterJdbcTemplate(jdbcTemplate).query(selectFromUserConnection() + " where userId = :userId and " + providerUsersCriteriaSql + " order by providerId, rank", parameters, connectionMapper); List<Connection<?>> resultList = userConnectionDAO.selectConnections(userId, providerUsers); MultiValueMap<String, Connection<?>> connectionsForUsers = new LinkedMultiValueMap<String, Connection<?>>(); for (Connection<?> connection : resultList) { String providerId = connection.getKey().getProviderId(); List<String> userIds = providerUsers.get(providerId); List<Connection<?>> connections = connectionsForUsers.get(providerId); if (connections == null) { connections = new ArrayList<Connection<?>>(userIds.size()); for (int i = 0; i < userIds.size(); i++) { connections.add(null); } connectionsForUsers.put(providerId, connections); } String providerUserId = connection.getKey().getProviderUserId(); int connectionIndex = userIds.indexOf(providerUserId); connections.set(connectionIndex, connection); } return connectionsForUsers; }
From source file:io.neba.core.mvc.MultipartSlingHttpServletRequest.java
@Override public MultiValueMap<String, MultipartFile> getMultiFileMap() { RequestParameterMap requestParameterMap = getRequestParameterMap(); MultiValueMap<String, MultipartFile> fileMap = new LinkedMultiValueMap<String, MultipartFile>( requestParameterMap.size()); for (Entry<String, RequestParameter[]> entry : requestParameterMap.entrySet()) { RequestParameter[] params = entry.getValue(); if (params != null && params.length > 0) { List<MultipartFile> files = new ArrayList<MultipartFile>(params.length); for (RequestParameter parameter : params) { if (!parameter.isFormField()) { files.add(new SlingMultipartFile(entry.getKey(), parameter)); }/*from w ww. j a v a2 s .c om*/ } if (!files.isEmpty()) { fileMap.put(entry.getKey(), files); } } } return fileMap; }
From source file:com.seajas.search.codex.social.connection.InMemoryConnectionRepository.java
@Override public MultiValueMap<String, Connection<?>> findConnectionsToUsers( final MultiValueMap<String, String> providerUsers) { if (providerUsers == null || providerUsers.isEmpty()) { throw new IllegalArgumentException("Unable to execute find: no providerUsers provided"); }/*w w w . j av a2s. c o m*/ Map<String, List<String>> providerUserIdsByProviderId = new HashMap<String, List<String>>(); for (Entry<String, List<String>> entry : providerUsers.entrySet()) { String providerId = entry.getKey(); providerUserIdsByProviderId.put(providerId, entry.getValue()); } List<ConnectionData> connectionDatas = new ArrayList<ConnectionData>(); for (Map.Entry<String, List<String>> entry : providerUserIdsByProviderId.entrySet()) { connectionDatas.addAll(getInMemoryProviderConnectionRepository(entry.getKey()) .findByProviderUserIdsOrderByProviderIdAndRank(entry.getValue())); } List<Connection<?>> resultList = createConnections(connectionDatas); MultiValueMap<String, Connection<?>> connectionsForUsers = new LinkedMultiValueMap<String, Connection<?>>(); for (Connection<?> connection : resultList) { String providerId = connection.getKey().getProviderId(); List<String> userIds = providerUsers.get(providerId); List<Connection<?>> connections = connectionsForUsers.get(providerId); if (connections == null) { connections = new ArrayList<Connection<?>>(userIds.size()); for (int i = 0; i < userIds.size(); i++) { connections.add(null); } connectionsForUsers.put(providerId, connections); } String providerUserId = connection.getKey().getProviderUserId(); int connectionIndex = userIds.indexOf(providerUserId); connections.set(connectionIndex, connection); } return connectionsForUsers; }