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;


/**
 * °²È«Ã±¸æ¾¯
 * @author Lenovo
 *
 */
public class SafetyHatAlarmHolder extends AmqBasisEvent {
	private String fsmkmc;
 	public SafetyHatAlarmHolder(){
		msgType=AmqConst.AMQ_MSG_safetyHatAlarm;
		fsmkmc = "";
	}
 	
	public String getFsmkmc() {
		return fsmkmc;
	}
	public void setFsmkmc(String fsmkmc) {
		this.fsmkmc = fsmkmc;
	}

	private List<SafetyHatAlarmPeas> list = new LinkedList<SafetyHatAlarmPeas>();
	
	public List<SafetyHatAlarmPeas> getList() {
		return list;
	}
	public void setList(List<SafetyHatAlarmPeas> list) {
		this.list = list;
	}
	public void writeObjToXml() {
 		super.writeObjToXml();
		Element fdListElement = outMsgTypeElement.addElement("liebiao");
		for (int i = 0; i < list.size(); i++) {
			SafetyHatAlarmPeas info = list.get(i);
			Element element = fdListElement.addElement("jiedian");
			this.addTextToElement(element, "gjxh", info.getGjxh());
			this.addTextToElement(element, "gjbh", info.getGjbh());
 			this.addTextToElement(element, "bjxxid", info.getBjxxid());
 			this.addTextToElement(element, "bjbh", info.getBjbh());
 			this.addTextToElement(element, "bjzwmc", info.getBjzwmc());
 			this.addTextToElement(element, "fxsbmc", info.getFxsbmc());
 			this.addTextToElement(element, "fxsbbh", info.getFxsbbh());
 			this.addTextToElement(element, "fxtdbh", info.getFxtdbh());
 			this.addTextToElement(element, "fxsbip", info.getFxsbip());
 			this.addTextToElement(element, "bjlx", info.getBjlx());
 			this.addTextToElement(element, "bjdj", info.getBjdj());
 			this.addTextToElement(element, "bjtplj", info.getBjtplj());
 			this.addTextToElement(element, "fwdsdksbjsj", info.getFwdsdksbjsj());
 			this.addTextToElement(element, "zt", info.getZt());
 		}
	}
	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++) {
			SafetyHatAlarmPeas info = new SafetyHatAlarmPeas();
 			Element element = (Element) nodeList.get(i);
 			info.setGjxh(this.readStringFromElement(element, "gjxh"));
 			info.setGjbh(this.readIntFromElement(element, "gjbh"));
 			info.setBjxxid(this.readStringFromElement(element, "bjxxid"));
 			info.setBjbh(this.readStringFromElement(element, "bjbh"));
 			info.setBjzwmc(this.readStringFromElement(element, "bjzwmc"));
 			info.setFxsbmc(this.readStringFromElement(element, "fxsbmc"));
 			info.setFxsbbh(this.readStringFromElement(element, "fxsbbh"));
 			info.setFxtdbh(this.readStringFromElement(element, "fxtdbh"));
 			info.setFxsbip(this.readStringFromElement(element, "fxsbip"));
 			info.setBjlx(this.readStringFromElement(element, "bjlx"));
 			info.setBjdj(this.readStringFromElement(element, "bjdj"));
 			info.setBjtplj(this.readStringFromElement(element, "bjtplj"));
 			info.setFwdsdksbjsj(this.readStringFromElement(element, "fwdsdksbjsj"));
 			info.setZt(this.readStringFromElement(element, "zt"));
 			list.add(info);
 		}
	}
}
