MCR.MODS.EnrichmentResolver.DataSources.<configname>
.
+ */
+@MCRCommandGroup(name = "Enrichment Commands")
+public class EnrichmentCommands {
+
+ private final static Logger LOGGER = LogManager.getLogger();
+
+ @MCRCommand(syntax = "enrich {0} with config {1}",
+ help = "Enriches existing MODS metadata {0} with a given enrichment configuration {1}", order = 40)
+ public static void enrichMods(String modsId, String configID) {
+ try {
+ MCRObject obj = MCRMetadataManager.retrieveMCRObject(MCRObjectID.getInstance(modsId));
+ Element mods = new MCRMODSWrapper(obj).getMODS();
+ MCREnricher enricher = new MCREnricher(configID);
+ enricher.enrich(mods);
+ MCRMetadataManager.update(obj);
+ } catch (MCRException | MCRAccessException e) {
+ LOGGER.error("Error while trying to enrich {} with configuration {}: ", modsId, configID, e);
+ }
+ }
+
+}
diff --git a/ubo-common/src/main/java/org/mycore/ubo/importer/DozBibImportServlet.java b/ubo-common/src/main/java/org/mycore/ubo/importer/DozBibImportServlet.java
index 52447452b..61fdf4db3 100644
--- a/ubo-common/src/main/java/org/mycore/ubo/importer/DozBibImportServlet.java
+++ b/ubo-common/src/main/java/org/mycore/ubo/importer/DozBibImportServlet.java
@@ -9,25 +9,29 @@
package org.mycore.ubo.importer;
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-
-import javax.xml.transform.TransformerException;
-
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.jdom2.Document;
import org.jdom2.Element;
+import org.jdom2.output.XMLOutputter;
import org.mycore.access.MCRAccessException;
import org.mycore.common.content.MCRJDOMContent;
+import org.mycore.frontend.MCRFrontendUtil;
import org.mycore.frontend.servlets.MCRServlet;
import org.mycore.frontend.servlets.MCRServletJob;
+import org.mycore.services.queuedjob.MCRJob;
+import org.mycore.services.queuedjob.MCRJobQueue;
import org.mycore.ubo.AccessControl;
import org.mycore.ubo.DozBibEntryServlet;
import org.mycore.ubo.importer.evaluna.EvalunaImportJob;
+import org.mycore.user2.MCRUserManager;
import org.xml.sax.SAXException;
+import javax.xml.transform.TransformerException;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+
@SuppressWarnings("serial")
public class DozBibImportServlet extends MCRServlet {
@@ -47,8 +51,23 @@ public void doGetPost(MCRServletJob job) throws Exception {
private void handleImportJob(HttpServletRequest req, HttpServletResponse res) throws Exception {
Document doc = (Document) (req.getAttribute("MCRXEditorSubmission"));
- Element formInput = doc.detachRootElement();
+ String doAsync = doc.getRootElement().getAttributeValue("async");
+ if ("true".equals(doAsync)) {
+ MCRJob job = new MCRJob(ImportListJobAction.class);
+ job.setParameter(ImportListJobAction.EDITOR_SUBMISSION_PARAMETER, new XMLOutputter().outputString(doc));
+ job.setParameter(ImportListJobAction.USER_ID_PARAMETER, MCRUserManager.getCurrentUser().getUserName());
+ MCRJobQueue.getInstance(ImportListJobAction.class).offer(job);
+ String referer = req.getHeader("Referer");
+ if (referer != null) {
+ res.sendRedirect(referer+"&list-submitted=true");
+ } else {
+ res.sendRedirect(MCRFrontendUtil.getBaseURL());
+ }
+ return;
+ }
+
+ Element formInput = doc.detachRootElement();
ImportJob importJob = buildImportJob(formInput);
importJob.transform(formInput);
diff --git a/ubo-common/src/main/java/org/mycore/ubo/importer/ImportListJobAction.java b/ubo-common/src/main/java/org/mycore/ubo/importer/ImportListJobAction.java
new file mode 100644
index 000000000..c17166b0c
--- /dev/null
+++ b/ubo-common/src/main/java/org/mycore/ubo/importer/ImportListJobAction.java
@@ -0,0 +1,115 @@
+package org.mycore.ubo.importer;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.jdom2.Document;
+import org.jdom2.Element;
+import org.jdom2.input.SAXBuilder;
+import org.mycore.common.MCRMailer;
+import org.mycore.common.config.MCRConfiguration2;
+import org.mycore.frontend.MCRFrontendUtil;
+import org.mycore.services.i18n.MCRTranslation;
+import org.mycore.services.queuedjob.MCRJob;
+import org.mycore.services.queuedjob.MCRJobAction;
+import org.mycore.ubo.importer.evaluna.EvalunaImportJob;
+import org.mycore.user2.MCRUser;
+import org.mycore.user2.MCRUserManager;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+
+/**
+ * Allows to execute a list import asynchronously. It executes the same tasks as in {@link DozBibImportServlet}.
+ *
+ * @author shermann (Silvio Hermann)
+ * */
+public class ImportListJobAction extends MCRJobAction {
+
+ public static String EDITOR_SUBMISSION_PARAMETER = "xEditorSubmission";
+ public static String USER_ID_PARAMETER = "userName";
+ public static String IMPORT_JOB_ID_PARAMETER = "importJobId";
+
+ protected static final Logger LOGGER = LogManager.getLogger(ImportListJobAction.class);
+
+ protected static final Optional
- Über dieses Formular können Sie eine Literaturliste im
- BibTeX Format,
- alle Publikationen einer gegebenen ORCID oder eine CSV-Datei importieren.
+