Changeset 6699


Ignore:
Timestamp:
2004-02-02T16:07:45+13:00 (20 years ago)
Author:
cs025
Message:

Minor alterations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/AZListClassifier.java

    r6506 r6699  
    170170  }
    171171
    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)
    173173  { GS3SQLAction action;
    174174    GS3SQLSelect select;
     
    210210      action.addValue("Name", name);
    211211      action.addValue("Description", description);
     212      action.addValue("NumLeafDocs", Integer.toString(noOfLeafDocs), GS3SQLField.INTEGER_TYPE);
    212213
    213214      connection.execute(action.toString());
     
    245246    GS3SQLSelect select;
    246247    GS3SQLInsert insert;
    247  
     248 
     249    Iterator keys;
     250 
    248251    String prefix = "CLAZ"+this.fields.get(0).toString();
    249252
    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);
    251265
    252266    if (parentClassify < 0)
     
    255269
    256270    List children;
    257     Iterator keys;
    258271   
    259272    // TODO: cope with change rather than create from scratch...
     
    268281    String className = prefix + "." + key.toString();
    269282
    270     int classifyRef = this.writeSQLClassifyNode(connection, prefix, className, "", "");
     283    int classifyRef = this.writeSQLClassifyNode(connection, prefix, className, "", "", childDocs.size());
    271284
    272285    // note the child documents...
     
    280293      insert.addValue("ClassifyRef", Integer.toString(classifyRef), GS3SQLField.INTEGER_TYPE);
    281294      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);     
    283296
    284297      connection.execute(insert.toString());
Note: See TracChangeset for help on using the changeset viewer.