List<String> annotationTypes = new ArrayList<>(attributesMap.keySet()); Collections.reverse(annotationTypes);
@SuppressWarnings("rawtypes") public void receive(LinkedMultiValueMap<String, Object> multipartRequest){ logger.info("Successfully received multipart request: " + multipartRequest); for (String elementName : multipartRequest.keySet()) { if (elementName.equals("company")){ LinkedList value = (LinkedList)multipartRequest.get("company"); String[] multiValues = (String[]) value.get(0); for (String companyName : multiValues) { logger.info(elementName + " - " + companyName); } } else if (elementName.equals("company-logo")){ logger.info(elementName + " - as UploadedMultipartFile: " + ((UploadedMultipartFile) multipartRequest.getFirst("company-logo")).getOriginalFilename()); } } } }
List<String> annotationTypes = new ArrayList<>(attributesMap.keySet()); Collections.reverse(annotationTypes);
public void heartbeat() { LinkedMultiValueMap<String, ElasticAgentMetadata> elasticAgentsOfMissingPlugins = agentService.allElasticAgents(); // pingMessage TTL is set lesser than elasticPluginHeartBeatInterval to ensure there aren't multiple ping request for the same plugin long pingMessageTimeToLive = elasticPluginHeartBeatInterval - 10000L; for (PluginDescriptor descriptor : elasticAgentPluginRegistry.getPlugins()) { serverPingQueue.post(new ServerPingMessage(descriptor.id()), pingMessageTimeToLive); elasticAgentsOfMissingPlugins.remove(descriptor.id()); serverHealthService.removeByScope(scope(descriptor.id())); } if (!elasticAgentsOfMissingPlugins.isEmpty()) { for (String pluginId : elasticAgentsOfMissingPlugins.keySet()) { Collection<String> uuids = elasticAgentsOfMissingPlugins.get(pluginId).stream().map(ElasticAgentMetadata::uuid).collect(Collectors.toList()); String description = String.format("Elastic agent plugin with identifier %s has gone missing, but left behind %s agent(s) with UUIDs %s.", pluginId, elasticAgentsOfMissingPlugins.get(pluginId).size(), uuids); serverHealthService.update(ServerHealthState.warning("Elastic agents with no matching plugins", description, HealthStateType.general(scope(pluginId)))); LOGGER.warn(description); } } }
@SuppressWarnings("unchecked") private LinkedHashMap<String, Object> convertToSingleValueMap(LinkedMultiValueMap<String, String> map) { LinkedHashMap<String, Object> result = new LinkedHashMap<>(); for (String key : map.keySet()) { for (String v : map.get(key)) { Object value = v; if (key.endsWith("__is_null")) { key = key.substring(0, key.indexOf("__is_null")); value = null; } if (result.containsKey(key)) { Object current = result.get(key); if (current.getClass().isArray()) { ((ArrayList<Object>) current).add(value); } else { ArrayList<Object> arr = new ArrayList<>(); arr.add(current); arr.add(v); value = arr; } } result.put(key, value); } } return result; }
List<String> annotationTypes = new ArrayList<>(attributesMap.keySet()); Collections.reverse(annotationTypes);
List<String> annotationTypes = new ArrayList<>(attributesMap.keySet()); Collections.reverse(annotationTypes);