Project

General

Profile

« Previous | Next » 

Revision 133

Added by Matt Jones over 24 years ago

code consolidation, cleanup, and documentation

View differences:

src/edu/ucsb/nceas/metacat/DBSAXHandler.java
184 184
      String data = new String(cbuf, start, len);
185 185

  
186 186
      // Write the content of the element to the database
187
      currentElement.writeTextToDB(data, nodeIndex);
187
      currentElement.writeChildNodeToDB("TEXT", null, data, nodeIndex);
188 188
   }
189 189

  
190 190
   /** 
......
202 202
   public void comment(String data) throws SAXException {
203 203
      DBSAXElement currentElement = (DBSAXElement)elementStack.peek();
204 204
      int nodeIndex = currentElement.incChildNum();
205
      currentElement.writeCommentToDB(data, nodeIndex);
205
      currentElement.writeChildNodeToDB("COMMENT", null, data, nodeIndex);
206 206
   }
207 207

  
208 208
   /** 
......
213 213
          throws SAXException {
214 214
      DBSAXElement currentElement = (DBSAXElement)elementStack.peek();
215 215
      int nodeIndex = currentElement.incChildNum();
216
      currentElement.writePIToDB(target, data, nodeIndex);
216
      currentElement.writeChildNodeToDB("PI", target, data, nodeIndex);
217 217
   }
218 218

  
219 219
   /** SAX Handler that is called at the end of each XML element */
src/edu/ucsb/nceas/metacat/DBSAXNode.java
21 21
 */
22 22
public class DBSAXElement extends BasicNode {
23 23

  
24
    private Connection		conn;
24
  private Connection		conn;
25 25

  
26
    /** 
27
     * Construct a new element instance
28
     *
29
     * @param conn the JDBC Connection to which all information is written
30
     * @param tagname the name of the element
31
     * @param parent_id the parent id number for this element
32
     */
33
    public DBSAXElement (Connection conn, String tagname, 
34
                         long parent_id, int nodeIndex) {
26
  /** 
27
   * Construct a new element instance
28
   *
29
   * @param conn the JDBC Connection to which all information is written
30
   * @param tagname the name of the element
31
   * @param parent_id the parent id number for this element
32
   */
33
  public DBSAXElement (Connection conn, String tagname, 
34
                       long parent_id, int nodeIndex) {
35 35

  
36
      super(tagname, parent_id, nodeIndex);
36
    super(tagname, parent_id, nodeIndex);
37 37

  
38
      this.conn = conn;
39
      writeElementToDB();
38
    this.conn = conn;
39
    if (getParentID() != 0) {
40
      writeChildNodeToDB("ELEMENT", getTagName(), null, getNodeIndex());
41
    } else {
42
      writeChildNodeToDB("DOCUMENT", getTagName(), null, 0);
40 43
    }
44

  
45
    setElementID(getAssignedElementID());
46
  }
41 47
    
42
    /** creates SQL code and inserts new element into DB connection */
43
    private void writeElementToDB() {
44
        try {
45
          conn.setAutoCommit(false);
46
          PreparedStatement pstmt;
47
          if (getParentID() != 0) {
48
            pstmt = conn.prepareStatement(
49
                "INSERT INTO xml_nodes (nodeid, nodetype, " +
50
                "nodename, parentnodeid, nodeindex) VALUES (null, ?, ?, ?, ?)");
51
          } else {
52
            pstmt = conn.prepareStatement(
53
                "INSERT INTO xml_nodes (nodeid, nodetype, nodename) " +
54
                "VALUES (null, ?, ?)");
55
          }
48
  /** creates SQL code and inserts new node into DB connection */
49
  public void writeChildNodeToDB(String nodetype, String nodename,
50
                                  String data, int nodeIndex) {
51
    try {
52
      PreparedStatement pstmt;
53
      if (nodetype == "DOCUMENT") {
54
        pstmt = conn.prepareStatement(
55
            "INSERT INTO xml_nodes " +
56
            "(nodeid, nodetype, nodename) " +
57
            "VALUES (null, ?, ?)");
58
      } else {
59
        pstmt = conn.prepareStatement(
60
            "INSERT INTO xml_nodes " +
61
            "(nodeid, nodetype, nodename, " +
62
            "parentnodeid, nodedata, nodeindex) " +
63
            "VALUES (null, ?, ?, ?, ?, ?)");
64
      }
56 65

  
57
          // Bind the values to the query
58
          pstmt.setString(1, "ELEMENT");
59
          pstmt.setString(2, getTagName());
60
          if (getParentID() != 0) {
61
            pstmt.setLong(3, getParentID());
62
            pstmt.setInt(4, getNodeIndex());
63
          } else
64
              pstmt.setString(1, "DOCUMENT");
65
          // Do the insertion
66
          pstmt.execute();
67
          pstmt.close();
68
          setElementID(getAssignedElementID());
69
          conn.commit();
70
          conn.setAutoCommit(true);
71
        } catch (SQLException e) {
72
          System.out.println(e.getMessage());
73
        }
74
    }
75

  
76
    /** creates SQL code and inserts comment into DB connection */
77
    public void writeCommentToDB(String data, int nodeIndex) {
78
        try {
79
          PreparedStatement pstmt;
80
          pstmt = conn.prepareStatement(
81
                "INSERT INTO xml_nodes (nodeid, nodetype, nodename, " +
82
                "parentnodeid, nodedata, nodeindex) " +
83
                "VALUES (null, ?, null, ?, ?, ?)");
84

  
85
          // Bind the values to the query
86
          pstmt.setString(1, "COMMENT");
87
          pstmt.setLong(2, getElementID());
88
          pstmt.setString(3, data);
89
          pstmt.setInt(4, nodeIndex);
90
          // Do the insertion
91
          pstmt.execute();
92
          pstmt.close();
93
        } catch (SQLException e) {
94
          System.out.println("Long Comment: " + e.getMessage());
95
        }
96
    }
97

  
98
    /** creates SQL code and inserts PI into DB connection */
99
    public void writePIToDB(String target, String data, int nodeIndex) {
100
        try {
101
          PreparedStatement pstmt;
102
          pstmt = conn.prepareStatement(
103
                "INSERT INTO xml_nodes (nodeid, nodetype, nodename, " +
104
                "parentnodeid, nodedata, nodeindex) " +
105
                "VALUES (null, ?, ?, ?, ?, ?)");
106

  
107
          // Bind the values to the query
108
          pstmt.setString(1, "PI");
109
          pstmt.setString(2, target);
66
      // Bind the values to the query
67
      pstmt.setString(1, nodetype);
68
      pstmt.setString(2, nodename);
69
      if (nodetype != "DOCUMENT") {
70
        if (nodetype == "ELEMENT") {
71
          pstmt.setLong(3, getParentID());
72
        } else {
110 73
          pstmt.setLong(3, getElementID());
111
          pstmt.setString(4, data);
112
          pstmt.setInt(5, nodeIndex);
113
          // Do the insertion
114
          pstmt.execute();
115
          pstmt.close();
116
        } catch (SQLException e) {
117
          System.out.println(e.getMessage());
118 74
        }
119
    }
75
        pstmt.setString(4, data);
76
        pstmt.setInt(5, nodeIndex);
77
      }
78
      // Do the insertion
79
      pstmt.execute();
80
      pstmt.close();
81
    } catch (SQLException e) {
82
      System.err.println("Error inserting node: (" + nodetype + ", " +
83
                                                     nodename + ", " + 
84
                                                     data + ", " + 
85
                                                     nodeIndex + ")" );
120 86

  
121
    /** 
122
     * creates SQL code to put nodename for the document node 
123
     * into DB connection 
124
     */
125
    public void writeNodename(String nodename) {
126
        try {
127
          PreparedStatement pstmt;
128
          pstmt = conn.prepareStatement(
129
                "UPDATE xml_nodes set nodename = ? " +
130
                "WHERE nodeid = ?");
131

  
132
          // Bind the values to the query
133
          pstmt.setString(1, nodename);
134
          pstmt.setLong(2, getElementID());
135
          // Do the insertion
136
          pstmt.execute();
137
          pstmt.close();
138
        } catch (SQLException e) {
139
          System.out.println(e.getMessage());
140
        }
87
      System.err.println(e.getMessage());
141 88
    }
89
  }
142 90

  
143
    /** look up the assigned element id from DB connection */
144
    private long getAssignedElementID() {
145
        long assigned_id=0;
146
        Statement stmt;
147
        try {
148
          stmt = conn.createStatement();
149
          stmt.execute("SELECT xml_nodes_id_seq.currval FROM dual");
150
          try {
151
            ResultSet rs = stmt.getResultSet();
152
            try {
153
              boolean tableHasRows = rs.next();
154
              if (tableHasRows) {
155
                try {
156
                  assigned_id = rs.getLong(1);
157
                } catch (SQLException e) {
158
                  System.out.println("Error with getInt: " + e.getMessage());
159
                }
160
              }
161
            } catch (SQLException e) {
162
              System.out.println("Error with next: " + e.getMessage());
163
            }
164
          } catch (SQLException e) {
165
            System.out.println("Error with getrset: " + e.getMessage());
166
          }
167
          stmt.close();
168
        } catch (SQLException e) {
169
          System.out.println("Error getting id: " + e.getMessage());
170
        }
91
  /** 
92
   * creates SQL code to put nodename for the document node 
93
   * into DB connection 
94
   */
95
  public void writeNodename(String nodename) {
96
      try {
97
        PreparedStatement pstmt;
98
        pstmt = conn.prepareStatement(
99
              "UPDATE xml_nodes set nodename = ? " +
100
              "WHERE nodeid = ?");
171 101

  
172
        // assign the new ID number
173
        return assigned_id;
174
    }
102
        // Bind the values to the query
103
        pstmt.setString(1, nodename);
104
        pstmt.setLong(2, getElementID());
105
        // Do the insertion
106
        pstmt.execute();
107
        pstmt.close();
108
      } catch (SQLException e) {
109
        System.out.println(e.getMessage());
110
      }
111
  }
175 112

  
176
    /** Add a new attribute to this element, or set its value */
177
    public void setAttribute(String attName, String attValue) {
178
      if (attName != null) {
179
        // Enter the attribute in the hash table
180
        super.setAttribute(attName, attValue);
181
 
182
        // And enter the attribute in the database
183
        try {
184
          PreparedStatement pstmt = conn.prepareStatement(
185
              "INSERT INTO xml_nodes (nodeid, nodetype, " +
186
              "nodename, nodedata, parentnodeid) VALUES (null, ?, ?, ?, ?)");
187

  
188
          // Bind the values to the query
189
          pstmt.setString(1, "ATTRIBUTE");
190
          pstmt.setString(2, attName);
191
          pstmt.setString(3, attValue);
192
          pstmt.setLong(4, getElementID());
193
 
194
          // Do the insertion
195
          pstmt.execute();
196
          pstmt.close();
197
        } catch (SQLException e) {
198
          System.out.println(e.getMessage());
113
  /** look up the assigned element id from DB connection */
114
  private long getAssignedElementID() {
115
      long assigned_id=0;
116
      Statement stmt;
117
      try {
118
        stmt = conn.createStatement();
119
        stmt.execute("SELECT xml_nodes_id_seq.currval FROM dual");
120
        ResultSet rs = stmt.getResultSet();
121
        boolean tableHasRows = rs.next();
122
        if (tableHasRows) {
123
          assigned_id = rs.getLong(1);
199 124
        }
200

  
201
      } else {
202
        System.err.println("Attribute name must not be null!");
125
        stmt.close();
126
      } catch (SQLException e) {
127
        System.out.println("Error getting id: " + e.getMessage());
203 128
      }
204
    }
205 129

  
206
    /** Write the element content to the db connection */
207
    public void writeTextToDB(String content, int nodeIndex) {
208
        try {
209
          PreparedStatement pstmt = conn.prepareStatement(
210
                "INSERT INTO xml_nodes (nodeid, nodetype, nodename, " +
211
                "parentnodeid, nodedata, nodeindex) " +
212
                "VALUES (null, ?, null, ?, ?, ?)");
213
          // Bind the values to the query
214
          pstmt.setString(1, "TEXT");
215
          pstmt.setLong(2, getElementID());
216
          pstmt.setString(3, content);
217
          pstmt.setInt(4, nodeIndex);
130
      // assign the new ID number
131
      return assigned_id;
132
  }
218 133

  
219
          // Do the update
220
          pstmt.execute();
221
          pstmt.close();
134
  /** Add a new attribute to this element, or set its value */
135
  public void setAttribute(String attName, String attValue) {
136
    if (attName != null) {
137
      // Enter the attribute in the hash table
138
      super.setAttribute(attName, attValue);
222 139

  
223
        } catch (SQLException e) {
224
          System.out.println(e.getMessage());
225
        }
140
      writeChildNodeToDB("ATTRIBUTE", attName, attValue, 0);
141
      // And enter the attribute in the database
142
    } else {
143
      System.err.println("Attribute name must not be null!");
226 144
    }
145
  }
227 146
}
src/edu/ucsb/nceas/metacat/DBSAXElement.java
21 21
 */
22 22
public class DBSAXElement extends BasicNode {
23 23

  
24
    private Connection		conn;
24
  private Connection		conn;
25 25

  
26
    /** 
27
     * Construct a new element instance
28
     *
29
     * @param conn the JDBC Connection to which all information is written
30
     * @param tagname the name of the element
31
     * @param parent_id the parent id number for this element
32
     */
33
    public DBSAXElement (Connection conn, String tagname, 
34
                         long parent_id, int nodeIndex) {
26
  /** 
27
   * Construct a new element instance
28
   *
29
   * @param conn the JDBC Connection to which all information is written
30
   * @param tagname the name of the element
31
   * @param parent_id the parent id number for this element
32
   */
33
  public DBSAXElement (Connection conn, String tagname, 
34
                       long parent_id, int nodeIndex) {
35 35

  
36
      super(tagname, parent_id, nodeIndex);
36
    super(tagname, parent_id, nodeIndex);
37 37

  
38
      this.conn = conn;
39
      writeElementToDB();
38
    this.conn = conn;
39
    if (getParentID() != 0) {
40
      writeChildNodeToDB("ELEMENT", getTagName(), null, getNodeIndex());
41
    } else {
42
      writeChildNodeToDB("DOCUMENT", getTagName(), null, 0);
40 43
    }
44

  
45
    setElementID(getAssignedElementID());
46
  }
41 47
    
42
    /** creates SQL code and inserts new element into DB connection */
43
    private void writeElementToDB() {
44
        try {
45
          conn.setAutoCommit(false);
46
          PreparedStatement pstmt;
47
          if (getParentID() != 0) {
48
            pstmt = conn.prepareStatement(
49
                "INSERT INTO xml_nodes (nodeid, nodetype, " +
50
                "nodename, parentnodeid, nodeindex) VALUES (null, ?, ?, ?, ?)");
51
          } else {
52
            pstmt = conn.prepareStatement(
53
                "INSERT INTO xml_nodes (nodeid, nodetype, nodename) " +
54
                "VALUES (null, ?, ?)");
55
          }
48
  /** creates SQL code and inserts new node into DB connection */
49
  public void writeChildNodeToDB(String nodetype, String nodename,
50
                                  String data, int nodeIndex) {
51
    try {
52
      PreparedStatement pstmt;
53
      if (nodetype == "DOCUMENT") {
54
        pstmt = conn.prepareStatement(
55
            "INSERT INTO xml_nodes " +
56
            "(nodeid, nodetype, nodename) " +
57
            "VALUES (null, ?, ?)");
58
      } else {
59
        pstmt = conn.prepareStatement(
60
            "INSERT INTO xml_nodes " +
61
            "(nodeid, nodetype, nodename, " +
62
            "parentnodeid, nodedata, nodeindex) " +
63
            "VALUES (null, ?, ?, ?, ?, ?)");
64
      }
56 65

  
57
          // Bind the values to the query
58
          pstmt.setString(1, "ELEMENT");
59
          pstmt.setString(2, getTagName());
60
          if (getParentID() != 0) {
61
            pstmt.setLong(3, getParentID());
62
            pstmt.setInt(4, getNodeIndex());
63
          } else
64
              pstmt.setString(1, "DOCUMENT");
65
          // Do the insertion
66
          pstmt.execute();
67
          pstmt.close();
68
          setElementID(getAssignedElementID());
69
          conn.commit();
70
          conn.setAutoCommit(true);
71
        } catch (SQLException e) {
72
          System.out.println(e.getMessage());
73
        }
74
    }
75

  
76
    /** creates SQL code and inserts comment into DB connection */
77
    public void writeCommentToDB(String data, int nodeIndex) {
78
        try {
79
          PreparedStatement pstmt;
80
          pstmt = conn.prepareStatement(
81
                "INSERT INTO xml_nodes (nodeid, nodetype, nodename, " +
82
                "parentnodeid, nodedata, nodeindex) " +
83
                "VALUES (null, ?, null, ?, ?, ?)");
84

  
85
          // Bind the values to the query
86
          pstmt.setString(1, "COMMENT");
87
          pstmt.setLong(2, getElementID());
88
          pstmt.setString(3, data);
89
          pstmt.setInt(4, nodeIndex);
90
          // Do the insertion
91
          pstmt.execute();
92
          pstmt.close();
93
        } catch (SQLException e) {
94
          System.out.println("Long Comment: " + e.getMessage());
95
        }
96
    }
97

  
98
    /** creates SQL code and inserts PI into DB connection */
99
    public void writePIToDB(String target, String data, int nodeIndex) {
100
        try {
101
          PreparedStatement pstmt;
102
          pstmt = conn.prepareStatement(
103
                "INSERT INTO xml_nodes (nodeid, nodetype, nodename, " +
104
                "parentnodeid, nodedata, nodeindex) " +
105
                "VALUES (null, ?, ?, ?, ?, ?)");
106

  
107
          // Bind the values to the query
108
          pstmt.setString(1, "PI");
109
          pstmt.setString(2, target);
66
      // Bind the values to the query
67
      pstmt.setString(1, nodetype);
68
      pstmt.setString(2, nodename);
69
      if (nodetype != "DOCUMENT") {
70
        if (nodetype == "ELEMENT") {
71
          pstmt.setLong(3, getParentID());
72
        } else {
110 73
          pstmt.setLong(3, getElementID());
111
          pstmt.setString(4, data);
112
          pstmt.setInt(5, nodeIndex);
113
          // Do the insertion
114
          pstmt.execute();
115
          pstmt.close();
116
        } catch (SQLException e) {
117
          System.out.println(e.getMessage());
118 74
        }
119
    }
75
        pstmt.setString(4, data);
76
        pstmt.setInt(5, nodeIndex);
77
      }
78
      // Do the insertion
79
      pstmt.execute();
80
      pstmt.close();
81
    } catch (SQLException e) {
82
      System.err.println("Error inserting node: (" + nodetype + ", " +
83
                                                     nodename + ", " + 
84
                                                     data + ", " + 
85
                                                     nodeIndex + ")" );
120 86

  
121
    /** 
122
     * creates SQL code to put nodename for the document node 
123
     * into DB connection 
124
     */
125
    public void writeNodename(String nodename) {
126
        try {
127
          PreparedStatement pstmt;
128
          pstmt = conn.prepareStatement(
129
                "UPDATE xml_nodes set nodename = ? " +
130
                "WHERE nodeid = ?");
131

  
132
          // Bind the values to the query
133
          pstmt.setString(1, nodename);
134
          pstmt.setLong(2, getElementID());
135
          // Do the insertion
136
          pstmt.execute();
137
          pstmt.close();
138
        } catch (SQLException e) {
139
          System.out.println(e.getMessage());
140
        }
87
      System.err.println(e.getMessage());
141 88
    }
89
  }
142 90

  
143
    /** look up the assigned element id from DB connection */
144
    private long getAssignedElementID() {
145
        long assigned_id=0;
146
        Statement stmt;
147
        try {
148
          stmt = conn.createStatement();
149
          stmt.execute("SELECT xml_nodes_id_seq.currval FROM dual");
150
          try {
151
            ResultSet rs = stmt.getResultSet();
152
            try {
153
              boolean tableHasRows = rs.next();
154
              if (tableHasRows) {
155
                try {
156
                  assigned_id = rs.getLong(1);
157
                } catch (SQLException e) {
158
                  System.out.println("Error with getInt: " + e.getMessage());
159
                }
160
              }
161
            } catch (SQLException e) {
162
              System.out.println("Error with next: " + e.getMessage());
163
            }
164
          } catch (SQLException e) {
165
            System.out.println("Error with getrset: " + e.getMessage());
166
          }
167
          stmt.close();
168
        } catch (SQLException e) {
169
          System.out.println("Error getting id: " + e.getMessage());
170
        }
91
  /** 
92
   * creates SQL code to put nodename for the document node 
93
   * into DB connection 
94
   */
95
  public void writeNodename(String nodename) {
96
      try {
97
        PreparedStatement pstmt;
98
        pstmt = conn.prepareStatement(
99
              "UPDATE xml_nodes set nodename = ? " +
100
              "WHERE nodeid = ?");
171 101

  
172
        // assign the new ID number
173
        return assigned_id;
174
    }
102
        // Bind the values to the query
103
        pstmt.setString(1, nodename);
104
        pstmt.setLong(2, getElementID());
105
        // Do the insertion
106
        pstmt.execute();
107
        pstmt.close();
108
      } catch (SQLException e) {
109
        System.out.println(e.getMessage());
110
      }
111
  }
175 112

  
176
    /** Add a new attribute to this element, or set its value */
177
    public void setAttribute(String attName, String attValue) {
178
      if (attName != null) {
179
        // Enter the attribute in the hash table
180
        super.setAttribute(attName, attValue);
181
 
182
        // And enter the attribute in the database
183
        try {
184
          PreparedStatement pstmt = conn.prepareStatement(
185
              "INSERT INTO xml_nodes (nodeid, nodetype, " +
186
              "nodename, nodedata, parentnodeid) VALUES (null, ?, ?, ?, ?)");
187

  
188
          // Bind the values to the query
189
          pstmt.setString(1, "ATTRIBUTE");
190
          pstmt.setString(2, attName);
191
          pstmt.setString(3, attValue);
192
          pstmt.setLong(4, getElementID());
193
 
194
          // Do the insertion
195
          pstmt.execute();
196
          pstmt.close();
197
        } catch (SQLException e) {
198
          System.out.println(e.getMessage());
113
  /** look up the assigned element id from DB connection */
114
  private long getAssignedElementID() {
115
      long assigned_id=0;
116
      Statement stmt;
117
      try {
118
        stmt = conn.createStatement();
119
        stmt.execute("SELECT xml_nodes_id_seq.currval FROM dual");
120
        ResultSet rs = stmt.getResultSet();
121
        boolean tableHasRows = rs.next();
122
        if (tableHasRows) {
123
          assigned_id = rs.getLong(1);
199 124
        }
200

  
201
      } else {
202
        System.err.println("Attribute name must not be null!");
125
        stmt.close();
126
      } catch (SQLException e) {
127
        System.out.println("Error getting id: " + e.getMessage());
203 128
      }
204
    }
205 129

  
206
    /** Write the element content to the db connection */
207
    public void writeTextToDB(String content, int nodeIndex) {
208
        try {
209
          PreparedStatement pstmt = conn.prepareStatement(
210
                "INSERT INTO xml_nodes (nodeid, nodetype, nodename, " +
211
                "parentnodeid, nodedata, nodeindex) " +
212
                "VALUES (null, ?, null, ?, ?, ?)");
213
          // Bind the values to the query
214
          pstmt.setString(1, "TEXT");
215
          pstmt.setLong(2, getElementID());
216
          pstmt.setString(3, content);
217
          pstmt.setInt(4, nodeIndex);
130
      // assign the new ID number
131
      return assigned_id;
132
  }
218 133

  
219
          // Do the update
220
          pstmt.execute();
221
          pstmt.close();
134
  /** Add a new attribute to this element, or set its value */
135
  public void setAttribute(String attName, String attValue) {
136
    if (attName != null) {
137
      // Enter the attribute in the hash table
138
      super.setAttribute(attName, attValue);
222 139

  
223
        } catch (SQLException e) {
224
          System.out.println(e.getMessage());
225
        }
140
      writeChildNodeToDB("ATTRIBUTE", attName, attValue, 0);
141
      // And enter the attribute in the database
142
    } else {
143
      System.err.println("Attribute name must not be null!");
226 144
    }
145
  }
227 146
}
src/edu/ucsb/nceas/metacat/BasicNode.java
18 18
/** A Class that represents an XML element and its contents */
19 19
public class BasicNode {
20 20

  
21
    private long		element_id;
22
    private String		tagname;
23
    //private StringBuffer	content;
24
    private long		parent_id;
21
    private long	node_id;
22
    private String	tagname;
23
    private long	parent_id;
25 24
    private Hashtable	attributes;
26 25
    private int         childNum;
27 26
    private int         nodeIndex;
......
53 52
    
54 53
    /** Construct a Basic Element 
55 54
     *
56
     * @param element_id the id number of the element
57
     * @param tagname the name of the element
58
     * @param parent_id the id number of the parent element
55
     * @param node_id the id number of the node
56
     * @param tagname the name of the node
57
     * @param parent_id the id number of the parent node
59 58
     */
60
    public BasicNode (long element_id, String tagname, long parent_id, 
59
    public BasicNode (long node_id, String tagname, long parent_id, 
61 60
                         int nodeIndex) {
62 61
      this(tagname,parent_id,nodeIndex);
63
      this.element_id = element_id;
62
      this.node_id = node_id;
64 63
    }
65 64

  
66 65
    /** convert the element to a string representation for display */
......
77 76
*/
78 77

  
79 78
    /** Get the id of this element */
80
    public long getElementID() 
79
    public long getNodeID() 
81 80
    { 
82
      return element_id; 
81
      return node_id; 
83 82
    }
84 83

  
85 84
    /** Set the id of this element */
86
    public void setElementID(long element_id) 
85
    public void setNodeID(long node_id) 
87 86
    { 
88
      this.element_id = element_id; 
87
      this.node_id = node_id; 
89 88
    }
90 89

  
91 90
    /** Get the parent id of this element */

Also available in: Unified diff