package cn.amq.peas;

import java.util.LinkedList;
import java.util.List;
import org.dom4j.Element;
import org.dom4j.Node;
import cn.amq.basis.AmqBasisEvent;
import cn.amq.basis.AmqConst;
//[预置点定义通知_holder]
public class XdPtzDefinedHolder extends AmqBasisEvent {
	private String fsmkmc;
	private List<XdPtzDefinedPeas> list = new LinkedList<XdPtzDefinedPeas>();
	public XdPtzDefinedHolder() {
		msgType = AmqConst.AMQ_MSG_xdPtzDefined;
		fsmkmc = "";
	}
	public String getFsmkmc() {
		return fsmkmc;
	}
	public void setFsmkmc(String fsmkmc) {
		this.fsmkmc = fsmkmc;
	}
	public List<XdPtzDefinedPeas> getList() {
		return list;
	}
	public void setList(List<XdPtzDefinedPeas> list) {
		this.list = list;
	}
	public void writeObjToXml() {
		super.writeObjToXml();
		Element fdListElement = outMsgTypeElement.addElement("liebiao");
		for (int i = 0; i < list.size(); i++) {
			XdPtzDefinedPeas info = list.get(i);
			Element element = fdListElement.addElement("jiedian");
 			this.addTextToElement(element, "gjxh", info.getGjxh());//[告警序号]
 			this.addTextToElement(element, "gjbh", info.getGjbh());//[告警编号]
 			this.addTextToElement(element, "gjsj", info.getGjsj());//[告警时间]
 			this.addTextToElement(element, "sbbh", info.getSbbh());//[设备编号]
 			this.addTextToElement(element, "tdbh", info.getTdbh());//[通道编号]
 			this.addTextToElement(element, "yzdbh", info.getYzdbh());//[预置点编号]
 			this.addTextToElement(element, "zt", info.getZt());//[状态；10：增加，11：修改，12：删除]
 		}
	}
	public void readTextToObject(String text) throws Exception {
		super.readTextToObject(text);
		Node node = this.inDocument.selectSingleNode("/amq/fsmkmc");
		fsmkmc = this.readStringByFullPath("/amq/fsmkmc");
		List nodeList = this.inDocument.selectNodes("/amq/liebiao/jiedian");
		for (int i = 0; i < nodeList.size(); i++) {
 			XdPtzDefinedPeas info = new XdPtzDefinedPeas();
 			Element element = (Element) nodeList.get(i);
 			info.setGjxh(this.readStringFromElement(element, "gjxh"));//[告警序号]
 			info.setGjbh(this.readIntFromElement(element, "gjbh"));//[告警编号]
 			info.setGjsj(this.readStringFromElement(element, "gjsj"));//[告警时间]
 			info.setSbbh(this.readStringFromElement(element, "sbbh"));//[设备编号]
 			info.setTdbh(this.readIntFromElement(element, "tdbh"));//[通道编号]
 			info.setYzdbh(this.readIntFromElement(element, "yzdbh"));//[预置点编号]
 			info.setZt(this.readIntFromElement(element, "zt"));//[状态；10：增加，11：修改，12：删除]
 			list.add(info);
 		}
	}
}
