01: /* CVS ID: $Id: XMLAdminModel.java,v 1.1.1.1 2002/10/02 18:42:54 wastl Exp $ */
02: package net.wastl.webmail.xml;
03:
04: import java.util.*;
05:
06: import org.w3c.dom.*;
07:
08: import net.wastl.webmail.server.*;
09:
10: import javax.xml.parsers.ParserConfigurationException;
11:
12: /*
13: * XMLAdminModel.java
14: *
15: * Created: Thu May 18 14:48:21 2000
16: *
17: * Copyright (C) 2000 Sebastian Schaffert
18: *
19: * This program is free software; you can redistribute it and/or
20: * modify it under the terms of the GNU General Public License
21: * as published by the Free Software Foundation; either version 2
22: * of the License, or (at your option) any later version.
23: *
24: * This program is distributed in the hope that it will be useful,
25: * but WITHOUT ANY WARRANTY; without even the implied warranty of
26: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27: * GNU General Public License for more details.
28: *
29: * You should have received a copy of the GNU General Public License
30: * along with this program; if not, write to the Free Software
31: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32: *
33: */
34:
35: /**
36: * Used to represent an Admin's state model
37: *
38: * @author Sebastian Schaffert
39: * @version
40: */
41:
42: public class XMLAdminModel extends XMLGenericModel {
43:
44: public XMLAdminModel(WebMailServer parent, Element rsysdata)
45: throws ParserConfigurationException {
46: super (parent, rsysdata);
47: }
48:
49: public synchronized Element addStateElement(String tag) {
50: Element elem = root.createElement(tag);
51: statedata.appendChild(elem);
52: return elem;
53: }
54:
55: public synchronized Element createElement(String tag) {
56: return root.createElement(tag);
57: }
58:
59: public synchronized Element createTextElement(String tag,
60: String value) {
61: Element elem = root.createElement(tag);
62: XMLCommon.setElementTextValue(elem, value);
63: return elem;
64: }
65:
66: public synchronized void importUserData(Element userdata) {
67: XMLCommon.genericRemoveAll(statedata, "USERDATA");
68: statedata.appendChild(root.importNode(userdata, true));
69: }
70:
71: public synchronized void clearUserData() {
72: XMLCommon.genericRemoveAll(statedata, "USERDATA");
73: }
74:
75: } // XMLAdminModel
|