/**
 * 
 */
package com.smartdevicelink.proxy;

import java.util.Hashtable;

import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.util.CorrelationIdGenerator;

public class RPCRequest extends RPCMessage {

	protected OnRPCResponseListener onResponseListener;

	public RPCRequest(String functionName) {
		super(functionName, RPCMessage.KEY_REQUEST);
		messageType = RPCMessage.KEY_REQUEST;
	}

	/**
	 *<p>Constructs a newly allocated RPCRequest object using a RPCRequest object</p>
	 *@param rpcMsg The {@linkplain RPCMessage} to use
	 */
	public RPCRequest(RPCMessage rpcMsg) {
		super(preprocessMsg(rpcMsg));
	}

	public RPCRequest(Hashtable<String, Object> hash) {
		super(hash);
	}

	public RPCRequest(RPCRequest request){
		super(request);
		setCorrelationID(CorrelationIdGenerator.generateId());
	}

	static RPCMessage preprocessMsg (RPCMessage rpcMsg) {
		if (rpcMsg.getMessageType() != RPCMessage.KEY_REQUEST) {
			rpcMsg.messageType = RPCMessage.KEY_REQUEST;
		}

		return rpcMsg;
	}

	public Integer getCorrelationID() {
		//First we check to see if a correlation ID is set. If not, create one.
		if(!function.containsKey(RPCMessage.KEY_CORRELATION_ID)){
			setCorrelationID(CorrelationIdGenerator.generateId());
		}
		return (Integer)function.get(RPCMessage.KEY_CORRELATION_ID);
	}
	
	public void setCorrelationID(Integer correlationID) {
		if (correlationID != null) {
            function.put(RPCMessage.KEY_CORRELATION_ID, correlationID );
        } else {
        	function.remove(RPCMessage.KEY_CORRELATION_ID);
        }
	}
    public void setOnRPCResponseListener(OnRPCResponseListener listener){
    	onResponseListener = listener;
    }
    
    public OnRPCResponseListener getOnRPCResponseListener(){
    	return this.onResponseListener;
    }
}

@@ -454,623 +454,198 @@
 %0A%0D%0A%09
-/**%0D%0A%09 *%3Cp%3EConstructs a newly allocated RPCRequest object using a RPCRequest object%3C/p%3E%0D%0A%09 *@param rpcMsg The %7B@linkplain RPCMessage%7D to use%0D%0A%09 */%0D%0A%09public RPCRequest(RPCMessage rpcMsg) %7B%0D%0A%09%09super(preprocessMsg(rpcMsg));%0D%0A%09%7D%0D%0A%0D%0A%09public RPCRequest(Hashtable%3CString, Object%3E hash) %7B%0D%0A%09%09super(hash);%0D%0A%09%7D%0D%0A%0D%0A%09public RPCRequest(RPCRequest request)%7B%0D%0A%09%09super(request);%0D%0A%09%09setCorrelationID(CorrelationIdGenerator.generateId());%0D%0A%09%7D%0D%0A%0D%0A%09static RPCMessage preprocessMsg (RPCMessage rpcMsg) %7B%0D%0A%09%09if (rpcMsg.getMessageType() != RPCMessage.KEY_REQUEST) %7B%0D%0A%09%09%09rpcMsg.messageType = RPCMessage.KEY_REQUEST;%0D%0A%09%09%7D%0D%0A%0D%0A%09%09return rpcMsg
+public RPCRequest(Hashtable%3CString, Object%3E hash) %7B%0D%0A%09%09super(hash);%0D%0A%09%7D%0D%0A%0D%0A%09public RPCRequest(RPCRequest request)%7B%0D%0A%09%09super(request);%0D%0A%09%09setCorrelationID(CorrelationIdGenerator.generateId())
 ;%0D%0A%09

Remove unused code from RPCRequest.java