E01Message.java 3.23 KB
package th.co.ais.ssbsrfc.instance;


public class E01Message {
	private String command;
	private String resultcode;
	private String description;
	private String name;
	private String id;
	private String objecttype;
	private String key0;
	private String key1;
	private String key2;
	private String key3;
	private String key4;
	private E01MessageData data;
	private String value;
	
	public E01Message(String command, String resultcode, String description, 
			String id, String objecttype, String key0, String key1, 
			String key2, String key3, String key4, E01MessageData data) {
		super();
		this.command = command;
		this.resultcode = resultcode;
		this.id = id;
		this.objecttype = objecttype;
		this.key0 = key0;
		this.key1 = key1;
		this.key2 = key2;
		this.key3 = key3;
		this.key4 = key4;
		this.data = data;
		this.description = description;
	}
	
	public E01Message(String command, String resultcode, String description, String name, long value) {
		this.command = command;
		this.resultcode = resultcode;
		this.description = description;
		this.name = name;
		this.value = "" + value;
	}

	public void setMode(String mode) {
		if (mode.equals("res_replace")) {
			this.objecttype = null;
			this.key0 = null;
			this.key1 = null;
			this.key2 = null;
			this.key3 = null;
			this.key4 = null;
			this.data = null;
		}
	}

	public String getCommand() {
		return command;
	}

	public void setCommand(String command) {
		this.command = command;
	}

	public String getResultcode() {
		return resultcode;
	}

	public void setResultcode(String resultcode) {
		this.resultcode = resultcode;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getObjecttype() {
		return objecttype;
	}

	public void setObjecttype(String objecttype) {
		this.objecttype = objecttype;
	}

	public String getKey0() {
		return key0;
	}

	public void setKey0(String key0) {
		this.key0 = key0;
	}

	public String getKey1() {
		return key1;
	}

	public void setKey1(String key1) {
		this.key1 = key1;
	}

	public String getKey2() {
		return key2;
	}

	public void setKey2(String key2) {
		this.key2 = key2;
	}

	public String getKey3() {
		return key3;
	}

	public void setKey3(String key3) {
		this.key3 = key3;
	}

	public String getKey4() {
		return key4;
	}

	public void setKey4(String key4) {
		this.key4 = key4;
	}

	public E01MessageData getData() {
		return data;
	}

	public void setData(E01MessageData data) {
		this.data = data;
	}
	
	public String getDataValue() {
		return this.data.getValue();
	}
	
	public void setDataValue(String value) {
		this.data.setValue(value);
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getValue() {
		return value;
	}

	public void setValue(long value) {
		this.value = "" + value;
	}
	
	public void setValue(String value) {
		this.value = value;
	}
}

class E01MessageData {
	private String value;

	public E01MessageData(String value) {
		super();
		this.value = value;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
}