1 package org.collectionspace.services.batch.nuxeo;
3 import java.util.Arrays;
4 import org.collectionspace.services.batch.AbstractBatchInvocable;
5 import org.collectionspace.services.common.api.Tools;
6 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory;
9 public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
11 final String CLASSNAME = this.getClass().getSimpleName();
12 final Logger logger = LoggerFactory.getLogger(UpdateObjectLocationBatchJob.class);
14 // Initialization tasks
15 public UpdateObjectLocationBatchJob() {
16 setSupportedInvocationModes(Arrays.asList(INVOCATION_MODE_SINGLE));
20 * The main work logic of the batch job. Will be called after setContext.
25 setCompletionStatus(STATUS_MIN_PROGRESS);
27 // FIXME: Placeholder during early development
28 if (logger.isInfoEnabled()) {
29 logger.info("Invoking " + CLASSNAME + " ...");
30 logger.info("Invocation context is: " + getInvocationContext().getMode());
32 if (!requestedInvocationModeIsSupported()) {
33 setInvocationModeNotSupportedResult();
36 if (requestIsForInvocationModeSingle()) {
37 csid = getInvocationContext().getSingleCSID();
38 if (Tools.isBlank(csid)) {
39 throw new Exception("Could not find required CSID value in the context for this batch job.");
41 logger.info("CSID value is: " + csid);
43 String docType = getInvocationContext().getDocType();
44 } catch (Exception e) {
45 String errMsg = "Error encountered in " + CLASSNAME + ": " + e.getLocalizedMessage();
46 setErrorResult(errMsg);
48 setCompletionStatus(STATUS_COMPLETE);