Java tutorial
/******************************************************************************* * Copyright (c) 2015 Federal Institute for Risk Assessment (BfR), Germany * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * Department Biological Safety - BfR *******************************************************************************/ package de.bund.bfr.knime.pmm.common; import org.jdom2.Element; public class MdInfoXml implements PmmXmlElementConvertable { public static final String ELEMENT_MDINFO = "mdinfoxml"; public static final String ATT_ID = "ID"; public static final String ATT_NAME = "Name"; public static final String ATT_COMMENT = "Comment"; public static final String ATT_QUALITYSCORE = "QualityScore"; public static final String ATT_CHECKED = "Checked"; private Integer id; private String name; private String comment; private Integer qualityScore; private Boolean checked; public MdInfoXml(Integer id, String name, String comment, Integer qualityScore, Boolean checked) { this.id = id; this.name = name; this.comment = comment; this.qualityScore = qualityScore; this.checked = checked; } public MdInfoXml(Element el) { this(XmlHelper.getInt(el, ATT_ID), XmlHelper.getString(el, ATT_NAME), XmlHelper.getString(el, ATT_COMMENT), XmlHelper.getInt(el, ATT_QUALITYSCORE), XmlHelper.getBoolean(el, ATT_CHECKED)); } @Override public Element toXmlElement() { Element modelElement = new Element(ELEMENT_MDINFO); modelElement.setAttribute(ATT_ID, XmlHelper.getNonNull(id)); modelElement.setAttribute(ATT_NAME, XmlHelper.getNonNull(name)); modelElement.setAttribute(ATT_COMMENT, XmlHelper.getNonNull(comment)); modelElement.setAttribute(ATT_QUALITYSCORE, XmlHelper.getNonNull(qualityScore)); modelElement.setAttribute(ATT_CHECKED, XmlHelper.getNonNull(checked)); return modelElement; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public Integer getQualityScore() { return qualityScore; } public void setQualityScore(Integer qualityScore) { this.qualityScore = qualityScore; } public Boolean getChecked() { return checked; } public void setChecked(Boolean checked) { this.checked = checked; } }