List of usage examples for java.util Collections singletonList
public static <T> List<T> singletonList(T o)
From source file:ch.cyberduck.core.preferences.MemoryPreferences.java
@Override public List<String> systemLocales() { return Collections.singletonList("en"); }
From source file:com.mirth.connect.server.alert.action.UserProtocol.java
@Override public List<String> getEmailAddressesForDispatch(List<String> recipients) { try {// w w w. j a v a 2 s. c o m List<User> users = null; if (recipients.size() == 1) { users = Collections .singletonList(userController.getUser(Integer.parseInt(recipients.get(0)), null)); } else { users = userController.getAllUsers(); } List<String> emailAddresses = new ArrayList<>(); Set<String> userIds = new HashSet<>(recipients); for (User user : users) { if (userIds.contains(user.getId().toString()) && StringUtils.isNotBlank(user.getEmail())) { emailAddresses.add(user.getEmail()); } } return emailAddresses; } catch (Exception e) { logger.error("An error occurred while attempting to look up email addresses for users.", e); return null; } }
From source file:org.travis4j.model.json.JsonEntityFactory.java
@Override public List<User> createUserList(JsonResponse response) { return Collections.singletonList(createUser(response)); // FIXME }
From source file:com.orange.cepheus.broker.controller.NgsiRestController.java
@Override protected AppendContextElementResponse appendContextElement(String entityID, AppendContextElement appendContextElement) throws Exception { ContextElement contextElement = new ContextElement(); contextElement.setEntityId(new EntityId(entityID, "", false)); contextElement.setContextAttributeList(appendContextElement.getAttributeList()); UpdateContext updateContext = new UpdateContext(); updateContext.setContextElements(Collections.singletonList(contextElement)); updateContext.setUpdateAction(UpdateAction.APPEND); UpdateContextResponse updateContextResponse = ngsiController.updateContext(updateContext); // Transform an UpdateContextResponse to a AppendContextElementResponse... AppendContextElementResponse appendContextElementResponse = new AppendContextElementResponse(); if (updateContextResponse.getErrorCode() != null) { appendContextElementResponse.setErrorCode(updateContextResponse.getErrorCode()); } else {// w w w .j a v a 2s .c o m // There should be only one ContextElementResponse List<ContextAttributeResponse> attributeResponses = new LinkedList<>(); updateContextResponse.getContextElementResponses().forEach(response -> { appendContextElementResponse.setEntityId(response.getContextElement().getEntityId()); response.getContextElement().getContextAttributeList().forEach(contextAttribute -> { ContextAttributeResponse attributeResponse = new ContextAttributeResponse(); attributeResponse .setContextAttributeList(response.getContextElement().getContextAttributeList()); attributeResponse.setStatusCode(response.getStatusCode()); attributeResponses.add(attributeResponse); }); }); appendContextElementResponse.setContextAttributeResponses(attributeResponses); } return appendContextElementResponse; }
From source file:com.jaeksoft.searchlib.test.rest.CommonRestAPI.java
public WebClient client() { WebClient webClient = WebClient.create(IntegrationTest.SERVER_URL, Collections.singletonList(new JacksonJsonProvider())); WebClient.getConfig(webClient).getRequestContext().put("use.async.http.conduit", Boolean.TRUE); return webClient; }
From source file:devbury.dewey.hipchat.api.Api.java
@PostConstruct public void init() { authorization = "Bearer " + hipChatSettings.getApiToken(); restTemplate = new RestTemplate(); restTemplate.setInterceptors(Collections.singletonList(this)); }
From source file:com.cloudera.cdk.morphline.maxmind.GeoIPBuilder.java
@Override public Collection<String> getNames() { return Collections.singletonList("geoIP"); }
From source file:net.sf.jabref.importer.fileformat.BibTeXMLImporter.java
@Override public List<String> getExtensions() { return Collections.singletonList(".xml"); }
From source file:com.netflix.spinnaker.clouddriver.kubernetes.v2.security.KubernetesSelector.java
public static KubernetesSelector notEquals(String key, String value) { return new KubernetesSelector(Kind.NOT_EQUALS, key, Collections.singletonList(value)); }
From source file:HCEngine.java
@Override public ResponseEntity<String> submit(JCurlRequestOptions requestOptions) throws Exception { ResponseEntity<String> stringResponseEntity = null; try (CloseableHttpClient hc = createCloseableHttpClient()) { for (int i = 0; i < requestOptions.getCount(); i++) { final HttpHeaders headers = new HttpHeaders(); for (Map.Entry<String, String> e : requestOptions.getHeaderMap().entrySet()) { headers.put(e.getKey(), Collections.singletonList(e.getValue())); }//from www. j a v a 2 s . co m final HttpEntity<Void> requestEntity = new HttpEntity<>(headers); RestTemplate template = new RestTemplate(new HttpComponentsClientHttpRequestFactory(hc)); stringResponseEntity = template.exchange(requestOptions.getUrl(), HttpMethod.GET, requestEntity, String.class); System.out.println(stringResponseEntity.getBody()); } return stringResponseEntity; } }