All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pageseeder.ox.berlioz.generator.CheckStepJobStatus Maven / Gradle / Ivy

There is a newer version: 2.2.93
Show newest version
/*
 * Copyright 2021 Allette Systems (Australia)
 * http://www.allette.com.au
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.pageseeder.ox.berlioz.generator;

import org.pageseeder.berlioz.BerliozException;
import org.pageseeder.berlioz.content.ContentGenerator;
import org.pageseeder.berlioz.content.ContentRequest;
import org.pageseeder.berlioz.content.ContentStatus;
import org.pageseeder.ox.core.JobStatus;
import org.pageseeder.ox.core.StepJob;
import org.pageseeder.ox.process.StepJobManager;
import org.pageseeder.xmlwriter.XMLWriter;

import java.io.IOException;

/**
 * 

A generator to check the step job status.

* *

Parameters

*
    *
  • id the job id
  • * * * @author Carlos Cabral * @version 27 February 2017 */ public class CheckStepJobStatus implements ContentGenerator { @Override public void process(ContentRequest req, XMLWriter xml) throws BerliozException, IOException { String id = req.getParameter("id"); if (id == null) { req.setStatus(ContentStatus.BAD_REQUEST); return; } StepJobManager manager = new StepJobManager(); JobStatus status = manager.checkJobStatus(id); if (status == null) { req.setStatus(ContentStatus.NOT_FOUND); return; } // print the status xml status.toXML(xml); // print the job xml. StepJob job = manager.getJobId(id); job.toXML(xml); if (!status.hasCompleted()) { req.setStatus(ContentStatus.ACCEPTED); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy