Mercurial > hg > eSciDocImport
comparison src/de/mpiwg/itgroup/eSciDoc/harvesting/ESciDocDataHarvester.java @ 10:ad5c0748bd08
minor
author | dwinter |
---|---|
date | Mon, 20 Aug 2012 12:53:45 +0200 |
parents | b6cf6462d709 |
children |
comparison
equal
deleted
inserted
replaced
9:b6cf6462d709 | 10:ad5c0748bd08 |
---|---|
238 try { | 238 try { |
239 logger.info(escidocItem.printXML()); | 239 logger.info(escidocItem.printXML()); |
240 // TODO write PID to back to echo-obj | 240 // TODO write PID to back to echo-obj |
241 Boolean result = connector.createItem(escidocItem); | 241 Boolean result = connector.createItem(escidocItem); |
242 if (result) { | 242 if (result) { |
243 addedObjects.add(escidocItem.getESciDocId()); | 243 String objID=escidocItem.getESciDocId(); |
244 addedFile.debug(escidocItem.getESciDocId() + "\n"); | 244 addedObjects.add(objID); |
245 | 245 addedFile.debug(objID + "\n"); |
246 ((ECHORessource)obj).writeEsciDocIDToIndexMeta(objID.replace("/ir/item/","")); | |
246 } else { | 247 } else { |
247 notAddedObjects.add(obj.echoUrl); | 248 notAddedObjects.add(obj.echoUrl); |
248 notAddedFile.debug(obj.echoUrl); | 249 notAddedFile.debug(obj.echoUrl); |
249 | 250 |
250 } | 251 } |
342 throws Exception { | 343 throws Exception { |
343 | 344 |
344 Integer numberOfHits = connector.getNumberOfHitsFromFilterResult( | 345 Integer numberOfHits = connector.getNumberOfHitsFromFilterResult( |
345 command, objectXPath,mode); | 346 command, objectXPath,mode); |
346 | 347 |
347 | 348 logger.info(String.format("%s objects found.", numberOfHits)); |
348 int tausend = ((numberOfHits-1) / MAX_REC); | 349 int tausend = ((numberOfHits-1) / MAX_REC); |
349 | 350 |
350 String queryRestrict=""; | 351 String queryRestrict=""; |
351 if(mode==0 | mode==2){ | 352 if(mode==0 | mode==2){ |
352 queryRestrict="query=%22/properties/version/status%22=pending"; | 353 queryRestrict="query=%22/properties/version/status%22=pending"; |
353 } else { | 354 } else { |
354 queryRestrict="query=%22/properties/version/status%22=submitted"; | 355 queryRestrict="query=%22/properties/version/status%22=submitted"; |
355 } | 356 } |
356 | 357 int counter=0; |
357 for (int t = 0; t <= tausend; t++) { | 358 for (int t = 0; t <= tausend; t++) { |
358 int start = t * MAX_REC+1; | 359 int start = t * MAX_REC+1; |
359 // int max=Math.min((t+1)*1000, numberOfHits); | 360 // int max=Math.min((t+1)*1000, numberOfHits); |
360 String query = "?maximumRecords="+String.valueOf(MAX_REC)+"&startRecord=" | 361 String query = "?maximumRecords="+String.valueOf(MAX_REC)+"&startRecord=" |
361 + String.valueOf(start)+"&"+queryRestrict; | 362 + String.valueOf(start)+"&"+queryRestrict; |
362 for (eSciDocXmlObject obj : connector | 363 for (eSciDocXmlObject obj : connector |
363 .getObjectsFromFilterResult(command+query, objectXPath)) { | 364 .getObjectsFromFilterResult(command+query, objectXPath)) { |
364 | 365 |
366 logger.info(String.format("%s/%s", counter,numberOfHits)); | |
367 counter+=1; | |
368 | |
365 //TODO is the following really necessary, currently the obj in the list is sometimes not the current one. | 369 //TODO is the following really necessary, currently the obj in the list is sometimes not the current one. |
366 try{ | 370 try{ |
367 HttpResponse resObj = connector.eScidocGet(obj.getESciDocId()); | 371 HttpResponse resObj = connector.eScidocGet(obj.getESciDocId()); |
368 HttpEntity ent = resObj.getEntity(); | 372 HttpEntity ent = resObj.getEntity(); |
369 if (ent!=null){ | 373 if (ent!=null){ |
434 "http://xserve09.mpiwg-berlin.mpg.de:19280/echo_nav/echo_pages/content/showRDF")); | 438 "http://xserve09.mpiwg-berlin.mpg.de:19280/echo_nav/echo_pages/content/showRDF")); |
435 ESciDocDataHarvester hv = new ESciDocDataHarvester(newimporter, | 439 ESciDocDataHarvester hv = new ESciDocDataHarvester(newimporter, |
436 new ECHOTransformer(), connector, "/ir/context/escidoc:1001"); | 440 new ECHOTransformer(), connector, "/ir/context/escidoc:1001"); |
437 | 441 |
438 // hv.readObjectsFromInstance("ECHO_collection"); | 442 // hv.readObjectsFromInstance("ECHO_collection"); |
439 hv.readObjectsFromInstance("ECHO_resource"); | 443 //hv.readObjectsFromInstance("ECHO_resource"); |
440 | 444 |
441 hv.releaseAndSubmitObjects( | 445 hv.releaseAndSubmitObjects( |
442 "/ir/context/escidoc:1001/resources/members", | 446 "/ir/context/escidoc:1001/resources/members", |
443 "//escidocItem:item","first release",0); | 447 "//escidocItem:item","first release",0); |
444 hv.releaseAndSubmitObjects( | 448 hv.releaseAndSubmitObjects( |