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

com.jpattern.gwt.client.communication.ServerCallPutCommand Maven / Gradle / Ivy

There is a newer version: 2.45.7
Show newest version
package com.jpattern.gwt.client.communication;

import com.jpattern.gwt.client.command.ICommandResult;
import com.jpattern.gwt.client.logger.ILogger;
import com.jpattern.gwt.client.serializer.IObjectSerializer;
import com.jpattern.gwt.client.util.GenericWrapper;
import com.jpattern.shared.result.facade.ICommandFacadeResult;
import com.jpattern.shared.result.ErrorMessage;

/**
 * 
 * @author Francesco Cina'
 *
 * 06/mag/2011
 */
public class ServerCallPutCommand, Z> extends AServerCallCommand {

	private final StringBuffer url;
	private final GenericWrapper callResult;
	private final GenericWrapper dataInput;
	
	public ServerCallPutCommand(GenericWrapper dataInput, StringBuffer url, GenericWrapper callResult) {
		this.url = url;
		this.callResult = callResult;
		this.dataInput = dataInput;
	}

	@Override
	protected void exec(ICommandResult commandResult) {
		waitAsyncCallback();
		ILogger logger = getProvider().getLoggerService().getLogger(this.getClass());
		logger.debug("exec", "Start command execution");
		ServerCommandCallBack commandCallBack = new ServerCommandCallBack(commandResult, callResult);
		IObjectSerializer resultSerializer = getProvider().getSerializerService().getObjectSerializer(callResult.getWrappedClass());
		IObjectSerializer dataSerializer = getProvider().getSerializerService().getObjectSerializer(dataInput.getWrappedClass());
		AProxy proxy = getProvider().getServerCallService().put(resultSerializer, dataSerializer, commandCallBack, url.toString(), dataInput.getValue());
		try {
			proxy.call();
		} catch (Exception exception) {
			commandResult.getErrorMessages().add(new ErrorMessage("Exception on Put Server call", exception.getMessage()));
			logger.error("exec", "Exception on Put Server call", exception);
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy