Changeset 6288 for trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/AbstractHierarchyNode.java
- Timestamp:
- 2003-12-17T13:15:07+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/AbstractHierarchyNode.java
r6104 r6288 15 15 public abstract class AbstractHierarchyNode 16 16 { 17 String prefix; // a basic prefix used in this hierarchy 17 18 String descriptor; // the textual descriptor used on screen or long-hand 18 19 String name; // the index number, letter assignment or other item … … 35 36 this.name = null; 36 37 this.id = null; 38 this.prefix = null; 37 39 this.childNodes = new ArrayList(); 38 40 this.childDocs = new ArrayList(); … … 41 43 } 42 44 43 public AbstractHierarchyNode(String name, String id, String descriptor)45 public AbstractHierarchyNode(String prefix, String name, String id, String descriptor) 44 46 { this.descriptor = descriptor; 45 47 this.name = name; 46 48 this.id = id; 49 this.prefix = prefix; 47 50 this.childNodes = new ArrayList(); 48 51 this.childDocs = new ArrayList(); … … 96 99 97 100 public String getParentId() 98 { int dotAt = this.id.lastIndexOf('.'); 101 { 102 if (this.id == null) { 103 return ""; 104 } 105 106 int dotAt = this.id.lastIndexOf('.'); 99 107 if (dotAt < 0) { 100 108 return ""; … … 188 196 select = new GS3SQLSelect("classifiers"); 189 197 select.addField("ClassifyRef"); 190 GS3SQLWhereItem whereItem = new GS3SQLWhereItem("ClassifyID", "=", this. id);198 GS3SQLWhereItem whereItem = new GS3SQLWhereItem("ClassifyID", "=", this.prefix+"."+this.id); 191 199 GS3SQLWhere where = new GS3SQLWhere(whereItem); 192 200 select.setWhere(where); … … 206 214 else { 207 215 insert = new GS3SQLInsert("classifiers"); 208 if (this.parent != null) { 209 insert.addValue("ParentID", this.getParentId()); 216 217 String parentId = this.getParentId(); 218 219 if (parentId.length() > 0) { 220 insert.addValue("ParentID", this.prefix+"."+this.getParentId()); 210 221 } 222 else { 223 insert.addValue("ParentID", this.prefix); 224 } 211 225 212 226 action = insert; 213 227 } 214 action.addValue("ClassifyID", this. id);228 action.addValue("ClassifyID", this.prefix+"."+this.id); 215 229 action.addValue("Name", this.name); 216 230 action.addValue("Description", this.descriptor); … … 246 260 247 261 // delete child documents 248 GS3SQLDelete delete = new GS3SQLDelete("class ifydocuments");262 GS3SQLDelete delete = new GS3SQLDelete("classdocuments"); 249 263 delete.setWhere(where); 250 264 … … 266 280 while (iterator.hasNext()) { 267 281 DocumentID docId = (DocumentID) iterator.next(); 268 insert = new GS3SQLInsert("class ifydocuments");282 insert = new GS3SQLInsert("classdocuments"); 269 283 insert.addValue("ClassifyRef", Integer.toString(classifyRef), GS3SQLField.INTEGER_TYPE); 270 284 insert.addValue("DocID", docId.toString()); 285 286 connection.execute(insert.toString()); 271 287 } 272 288 return true;
Note:
See TracChangeset
for help on using the changeset viewer.