comparison software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/schedule/MpdlDocJob.java @ 14:5df60f24e997

diverse Fehlerbehebungen
author Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de>
date Mon, 29 Aug 2011 17:40:02 +0200
parents 408254cf2f1d
children
comparison
equal deleted inserted replaced
13:469d927b9ca7 14:5df60f24e997
11 11
12 import de.mpg.mpiwg.berlin.mpdl.client.DocumentHandler; 12 import de.mpg.mpiwg.berlin.mpdl.client.DocumentHandler;
13 import de.mpg.mpiwg.berlin.mpdl.escidoc.ESciDocIngestor; 13 import de.mpg.mpiwg.berlin.mpdl.escidoc.ESciDocIngestor;
14 import de.mpg.mpiwg.berlin.mpdl.escidoc.ESciDocRestSession; 14 import de.mpg.mpiwg.berlin.mpdl.escidoc.ESciDocRestSession;
15 import de.mpg.mpiwg.berlin.mpdl.exception.ApplicationException; 15 import de.mpg.mpiwg.berlin.mpdl.exception.ApplicationException;
16 import de.mpg.mpiwg.berlin.mpdl.general.MpdlConstants;
16 import de.mpg.mpiwg.berlin.mpdl.xmlrpc.MpdlXmlRpcDocHandler; 17 import de.mpg.mpiwg.berlin.mpdl.xmlrpc.MpdlXmlRpcDocHandler;
17 18
18 public class MpdlDocJob implements Job { 19 public class MpdlDocJob implements Job {
19 public static String STATUS_BEGIN = "started"; 20 public static String STATUS_BEGIN = "started";
20 private static Logger LOGGER = Logger.getLogger(MpdlDocJob.class); // Logs to EXIST_HOME/webapp/WEB-INF/logs/exist.log 21 private static Logger LOGGER = Logger.getLogger(MpdlDocJob.class); // Logs to EXIST_HOME/webapp/WEB-INF/logs/exist.log
21 private JobExecutionContext currentExecutedContext; 22 private JobExecutionContext currentExecutedContext;
22 23
23 public void execute(JobExecutionContext context) throws JobExecutionException { 24 public void execute(JobExecutionContext context) throws JobExecutionException {
24 this.currentExecutedContext = context; 25 this.currentExecutedContext = context;
25 MpdlDocOperation docOperation = getDocOperation(); 26 MpdlDocOperation docOperation = getDocOperation();
26 docOperation.setIncludePdf(true); // default is true: handle also Pdf/Html version of the document 27 boolean generatePDF = MpdlConstants.MPDL_GENERATE_PDF;
28 docOperation.setIncludePdf(generatePDF); // default is true: handle also Pdf/Html version of the document
27 try { 29 try {
28 docOperation.setStatus(STATUS_BEGIN); 30 docOperation.setStatus(STATUS_BEGIN);
29 String operationName = docOperation.getName(); 31 String operationName = docOperation.getName();
30 String cookieId = docOperation.getESciDocCookieId(); 32 String cookieId = docOperation.getESciDocCookieId();
31 MpdlXmlRpcDocHandler mpdlXmlRpcDocHandler = MpdlXmlRpcDocHandler.getInstance(); 33 MpdlXmlRpcDocHandler mpdlXmlRpcDocHandler = MpdlXmlRpcDocHandler.getInstance();
32 ESciDocRestSession eSciDocSession = ESciDocRestSession.getInstance(cookieId); 34 ESciDocRestSession eSciDocSession = null;
33 ESciDocIngestor eSciDocIngestor = new ESciDocIngestor(eSciDocSession); 35 ESciDocIngestor eSciDocIngestor = null;
36 if (docOperation.isESciDocOperation()) {
37 eSciDocSession = ESciDocRestSession.getInstance(cookieId);
38 eSciDocIngestor = new ESciDocIngestor(eSciDocSession);
39 }
34 if (operationName.equals("create") || operationName.equals("update")) { 40 if (operationName.equals("create") || operationName.equals("update")) {
35 DocumentHandler docHandler = new DocumentHandler(mpdlXmlRpcDocHandler, eSciDocIngestor); 41 DocumentHandler docHandler = new DocumentHandler(mpdlXmlRpcDocHandler, eSciDocIngestor);
36 docHandler.doOperation(docOperation); 42 docHandler.doOperation(docOperation);
37 } else if (operationName.equals("delete")) { 43 } else if (operationName.equals("delete")) {
38 DocumentHandler docHandler = new DocumentHandler(mpdlXmlRpcDocHandler, eSciDocIngestor); 44 DocumentHandler docHandler = new DocumentHandler(mpdlXmlRpcDocHandler, eSciDocIngestor);