Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable first step as automatic task #4853

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.net.URI;
import java.text.MessageFormat;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
Expand All @@ -35,7 +36,9 @@
import org.kitodo.data.database.beans.Process;
import org.kitodo.data.database.beans.Project;
import org.kitodo.data.database.beans.Ruleset;
import org.kitodo.data.database.beans.Task;
import org.kitodo.data.database.beans.Template;
import org.kitodo.data.database.enums.TaskStatus;
import org.kitodo.data.database.exceptions.DAOException;
import org.kitodo.data.exceptions.DataException;
import org.kitodo.exceptions.CommandException;
Expand All @@ -47,6 +50,7 @@
import org.kitodo.production.enums.ObjectType;
import org.kitodo.production.forms.BaseForm;
import org.kitodo.production.helper.Helper;
import org.kitodo.production.helper.tasks.TaskManager;
import org.kitodo.production.helper.TempProcess;
import org.kitodo.production.interfaces.RulesetSetupInterface;
import org.kitodo.production.metadata.MetadataEditor;
Expand All @@ -55,6 +59,7 @@
import org.kitodo.production.services.ServiceManager;
import org.kitodo.production.services.data.ImportService;
import org.kitodo.production.services.data.ProcessService;
import org.kitodo.production.thread.TaskScriptThread;
import org.primefaces.PrimeFaces;

@Named("CreateProcessForm")
Expand Down Expand Up @@ -436,6 +441,15 @@ private void createProcessHierarchy()
}
}
ServiceManager.getProcessService().save(getMainProcess(), true);
Task currentTask = ServiceManager.getProcessService().getCurrentTask(getMainProcess());
if (Objects.nonNull(currentTask)) {
if (currentTask.isTypeAutomatic()) {
BartChris marked this conversation as resolved.
Show resolved Hide resolved
currentTask.setProcessingStatus(TaskStatus.INWORK);
currentTask.setProcessingBegin(new Date());
TaskScriptThread thread = new TaskScriptThread(currentTask);
TaskManager.addTask(thread);
}
}
}

/**
Expand Down