# HG changeset patch # User dwinter # Date 1353496878 -3600 # Node ID da598103dd2200aa737bffb90ddeeb5d4c186aa3 # Parent e0efd3a9d2f0b95cc57104c28ce4fb4137a2aa27 publishinginfodate repaired diff -r e0efd3a9d2f0 -r da598103dd22 src/de/mpiwg/itgroup/eSciDoc/Tools/EScidocTools.java --- a/src/de/mpiwg/itgroup/eSciDoc/Tools/EScidocTools.java Mon Sep 17 10:21:04 2012 +0200 +++ b/src/de/mpiwg/itgroup/eSciDoc/Tools/EScidocTools.java Wed Nov 21 12:21:18 2012 +0100 @@ -20,7 +20,7 @@ static public String MPIWG = "http://www.mpiwg-berlin.mpg.de/ns/mpiwg"; static public String RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; static public String FEDORA = "info:fedora/fedora-system:def/relations-external#"; - static public String escidocItem="http://www.escidoc.de/schemas/item/0.10"; + static public String escidocItem="http://www.escidoc.de/schemas/item/0.9"; static public String prop="http://escidoc.de/core/01/properties/"; static public String escidocComponents="http://www.escidoc.de/schemas/components/0.9"; static public String xlink="http://www.w3.org/1999/xlink"; diff -r e0efd3a9d2f0 -r da598103dd22 src/de/mpiwg/itgroup/eSciDoc/Tools/Pubman/RepairPublishingInfoDate.java --- a/src/de/mpiwg/itgroup/eSciDoc/Tools/Pubman/RepairPublishingInfoDate.java Mon Sep 17 10:21:04 2012 +0200 +++ b/src/de/mpiwg/itgroup/eSciDoc/Tools/Pubman/RepairPublishingInfoDate.java Wed Nov 21 12:21:18 2012 +0100 @@ -30,26 +30,35 @@ public static void main(String[] args) throws IllegalStateException, IOException, JDOMException, ESciDocXmlObjectException { + Logger logger = Logger.getRootLogger(); logger.setLevel(Level.INFO); - EScidocBasicHandler connector = new EScidocBasicHandler( - "escidoc.mpiwg-berlin.mpg.de", 8080, "dwinter", "fl1rian"); - - if(args.length<2){ - System.out.println("Usage: startrecord maximumrecords"); + + if(args.length<5){ + System.out.println("Usage: username password contextID (eg.escidoc:XXX) startrecord maximumrecords"); System.exit(-1); } - String MAX_REC = args[1]; - String start = args[0]; + String MAX_REC = args[4]; + String start = args[3]; + String contextId = args[2]; + String username = args[0]; + String password = args[1]; + String objectXPath = "//escidocItem:item"; + EScidocBasicHandler connector = new EScidocBasicHandler( + "escidoc.mpiwg-berlin.mpg.de", 8080, username,password); + String query = "?maximumRecords=" + String.valueOf(MAX_REC) + "&startRecord=" + String.valueOf(start); //String command = "/ir/context/escidoc:38279/resources/members"; - String command = "/ir/context/escidoc:79281/resources/members"; + String command = "/ir/context/"+contextId+"/resources/members"; + //String command = "/ir/context/escidoc:79281/resources/members"; + System.out.println("search for:"+command+query); + Integer i=0; for (eSciDocXmlObject obj : connector.getObjectsFromFilterResult( command + query, objectXPath)) { - + i++; Document doc = obj.getDocument(); Boolean changed=false; XPath publishingInfoContentXPath = EScidocTools.getESciDocXpath("//publication:publication/dcterms:created"); @@ -57,7 +66,7 @@ XPath publishingInfoXPath = EScidocTools.getESciDocXpath("//publication:publication"); @SuppressWarnings("unchecked") HashMap piContentHash = new HashMap(); - + System.out.println(i); Element issued =(Element)publishingInfoContentXPathIssued.selectSingleNode(doc); if (issued==null){ @@ -65,7 +74,7 @@ for (Element piContent : piContents) { String creationDate=piContent.getText(); - + System.out.println("found creation and no issue date:"+creationDate); Element node = (Element)publishingInfoXPath.selectSingleNode(doc); //Element element = new Element("issued",EScidocTools.dcterms); @@ -75,6 +84,7 @@ String piContentName=piContent.getName(); changed=true; }} + if (changed){ Boolean retVal = connector.updateItem(obj);