Example usage for org.springframework.util MultiValueMap add

List of usage examples for org.springframework.util MultiValueMap add

Introduction

In this page you can find the example usage for org.springframework.util MultiValueMap add.

Prototype

void add(K key, @Nullable V value);

Source Link

Document

Add the given single value to the current list of values for the given key.

Usage

From source file:org.kaaproject.kaa.server.common.admin.AdminClient.java

/**
 * Update server profile of endpoint./* w  w w  .  ja  va2s.com*/
 *
 * @param endpointProfileKey the endpoint profile key
 * @param version            the version
 * @param serverProfileBody  the server profile body
 */
public EndpointProfileDto updateServerProfile(String endpointProfileKey, int version, String serverProfileBody)
        throws Exception {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("endpointProfileKey", endpointProfileKey);
    params.add("version", version);
    params.add("serverProfileBody", serverProfileBody);
    return restTemplate.postForObject(restTemplate.getUrl() + "updateServerProfile", params,
            EndpointProfileDto.class);
}

From source file:org.kaaproject.kaa.server.common.admin.AdminClient.java

/**
 * Creates the kaa admin with specific name and password.
 *
 * @param username admin's name/* ww w.  j a  v a2 s .c o m*/
 * @param password admin's password
 */
public void createKaaAdmin(String username, String password) throws Exception {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.add("username", username);
    params.add("password", password);
    restTemplate.postForObject(restTemplate.getUrl() + "auth/createKaaAdmin", params, Void.class);
}

From source file:org.kaaproject.kaa.server.common.admin.AdminClient.java

/**
 * Change password of user.//from  w  ww .  j a  v  a2s.c  o m
 *
 * @param username    the user name
 * @param oldPassword the old password
 * @param newPassword the new password
 * @return the result code
 * @throws Exception the exception
 */
public ResultCode changePassword(String username, String oldPassword, String newPassword) throws Exception {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.add("username", username);
    params.add("oldPassword", oldPassword);
    params.add("newPassword", newPassword);
    return restTemplate.postForObject(restTemplate.getUrl() + "auth/changePassword", params, ResultCode.class);
}

From source file:org.kaaproject.kaa.server.common.admin.AdminClient.java

/**
 * Adds the topic with specific id to endpoint group with specific id.
 *
 * @param endpointGroupId the endpoint group id
 * @param topicId         the topic id//  www.  ja  v a2  s  .  c o m
 */
public void addTopicToEndpointGroup(String endpointGroupId, String topicId) throws Exception {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("endpointGroupId", endpointGroupId);
    params.add("topicId", topicId);
    restTemplate.postForObject(restTemplate.getUrl() + "addTopicToEpGroup", params, Void.class);
}

From source file:org.kaaproject.kaa.server.common.admin.AdminClient.java

/**
 * Removes the topic with specific id to endpoint group with specific id.
 *
 * @param endpointGroupId the endpoint group id
 * @param topicId         the topic id/*from  ww  w.  j  a v  a 2 s.  c  o m*/
 */
public void removeTopicFromEndpointGroup(String endpointGroupId, String topicId) throws Exception {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("endpointGroupId", endpointGroupId);
    params.add("topicId", topicId);
    restTemplate.postForObject(restTemplate.getUrl() + "removeTopicFromEpGroup", params, Void.class);
}

From source file:org.kaaproject.kaa.server.common.admin.AdminClient.java

/**
 * Remove the endpoint with specific profile key.
 *
 * @param endpointProfileKeyHash the endpoint profile key hash
 *//*from www.j av  a  2s .  c om*/
public void removeEndpointProfileByKeyHash(String endpointProfileKeyHash) throws Exception {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("endpointProfileKeyHash", endpointProfileKeyHash);
    restTemplate.postForObject(restTemplate.getUrl() + "removeEndpointProfileByKeyHash", params, Void.class);
}

From source file:org.kaaproject.kaa.server.common.admin.AdminClient.java

private NotificationDto sendNotification(NotificationDto notification, ByteArrayResource resource)
        throws Exception {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("notification", notification);
    params.add("file", resource);
    return restTemplate.postForObject(restTemplate.getUrl() + "sendNotification", params,
            NotificationDto.class);
}

From source file:org.kaaproject.kaa.server.common.admin.AdminClient.java

private EndpointNotificationDto sendUnicastNotification(NotificationDto notification, String clientKeyHash,
        ByteArrayResource resource) throws Exception {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("notification", notification);
    params.add("endpointKeyHash", clientKeyHash);
    params.add("file", resource);
    return restTemplate.postForObject(restTemplate.getUrl() + "sendUnicastNotification", params,
            EndpointNotificationDto.class);
}

From source file:org.kaaproject.kaa.server.common.admin.AdminClient.java

/**
 * Send unicast notification to the client identified by endpointKeyHash.
 *
 * @param notification  the notification
 * @param clientKeyHash the client key hash
 * @param notificationMessage   the body of notification
 * @return the endpoint notification dto
 *//*from  ww w  .  j  a va  2s  . c o m*/
public EndpointNotificationDto sendUnicastNotificationSimplified(NotificationDto notification,
        String clientKeyHash, String notificationMessage) throws Exception {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("notification", notification);
    params.add("endpointKeyHash", clientKeyHash);
    params.add("file", getStringResource("notification", notificationMessage));
    return restTemplate.postForObject(restTemplate.getUrl() + "sendUnicastNotification", params,
            EndpointNotificationDto.class);
}

From source file:org.kaaproject.kaa.server.common.admin.AdminClient.java

/**
 * Delete topic by its id.// w w  w  .j  a v  a  2s  . c  o  m
 *
 * @param topicId the topic id
 */
public void deleteTopic(String topicId) throws Exception {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("topicId", topicId);
    restTemplate.postForLocation(restTemplate.getUrl() + "delTopic", params);
}