Changeset 6699
- Timestamp:
- 2004-02-02T16:07:45+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/AZListClassifier.java
r6506 r6699 170 170 } 171 171 172 public int writeSQLClassifyNode(GS3SQLConnection connection, String parentId, String label, String name, String description )172 public int writeSQLClassifyNode(GS3SQLConnection connection, String parentId, String label, String name, String description, int noOfLeafDocs) 173 173 { GS3SQLAction action; 174 174 GS3SQLSelect select; … … 210 210 action.addValue("Name", name); 211 211 action.addValue("Description", description); 212 action.addValue("NumLeafDocs", Integer.toString(noOfLeafDocs), GS3SQLField.INTEGER_TYPE); 212 213 213 214 connection.execute(action.toString()); … … 245 246 GS3SQLSelect select; 246 247 GS3SQLInsert insert; 247 248 249 Iterator keys; 250 248 251 String prefix = "CLAZ"+this.fields.get(0).toString(); 249 252 250 int parentClassify = this.writeSQLClassifyNode(connection, "", prefix, "", ""); 253 int leafCount = 0; 254 keys = this.alphaMap.keySet().iterator(); 255 while (keys.hasNext()) { 256 Object key = keys.next(); 257 258 List childDocs = (List) this.alphaMap.getAll(key); 259 if (childDocs != null) { 260 leafCount += childDocs.size(); 261 } 262 } 263 264 int parentClassify = this.writeSQLClassifyNode(connection, "", prefix, "", "", leafCount); 251 265 252 266 if (parentClassify < 0) … … 255 269 256 270 List children; 257 Iterator keys;258 271 259 272 // TODO: cope with change rather than create from scratch... … … 268 281 String className = prefix + "." + key.toString(); 269 282 270 int classifyRef = this.writeSQLClassifyNode(connection, prefix, className, "", "" );283 int classifyRef = this.writeSQLClassifyNode(connection, prefix, className, "", "", childDocs.size()); 271 284 272 285 // note the child documents... … … 280 293 insert.addValue("ClassifyRef", Integer.toString(classifyRef), GS3SQLField.INTEGER_TYPE); 281 294 insert.addValue("DocID", docId.toString()); 282 insert.addValue("DocOrder", Integer.toString(order), GS3SQLField.INTEGER_TYPE); 295 insert.addValue("DocOrder", Integer.toString(order), GS3SQLField.INTEGER_TYPE); 283 296 284 297 connection.execute(insert.toString());
Note:
See TracChangeset
for help on using the changeset viewer.