0 Replies Latest reply on Feb 8, 2008 2:54 AM by (David_Heffernan)

    PDF transformation using Lifecycle remoting


      We are using the lifecycle remoting service to transform documents to the PDF/A format. The problem we are having is solely when the lifecycle platform can not tranform the document for any particular reason. For example, the document is not supported (autocad) or the document has a password etc etc.

      The process state goes to STALLED no matter what the error meaning it requires manual intervention. When the client is polling the platform to determine the status of the document it always returns a job status RUNNING even though the platform can not transform the document. The platform should just return a job status FAILED. Then we can managed this exception use cases on the client side. The Job status is never ever FAILED or SUSPENDED it is always RUNNING. The objective is that if the document can not be transformed the client will email the user saying it can not be transformed.

      In the normal use case when the document is transformed we get the correct job status COMPLETED.

      The code on the client side is as such:

      public void pollPdfPlatform() {

      logger.info("+ PdfaPollerServiceImpl.pollPdfPlatform() called");
      //on récupère tous les documents en attentes de transfo
      List<WaitingPdfa> documents = waitingPdfaDao.getAllWaitingPDFA();
      JobManager jobManager = new JobManager(getLiveCycleHelper().getServiceFactory());
      if (documents != null) {
      for (WaitingPdfa waitingPdfa : documents) {

      try {

      User user = waitingPdfa.getUserId();
      Item item = waitingPdfa.getItemId();

      //pour chaque document on check le status
      String invocationId = waitingPdfa.getProcessId();
      JobId myJobId = new JobId(invocationId);
      JobStatus jobStatus = null;
      jobStatus = jobManager.getStatus(myJobId);

      if (logger.isDebugEnabled()) {
      logger.debug("+ The current status of document with id [" + item.getItemId() + "] is " + jobStatus.toString());
      //Si le process est completed on archive le document
      if (jobStatus.getStatusCode() == JobStatus.JOB_STATUS_COMPLETED) {
      if (logger.isDebugEnabled()) {
      logger.debug("INVOCATION PDFA ITEM_ID : " + waitingPdfa.getItemId() + " COMPLETED SUCCESSFULLY!");

      InvocationResponse jobResponse = jobManager.getResponse(myJobId);
      InputStream docStream = null;
      Document docOut = (Document) jobManager.getResponse(myJobId).getOutputParameter("OutPDF");

      docStream = docOut.getInputStream();
      }catch(Exception e){

      // Get the archive Id.
      Long archiveId = getDocumentService().archiveDocument(UtilFile.readBytes(docStream), item, item.getNotarisable());

      if (logger.isDebugEnabled()) {
      logger.debug("Successfully archived document [" + archiveId + "] ");

      String mimeType = item.getMimeType();

      //on met a jours notre item
      item.setModifieLe(new Date());