Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  revert last change and use css to add whitespace which is currently ...
  Updated rector
  always add whitespace after id link
  UBO-235 Added filter support (#272)
  UBO-237 Upgrade jquery and jquery UI versions (#275)
  • Loading branch information
kkrebs committed Mar 31, 2023
2 parents 0eda685 + b56a153 commit a346d7c
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 15 deletions.
21 changes: 13 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.mycore</groupId>
<artifactId>mycore-parent</artifactId>
<version>48</version>
<relativePath />
<relativePath/>
</parent>

<groupId>org.mycore.ubo</groupId>
Expand Down Expand Up @@ -45,6 +46,8 @@
<MCR.AppName>ubo</MCR.AppName>
<axis1.version>1.4</axis1.version>
<java.target.version>11</java.target.version>
<jquery.ui.version>1.13.2</jquery.ui.version>
<jquery.version>3.5.1</jquery.version>
<mycore.version>2021.06.2-SNAPSHOT</mycore.version>
<node.version>v16.0.0</node.version>
<sortpom.sortDeps>scope,groupId,artifactId</sortpom.sortDeps>
Expand Down Expand Up @@ -158,8 +161,9 @@
<properties>
<MCR.DataPrefix>dev</MCR.DataPrefix>
<cargo.jvmargs>-DMCR.AppName=${MCR.AppName}
-Dsolr.solr.home=${solr.home}
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=${cargo.debug.suspend},address=${cargo.debug.address}</cargo.jvmargs>
-Dsolr.solr.home=${solr.home}
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=${cargo.debug.suspend},address=${cargo.debug.address}
</cargo.jvmargs>
</properties>
</profile>
<profile>
Expand Down Expand Up @@ -196,7 +200,8 @@
<configuration>
<properties>
<cargo.servlet.port>${cargo.servlet.port}</cargo.servlet.port>
<cargo.runtime.args>-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.JavaUtilLog</cargo.runtime.args>
<cargo.runtime.args>-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.JavaUtilLog
</cargo.runtime.args>
<cargo.jetty.realm.name>Restricted</cargo.jetty.realm.name>
</properties>
</configuration>
Expand Down Expand Up @@ -246,7 +251,7 @@
<cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
<cargo.tomcat.uriencoding>UTF-8</cargo.tomcat.uriencoding>
<!-- fixes IIIF identifier encoding issues -->
<cargo.start.jvmargs>-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true ${cargo.start.jvmargs}</cargo.start.jvmargs>
<cargo.start.jvmargs>-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true${cargo.start.jvmargs}</cargo.start.jvmargs>
</properties>
</configuration>
</configuration>
Expand Down Expand Up @@ -310,12 +315,12 @@
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.3.1</version>
<version>${jquery.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery-ui</artifactId>
<version>1.12.1</version>
<version>${jquery.ui.version}</version>
</dependency>
<dependency>
<groupId>org.webjars.npm</groupId>
Expand Down
36 changes: 36 additions & 0 deletions ubo-common/src/main/java/org/mycore/ubo/importer/ImportJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.concurrent.TimeUnit;

import org.apache.logging.log4j.LogManager;
Expand All @@ -30,6 +31,7 @@
import org.mycore.common.MCRTransactionHelper;
import org.mycore.common.config.MCRConfiguration2;
import org.mycore.common.content.MCRContent;
import org.mycore.common.content.MCRJDOMContent;
import org.mycore.common.content.transformer.MCRContentTransformer;
import org.mycore.common.content.transformer.MCRContentTransformerFactory;
import org.mycore.datamodel.metadata.MCRMetadataManager;
Expand Down Expand Up @@ -66,6 +68,8 @@ public int getNumPublications() {
return publications.size();
}

protected Optional<MCRContentTransformer> filterTransformer = null;

public void transform(MCRContent source) throws IOException, JDOMException, SAXException {
String transformerID = getTransformerID();
MCRContentTransformer transformer = MCRContentTransformerFactory.getTransformer(transformerID);
Expand Down Expand Up @@ -100,14 +104,46 @@ public void addFixedCategories(Element formInput) {

public void savePublications() throws MCRPersistenceException, MCRAccessException {
for (Document publication : publications) {
if (getFilterTransformer().isPresent()) {
publication = applyFilterTransformer(publication, getFilterTransformer().get());
}

MCRObject obj = new MCRObject(publication);
MCRObjectID oid = MCRObjectID.getNextFreeId(PROJECT_ID + "_mods");
obj.setId(oid);
obj.getService().addFlag("importID", id);

MCRMetadataManager.create(obj);
}
}

protected Optional<MCRContentTransformer> getFilterTransformer() {
if (filterTransformer == null) {
Optional<String> name = MCRConfiguration2.getString(
"MCR.ContentTransformer." + getTransformerID() + ".Filter");

if (name.isEmpty()) {
LOGGER.warn(
"Property 'MCR.ContentTransformer.{}.Filter' is not set. Set it to apply additional filtering before the publication is actually saved.",
getTransformerID());
filterTransformer = Optional.empty();
} else {
filterTransformer = Optional.of(MCRContentTransformerFactory.getTransformer(name.get()));
}
}

return filterTransformer;
}

private Document applyFilterTransformer(Document publication, MCRContentTransformer transformer) {
try {
return transformer.transform(new MCRJDOMContent(publication)).asXML();
} catch (JDOMException | IOException | SAXException e) {
LOGGER.error(e.getMessage(), e);
return publication;
}
}

public void transform(Element formInput) throws Exception {
LOGGER.info("Importing from " + getTransformerID() + "...");
MCRContent source = getSource(formInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<xed:bind xpath="@sourceType">
<div class="form-group form-inline">
<label for="{generate-id()}" class="mycore-form-label">Quell-Format :</label>
<label for="{generate-id()}" class="mycore-form-label">Quell-Format:</label>
<select id="{generate-id()}" class="form-control col-7 mr-1 custom-select" onchange="toggleEnrichment(this)">
<option value="BibTeX">BibTeX Quellcode</option>
<option value="ORCID">Publikationen aus dem ORCID Profil</option>
Expand All @@ -70,7 +70,7 @@

<xed:bind xpath="@targetType">
<div class="form-group form-inline">
<label for="{generate-id()}" class="mycore-form-label">Ausgabe-Format :</label>
<label for="{generate-id()}" class="mycore-form-label">Ausgabe-Format:</label>
<select id="{generate-id()}" class="form-control col custom-select">
<option value="preview-html">Vorschau (HTML)</option>
<option value="preview-mods-raw">Vorschau (MODS)</option>
Expand All @@ -81,7 +81,7 @@

<xed:bind xpath="@enrich" initially="false">
<div class="form-group form-inline">
<label class="mycore-form-label">aus externen Datenquellen anreichern :</label>
<label class="mycore-form-label">aus externen Datenquellen anreichern:</label>
<input type="radio" value="true" class="form-control ml-2 mr-2" id="enrich-yes" /><label for="enrich-yes">Ja</label>
<input type="radio" value="false" class="form-control ml-4 mr-2" id="enrich-no" /><label for="enrich-no" >Nein</label>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
<article class="card mb-3">
<div class="card-body">
<p>Gesetzliche Vertretung</p>
<h2>Der Rektor der Universität Duisburg-Essen</h2>
<h2>Die Rektorin der Universität Duisburg-Essen</h2>
<p>
Prof. Dr. Ulrich Radtke
Prof. Dr. Barbara Albert
<br />
<a href="mailto:rektor@uni-duisburg-essen.de">rektor@uni-duisburg-essen.de</a>
<a href="mailto:rektorin@uni-due.de">rektorin@uni-due.de</a>
</p>
<p>
Campus Duisburg:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@
content: "* \00A0";
}

.ubo-duplicateid-link::after {
content: " ";
}

// Large devices (desktops) and below: <= 1200px
@include media-breakpoint-down(lg) {
// add/overwrite styles for responsive level lg and lower
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ MCR.ContentTransformer.import.Opto2MCRObj.Stylesheet=xsl/import/csv2xml-opto2mod
MCR.ContentTransformer.import.PPN2XML.Class= org.mycore.ubo.importer.ppn.PPN2XMLTransformer
MCR.ContentTransformer.import.PPNList.Class=org.mycore.common.content.transformer.MCRTransformerPipe
MCR.ContentTransformer.import.PPNList.Steps=import.PPN2XML,import.PPNList2MCRObj
MCR.ContentTransformer.import.PPNList.Filter=supportedmods
MCR.ContentTransformer.import.PPNList2MCRObj.Class=org.mycore.common.content.transformer.MCRXSLTransformer
MCR.ContentTransformer.import.PPNList2MCRObj.Stylesheet=xsl/import/ppnlist2mods.xsl,xsl/import-mods2mycoreobject.xsl

Expand Down
2 changes: 1 addition & 1 deletion ubo-common/src/main/resources/xsl/duplicates.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</xsl:template>

<xsl:template match="id">
<a href="{$ServletsBaseURL}DozBibEntryServlet?id={text()}">
<a class="ubo-duplicateid-link" href="{$ServletsBaseURL}DozBibEntryServlet?id={text()}">
<xsl:value-of select="number(substring-after(text(),'mods_'))" />
</a>
<xsl:if test="position() != last()">
Expand Down

0 comments on commit a346d7c

Please sign in to comment.