Mercurial > hg > mpdl-group
comparison software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/util/MpdlITextRenderer.java @ 16:257f67be5c00
diverse Fehlerbehebungen
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 27 Sep 2011 16:40:57 +0200 |
parents | 59ff47d1e237 |
children |
comparison
equal
deleted
inserted
replaced
15:e99964f390e4 | 16:257f67be5c00 |
---|---|
87 OutputStream osHtmlPdf = null; | 87 OutputStream osHtmlPdf = null; |
88 String eXistIdentifier = mdRecord.getEXistIdentifier(); | 88 String eXistIdentifier = mdRecord.getEXistIdentifier(); |
89 String language = mdRecord.getLanguage(); | 89 String language = mdRecord.getLanguage(); |
90 if (eXistIdentifier == null) | 90 if (eXistIdentifier == null) |
91 throw new ApplicationException("Pdf/Html-Generation failed: no eXist-Identifier given in mdRecord"); | 91 throw new ApplicationException("Pdf/Html-Generation failed: no eXist-Identifier given in mdRecord"); |
92 String eXistIdentifierWithoutExtension = eXistIdentifier.substring(0, eXistIdentifier.length() - 4); // without ".xml" | 92 int lastDot = eXistIdentifier.lastIndexOf("."); |
93 String eXistIdentifierWithoutExtension = eXistIdentifier.substring(0, lastDot); | |
94 String eXistIdentifierExtension = eXistIdentifier.substring(lastDot + 1); | |
93 String destFileNamePdf = MpdlConstants.MPDL_EXIST_DATA_DIR + "/documents" + eXistIdentifierWithoutExtension + ".pdf"; | 95 String destFileNamePdf = MpdlConstants.MPDL_EXIST_DATA_DIR + "/documents" + eXistIdentifierWithoutExtension + ".pdf"; |
94 String destFileNameHtml = MpdlConstants.MPDL_EXIST_DATA_DIR + "/documents" + eXistIdentifierWithoutExtension + ".html"; | 96 String destFileNameHtml = MpdlConstants.MPDL_EXIST_DATA_DIR + "/documents" + eXistIdentifierWithoutExtension + ".html"; |
97 if (eXistIdentifierExtension != null && eXistIdentifierExtension.equals("html")) { | |
98 destFileNameHtml = MpdlConstants.MPDL_EXIST_DATA_DIR + "/documents" + eXistIdentifierWithoutExtension + "-gen.html"; | |
99 } | |
95 String destFileNameHtmlPdfTmp = MpdlConstants.MPDL_EXIST_DATA_DIR + "/documents" + eXistIdentifierWithoutExtension + "-4Pdf.html"; | 100 String destFileNameHtmlPdfTmp = MpdlConstants.MPDL_EXIST_DATA_DIR + "/documents" + eXistIdentifierWithoutExtension + "-4Pdf.html"; |
96 try { | 101 try { |
97 // start document | 102 // start document |
98 if (pdf) { | 103 if (pdf) { |
99 osPdf = new FileOutputStream(new File(destFileNamePdf)); | 104 osPdf = new FileOutputStream(new File(destFileNamePdf)); |
285 mdRecordStr = mdRecordStr + author; | 290 mdRecordStr = mdRecordStr + author; |
286 if (title != null && ! title.equals("")) | 291 if (title != null && ! title.equals("")) |
287 mdRecordStr = mdRecordStr + ". " + title; | 292 mdRecordStr = mdRecordStr + ". " + title; |
288 if (year != null && ! year.equals("")) | 293 if (year != null && ! year.equals("")) |
289 mdRecordStr = mdRecordStr + ". " + year + "."; | 294 mdRecordStr = mdRecordStr + ". " + year + "."; |
290 else | 295 if (mdRecordStr.isEmpty()) { |
291 mdRecordStr = mdRecordStr + "."; | 296 String eXistId = mdRecord.getEXistIdentifier(); |
297 mdRecordStr = mdRecordStr + eXistId; | |
298 } | |
292 } | 299 } |
293 return mdRecordStr; | 300 return mdRecordStr; |
294 } | 301 } |
295 | 302 |
296 private String getHtmlHead(String stylePageStr, String titleStr) { | 303 private String getHtmlHead(String stylePageStr, String titleStr) { |
381 String pbTag = "echo:pb"; | 388 String pbTag = "echo:pb"; |
382 if (docBase != null && docBase.equals("archimedes")) | 389 if (docBase != null && docBase.equals("archimedes")) |
383 pbTag = "pb"; | 390 pbTag = "pb"; |
384 else if (docBase != null && docBase.equals("tei")) | 391 else if (docBase != null && docBase.equals("tei")) |
385 pbTag = "TEI:pb"; | 392 pbTag = "TEI:pb"; |
393 else | |
394 pbTag = "*:pb"; | |
386 try { | 395 try { |
387 HttpClient httpClient = new HttpClient(); | 396 HttpClient httpClient = new HttpClient(); |
388 String requestName = "/mpdl/interface/xquery.xql?document=" + docName + "&xquery=count(//" + pbTag + ")"; | 397 String requestName = "/mpdl/interface/xquery.xql?document=" + docName + "&xquery=count(//" + pbTag + ")"; |
389 String urlStr = "http" + "://" + MpdlConstants.MPDL_EXIST_HOST_NAME + ":" + MpdlConstants.MPDL_EXIST_PORT + requestName; | 398 String urlStr = "http" + "://" + MpdlConstants.MPDL_EXIST_HOST_NAME + ":" + MpdlConstants.MPDL_EXIST_PORT + requestName; |
390 GetMethod method = new GetMethod(urlStr); | 399 GetMethod method = new GetMethod(urlStr); |