All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gs4tr.gcc.restclient.operation.DataStorePut Maven / Gradle / Ivy

Go to download

GlobalLink Connect Cloud java is a library to connect your system to GlobalLink Connect Cloud REST API.

There is a newer version: 3.1.3
Show newest version
package org.gs4tr.gcc.restclient.operation;

import java.util.HashMap;
import java.util.Map;

import org.gs4tr.gcc.restclient.GCConfig;
import org.gs4tr.gcc.restclient.dto.GCResponse;
import org.gs4tr.gcc.restclient.dto.MessageResponse;
import org.gs4tr.gcc.restclient.request.GCRequest;

public class DataStorePut extends GCOperation {

	private DataStorePutRequest request;

	public DataStorePut(GCConfig config, String key, Object value) {
		super(config);
		this.request = new DataStorePutRequest(key, value);
	}

	private static final String REQUEST_URL = "datastore/key";
	private static final String REQUEST_METHOD = "PUT";

	@Override
	public String getRequestMethod() {
		return REQUEST_METHOD;
	}

	@Override
	protected String getApiUrl() {
		return REQUEST_URL;
	}

	@Override
	public GCRequest getRequestObject() {
		return request;
	}

	public static class DataStorePutRequest extends GCRequest {
		private String key;
		private Object value;

		public DataStorePutRequest(String key, Object value) {
			this.key = key;
			this.value = value;
		}

		@Override
		public Map getParameters() {
			Map parameters = new HashMap();
			parameters.putAll(super.getParameters());
			parameters.put(key, value);
			return parameters;
		}
	}

	@Override
	public Class getResponseClass() {
		return MessageResponse.class;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy