Changeset 8868
- Timestamp:
- 2004-12-21T14:16:50+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/notifier/NotifierManager.java
r8772 r8868 17 17 public void detectEvents(CollectionManager collManager) { 18 18 19 System.out.println("detecting events"); 20 19 21 String collectionName = collManager.getCollectionName(); 20 22 String host = "http://localhost:8080/soap/servlet/rpcrouter"; 21 23 22 24 String lastBuild = dateToSqlString(collManager.getBuildDate()); 25 System.out.println("last build was " + lastBuild); 23 26 Statement statement = collManager.getDatabase().createStatement(); 24 27 try { … … 30 33 // detect modified documents. A document is modified if and only if 31 34 // AccessionDate < CollectionLastRebuiltDate (ie, it is not new) and 32 // ModifiedDate >= IndexedDate33 results = statement.executeQuery("SELECT DocID FROM document WHERE DocType != 'GSMETADATA' AND AccessionDate < " + lastBuild + " AND ModifiedDate >= IndexedDate");35 // IndexedDate >= CollectionLastRebuiltDate 36 results = statement.executeQuery("SELECT DocID FROM document WHERE DocType != 'GSMETADATA' AND AccessionDate < " + lastBuild + " AND IndexedDate >= " + lastBuild); 34 37 notify(collectionName, host, results, collManager.getDatabase(), collManager.getBuildDate(), "document_modified"); 38 39 // TODO deleted docs? 35 40 } catch (SQLException e) { 36 41 // TODO Auto-generated catch block … … 56 61 57 62 while(results.next()) { 58 System.out.println( "new document: " + results.getString("DocID"));63 System.out.println(eventType + ": " + results.getString("DocID")); 59 64 60 65 String documentID = results.getString("DocID"); … … 77 82 writer.write("&collectionID="); 78 83 writer.write(URLEncoder.encode(collName, "UTF-8")); 79 writer.write("&host_url="); 84 // TODO add collection name to event 85 writer.write("&hostID="); 80 86 writer.write(URLEncoder.encode(hostURL, "UTF-8")); 81 87 writer.write("&document_title="); … … 145 151 */ 146 152 private String getDocumentTitle(String documentID, GS3SQLConnection database) { 153 System.out.println("getting title for document " + documentID + " from database"); 147 154 Statement statement = database.createStatement(); 148 155 … … 161 168 results = statement.executeQuery(sqlString); 162 169 if (results.next()) { 163 return results.getString(0); 170 String title = results.getString("value"); 171 System.out.println("title is " + title); 172 return title; 164 173 } 165 174 } catch (SQLException e) { 175 e.printStackTrace(); 166 176 } 167 177 return "";
Note:
See TracChangeset
for help on using the changeset viewer.