Example usage for org.springframework.util LinkedMultiValueMap LinkedMultiValueMap

List of usage examples for org.springframework.util LinkedMultiValueMap LinkedMultiValueMap

Introduction

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

Prototype

public LinkedMultiValueMap() 

Source Link

Document

Create a new LinkedMultiValueMap that wraps a LinkedHashMap .

Usage

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

/**
 * Delete user verifier by its id.// w  w w.j a va 2s. c om
 *
 * @param userVerifierId the user verifier id
 */
public void deleteUserVerifier(String userVerifierId) throws Exception {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("userVerifierId", userVerifierId);
    restTemplate.postForLocation(restTemplate.getUrl() + "delUserVerifier", params);
}

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

/**
 * Deletes an SDK profile by its identifier.
 *
 * @param sdkProfile the sdk profile/*from  w  w w  .  ja  v  a 2 s.c  o  m*/
 */
public void deleteSdkProfile(SdkProfileDto sdkProfile) throws Exception {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("topicId", sdkProfile.getId());
    restTemplate.postForLocation(restTemplate.getUrl() + "deleteSdkProfile", params);
}

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

/**
 * Generates an SDK for the specified target platform from the SDK profile .
 *
 * @param sdkProfileId   the sdk profile id
 * @param targetPlatform the target platform
 *///from w  w  w.  j  a  v a2 s .  c  om
public void downloadSdk(String sdkProfileId, SdkPlatform targetPlatform, String destination) {
    FileResponseExtractor extractor = new FileResponseExtractor(new File(destination));
    MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
    parameters.add("sdkProfileId", sdkProfileId);
    parameters.add("targetPlatform", targetPlatform.toString());
    RequestCallback request = new DataRequestCallback<>(parameters);
    restTemplate.execute(restTemplate.getUrl() + "sdk", HttpMethod.POST, request, extractor);
}

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

/**
 * Generates an SDK for the specified target platform from specified SDK profile.
 *
 * @param sdkProfileId   the sdk profile id
 * @param targetPlatform the target platform
 *//*from   w w w .ja v a2s . c om*/
public FileData downloadSdk(String sdkProfileId, SdkPlatform targetPlatform) {
    FileDataResponseExtractor extractor = new FileDataResponseExtractor();
    MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
    parameters.add("sdkProfileId", sdkProfileId);
    parameters.add("targetPlatform", targetPlatform.toString());
    RequestCallback request = new DataRequestCallback<>(parameters);
    return restTemplate.execute(restTemplate.getUrl() + "sdk", HttpMethod.POST, request, extractor);
}

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

/**
 * Exports a CTL schema and all of its dependencies depending on the export method specified.
 *//*from  w w  w  .  j a  v  a 2  s . c om*/
public FileData downloadCtlSchemaByAppToken(CTLSchemaDto ctlSchemaDto, CTLSchemaExportMethod method,
        String appToken) {
    final FileDataResponseExtractor extractor = new FileDataResponseExtractor();
    MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
    parameters.add("fqn", ctlSchemaDto.getMetaInfo().getFqn());
    parameters.add("version", Integer.toString(ctlSchemaDto.getVersion()));
    if (ctlSchemaDto.getMetaInfo().getApplicationId() != null) {
        parameters.add("applicationToken", appToken);
    }
    parameters.add("method", method.name());
    RequestCallback request = new DataRequestCallback<>(parameters);
    return restTemplate.execute(restTemplate.getUrl() + "CTL/exportSchema", HttpMethod.POST, request,
            extractor);
}

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

public CTLSchemaDto saveCTLSchemaWithAppToken(String body, String tenantId, String applicationToken) {
    //CHECKSTYLE:ON
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("body", body);
    if (tenantId != null) {
        params.add("tenantId", tenantId);
    }//from   w ww  .  jav  a 2 s  . c om
    if (applicationToken != null) {
        params.add("applicationToken", applicationToken);
    }
    return restTemplate.postForObject(restTemplate.getUrl() + "CTL/saveSchema", params, CTLSchemaDto.class);
}

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

public void deleteCTLSchemaByFqnVersionTenantIdAndApplicationToken(String fqn, Integer version, String tenantId,
        String applicationToken) {
    //CHECKSTYLE:ON
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("fqn", fqn);
    params.add("version", version);
    if (tenantId != null) {
        params.add("tenantId", tenantId);
    }/*w  w w . j a  v  a  2  s .  c  o  m*/
    if (applicationToken != null) {
        params.add("applicationToken", applicationToken);
    }
    restTemplate.postForLocation(restTemplate.getUrl() + "CTL/deleteSchema", params);
}

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

/**
 * Promote existing CTL schema meta info from application to tenant scope
 *
 * @param applicationId the id of application where schema was created
 * @param fqn           the fqn of promoting CTL schema
 * @return CtlSchemaMetaInfoDto the promoted CTL schema meta info object.
 *//*from   w  w w.j  ava  2 s .c  o  m*/
public CtlSchemaMetaInfoDto promoteScopeToTenant(String applicationId, String fqn) {
    MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
    params.add("applicationId", applicationId);
    params.add("fqn", fqn);
    return restTemplate.postForObject(restTemplate.getUrl() + "CTL/promoteScopeToTenant", params,
            CtlSchemaMetaInfoDto.class);
}

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

/**
 * Provides security credentials, allowing an endpoint that uses them to
 * interact with the specified application.
 *
 * @param applicationToken the application token to allow interaction with
 * @param credentialsBody  the security credentials to save
 *//* w ww .  ja  v a2s.c o  m*/
public CredentialsDto provisionCredentials(String applicationToken, byte[] credentialsBody) {
    MultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
    parameters.add("applicationToken", applicationToken);
    parameters.add("credentialsBody", Base64Utils.encodeToString(credentialsBody));
    return this.restTemplate.postForObject(restTemplate.getUrl() + "provisionCredentials", parameters,
            CredentialsDto.class);
}

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

/**
 * Binds credentials to the specified server-side endpoint profile.
 *
 * @param applicationToken     the application token
 * @param credentialsId        the id of the credentials to bind
 * @param serverProfileVersion the server-side endpoint profile version
 * @param serverProfileBody    the server-side endpoint profile body
 */// w w  w  .ja  va2s .  c  o m
public void provisionRegistration(String applicationToken, String credentialsId, Integer serverProfileVersion,
        String serverProfileBody) {
    MultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
    parameters.add("applicationToken", applicationToken);
    parameters.add("credentialsId", credentialsId);
    parameters.add("serverProfileVersion", serverProfileVersion);
    parameters.add("serverProfileBody", serverProfileBody);
    this.restTemplate.postForLocation(restTemplate.getUrl() + "provisionRegistration", parameters);
}