Changeset 25635 for main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentBasket.java
- Timestamp:
- 2012-05-22T13:01:04+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentBasket.java
r25091 r25635 72 72 protected static final String BASKET_BOOK = "documentBasketBook"; 73 73 74 protected Hashtable userMap = null;75 protected Hashtable timerMap = null;74 protected Hashtable<String, Hashtable<String, Hashtable<String, Item>>> userMap = null; 75 protected Hashtable<String, UserTimer> timerMap = null; 76 76 protected String username = ""; 77 77 protected String password = ""; … … 80 80 public DocumentBasket() 81 81 { 82 userMap = new Hashtable ();83 timerMap = new Hashtable ();84 } 85 86 private Hashtable updateDocMap(Element request)82 userMap = new Hashtable<String, Hashtable<String, Hashtable<String, Item>>>(); 83 timerMap = new Hashtable<String, UserTimer>(); 84 } 85 86 private Hashtable<String, Hashtable<String, Item>> updateDocMap(Element request) 87 87 { 88 88 String id = request.getAttribute("uid"); … … 92 92 if (timerMap.containsKey(id)) 93 93 { 94 UserTimer timer = (UserTimer)timerMap.get(id);94 UserTimer timer = timerMap.get(id); 95 95 timer.restart(); 96 96 } 97 return (Hashtable)userMap.get(id);97 return userMap.get(id); 98 98 } 99 99 else … … 102 102 timerMap.put(id, timer); 103 103 timer.start(); 104 Hashtable newDocs = new Hashtable();104 Hashtable<String, Hashtable<String, Item>> newDocs = new Hashtable<String, Hashtable<String, Item>>(); 105 105 userMap.put(id, newDocs); 106 106 return newDocs; … … 226 226 { 227 227 //System.err.println("REQUEST = " + GSXML.xmlNodeToString(request)); 228 Hashtable docsMap = updateDocMap(request);228 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 229 229 //System.err.println("DOCSMAP = " + docsMap); 230 230 // Create a new (empty) result message … … 239 239 } 240 240 241 HashMap params = GSXML.extractParams(param_list, false);241 HashMap<String, Serializable> params = GSXML.extractParams(param_list, false); 242 242 //System.err.println("PARAMS = " + params); 243 243 String item = (String) params.get("item"); … … 256 256 if (docsMap.containsKey(collection)) 257 257 { 258 Hashtable items = (Hashtable)docsMap.get(collection);258 Hashtable<String, Item> items = docsMap.get(collection); 259 259 if (!items.containsKey(item)) 260 260 { … … 266 266 else 267 267 { 268 Hashtable items = new Hashtable();268 Hashtable<String, Item> items = new Hashtable<String, Item>(); 269 269 Item newItem = generateItem(collection, item); 270 270 items.put(item, newItem); … … 286 286 } 287 287 288 HashMap params = GSXML.extractParams(param_list, false);288 HashMap<String, Serializable> params = GSXML.extractParams(param_list, false); 289 289 290 290 String docString = (String) params.get("docs"); … … 379 379 Item item = new Item(collection, id); 380 380 String to = GSPath.appendLink(collection, "DocumentMetadataRetrieve"); 381 ArrayList tmp = new ArrayList();381 ArrayList<String> tmp = new ArrayList<String>(); 382 382 tmp.add(id); 383 383 … … 422 422 protected Element processClearDocuments(Element request) 423 423 { 424 Hashtable docsMap = updateDocMap(request);424 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 425 425 426 426 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); … … 435 435 } 436 436 437 HashMap params = GSXML.extractParams(param_list, false);437 HashMap<String, Serializable> params = GSXML.extractParams(param_list, false); 438 438 String collection = (String) params.get(GSParams.COLLECTION); 439 439 … … 441 441 return result; 442 442 443 docsMap.put(collection, new Hashtable ());443 docsMap.put(collection, new Hashtable<String, Item>()); 444 444 445 445 return result; … … 448 448 protected Element processDeleteDocuments(Element request) 449 449 { 450 Hashtable docsMap = updateDocMap(request);450 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 451 451 452 452 // Create a new (empty) result message … … 464 464 } 465 465 466 HashMap params = GSXML.extractParams(param_list, false);466 HashMap<String, Serializable> params = GSXML.extractParams(param_list, false); 467 467 468 468 String param = (String) params.get("items"); … … 489 489 if (docsMap.containsKey(collection)) 490 490 { 491 Hashtable itemMap = (Hashtable)docsMap.get(collection);491 Hashtable itemMap = docsMap.get(collection); 492 492 if (itemMap.containsKey(item)) 493 493 { … … 506 506 protected Element processDeleteDocument(Element request) 507 507 { 508 Hashtable docsMap = updateDocMap(request);508 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 509 509 510 510 // Create a new (empty) result message … … 522 522 } 523 523 524 HashMap params = GSXML.extractParams(param_list, false);524 HashMap<String, Serializable> params = GSXML.extractParams(param_list, false); 525 525 526 526 String item = (String) params.get("item"); … … 540 540 if (docsMap.containsKey(collection)) 541 541 { 542 Hashtable itemMap = (Hashtable)docsMap.get(collection);542 Hashtable itemMap = docsMap.get(collection); 543 543 if (itemMap.containsKey(item)) 544 544 { … … 557 557 { 558 558 // GSXML.printXMLNode(request); 559 Hashtable docsMap = updateDocMap(request);559 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 560 560 561 561 // Create a new (empty) result message … … 564 564 int size = 0; 565 565 String ids = ""; 566 Iterator keys = docsMap.keySet().iterator();566 Iterator<String> keys = docsMap.keySet().iterator(); 567 567 568 568 while (keys.hasNext()) 569 569 { 570 Hashtable items = (Hashtable) docsMap.get((String)keys.next());570 Hashtable items = docsMap.get(keys.next()); 571 571 size += items.size(); 572 572 Iterator values = items.values().iterator(); … … 585 585 } 586 586 587 private Element getDocumentMetadata(String to, UserContext userContext, Iterator ids)587 private Element getDocumentMetadata(String to, UserContext userContext, Iterator<String> ids) 588 588 { 589 589 … … 594 594 595 595 // Create a parameter list to specify the required metadata information 596 HashSet meta_names = new HashSet();596 HashSet<String> meta_names = new HashSet<String>(); 597 597 meta_names.add("Title"); // the default 598 598 meta_names.add("root_Title"); … … 602 602 603 603 Element param = null; 604 Iterator i = meta_names.iterator();604 Iterator<String> i = meta_names.iterator(); 605 605 while (i.hasNext()) 606 606 { 607 String name = (String)i.next();607 String name = i.next(); 608 608 param = this.doc.createElement(GSXML.PARAM_ELEM); 609 609 param_list.appendChild(param); … … 623 623 Element dm_doc_node = this.doc.createElement(GSXML.DOC_NODE_ELEM); 624 624 dm_doc_list.appendChild(dm_doc_node); 625 dm_doc_node.setAttribute(GSXML.NODE_ID_ATT, (String)ids.next());625 dm_doc_node.setAttribute(GSXML.NODE_ID_ATT, ids.next()); 626 626 } 627 627 … … 631 631 protected Element processDisplayDocumentList(Element request) 632 632 { 633 Hashtable docsMap = updateDocMap(request);633 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 634 634 635 635 // Create a new (empty) result message 636 636 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 637 637 638 Iterator keys = docsMap.keySet().iterator();638 Iterator<String> keys = docsMap.keySet().iterator(); 639 639 640 640 while (keys.hasNext()) 641 641 { 642 String collection = (String)keys.next();643 Hashtable items = (Hashtable)docsMap.get(collection);642 String collection = keys.next(); 643 Hashtable items = docsMap.get(collection); 644 644 Iterator itemItr = items.values().iterator(); 645 645
Note:
See TracChangeset
for help on using the changeset viewer.