Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature_download_r…
Browse files Browse the repository at this point in the history
…esources
  • Loading branch information
Florian Alpers committed Feb 27, 2025
2 parents 39e39e0 + 77b435f commit 527a57d
Show file tree
Hide file tree
Showing 13 changed files with 140 additions and 110 deletions.
77 changes: 44 additions & 33 deletions goobi-viewer-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
<jakarta.annotation-api.version>3.0.0</jakarta.annotation-api.version>
<jakarta.el.version>6.0.1</jakarta.el.version>
<jakarta.enterprise.version>4.1.0</jakarta.enterprise.version>
<jakarta.faces.version>4.1.2</jakarta.faces.version>
<jakarta.inject.version>2.0.1</jakarta.inject.version>
<jakarta.faces.version>4.1.2</jakarta.faces.version>
<jakarta.inject.version>2.0.1</jakarta.inject.version>
<jakarta.jms-api.version>3.1.0</jakarta.jms-api.version>
<jakarta.jstl.version>3.0.2</jakarta.jstl.version>
<jakarta.mail-api.version>2.1.3</jakarta.mail-api.version>
Expand All @@ -129,7 +129,7 @@
<!-- https://github.com/stleary/JSON-java -->
<json.version>20250107</json.version>
<jsoup.version>1.18.3</jsoup.version>
<junit.version>5.11.4</junit.version>
<junit.version>5.12.0</junit.version>
<log4j.version>2.24.3</log4j.version>
<mariadb-java-client.version>3.5.2</mariadb-java-client.version>
<mockito.version>5.15.2</mockito.version>
Expand All @@ -142,7 +142,7 @@
<reflections.version>0.10.2</reflections.version>
<rome.version>2.1.0</rome.version>
<spring.version>6.2.3</spring.version>
<slf4j.version>2.0.16</slf4j.version>
<slf4j.version>2.0.17</slf4j.version>
<solr.version>9.8.0</solr.version>
<swagger.version>2.2.28</swagger.version>
<tomcat.version>10.1.31</tomcat.version>
Expand All @@ -152,6 +152,19 @@
</properties>


<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${junit.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>


<dependencies>
<!-- intranda libraries -->
<dependency>
Expand Down Expand Up @@ -372,15 +385,15 @@
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.websocket/jakarta.websocket-api -->
<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-api</artifactId>
<version>${jakarta.websocket.version}</version>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-api</artifactId>
<version>${jakarta.websocket.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.websocket/jakarta.websocket-client-api -->
<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-client-api</artifactId>
<version>${jakarta.websocket.version}</version>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-client-api</artifactId>
<version>${jakarta.websocket.version}</version>
</dependency>
<dependency>
<groupId>jakarta.el</groupId>
Expand Down Expand Up @@ -408,18 +421,18 @@
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>${java-jwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>jwks-rsa</artifactId>
<version>${jwks-rsa.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>${java-jwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>jwks-rsa</artifactId>
<version>${jwks-rsa.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
Expand Down Expand Up @@ -530,13 +543,11 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -887,9 +898,9 @@
<configuration>
<failOnWarning>true</failOnWarning>
<ignoredUsedUndeclaredDependencies>
<!-- woodstox-core: used by jackson-dataformat -->
<ignoredUsedUndeclaredDependency>com.fasterxml.woodstox:woodstox-core</ignoredUsedUndeclaredDependency>
<!-- woodstox-core: used by jackson-dataformat -->
<ignoredUsedUndeclaredDependency>com.fasterxml.woodstox:woodstox-core</ignoredUsedUndeclaredDependency>

<!-- FALSE POSITIVE, SWITCHES WITH -jakarta PACKAGE IF DECLARED OTHER WAY ROUND -->
<ignoredUsedUndeclaredDependency>io.swagger.core.v3:swagger-annotations</ignoredUsedUndeclaredDependency>
<ignoredUsedUndeclaredDependency>io.swagger.core.v3:swagger-models</ignoredUsedUndeclaredDependency>
Expand Down Expand Up @@ -991,10 +1002,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<version>3.14.0</version>
<configuration>
<compilerArgs>
<!-- Explicitly enable annotation processing -->
<compilerArgs>
<!-- Explicitly enable annotation processing -->
<arg>-proc:full</arg>
<arg>-Xlint:deprecation</arg>
<arg>-Xlint:unchecked</arg>
Expand All @@ -1012,8 +1023,8 @@
</excludes>
<systemPropertyVariables>
<java.util.logging.config.file>src/test/resources/log4j2.test.xml</java.util.logging.config.file>
</systemPropertyVariables>
<argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar}</argLine>
</systemPropertyVariables>
<argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar}</argLine>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -1176,7 +1187,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.21.2</version>
<version>10.21.3</version>
</dependency>
</dependencies>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ public static String replaceAllMatches(String string, String matchRegex, Functio
String s = result.group();
String s1 = result.group(0);
int groupCount = result.groupCount();
List<String> groups = IntStream.range(0, result.groupCount() + 1).mapToObj(i -> result.group(i)).collect(Collectors.toList());
List<String> groups = IntStream.range(0, result.groupCount() + 1).mapToObj(result::group).toList();
String replacement = replacer.apply(groups);
buffer.replace(result.start(), result.end(), replacement);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ public boolean update(IDAO dao, CMSTemplateManager templateManager) throws DAOEx
}

}

dao.executeUpdate("RENAME TABLE roles TO user_roles");
return true;
}

return true;
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@
import java.sql.SQLException;
import java.util.Objects;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import io.goobi.viewer.controller.StringConstants;
import io.goobi.viewer.dao.IDAO;
import io.goobi.viewer.exceptions.DAOException;
import io.goobi.viewer.model.cms.pages.CMSTemplateManager;

public class TranslationUpdate implements IModelUpdate {

private static final Logger logger = LogManager.getLogger(TranslationUpdate.class);

private static final String[] TABLES = { "cs_campaign_translations", "cms_geomap_translation", "terms_of_use_translations", "translations" };

/** {@inheritDoc} */
Expand All @@ -42,6 +47,7 @@ public boolean update(IDAO dao, CMSTemplateManager templateManager) throws DAOEx
if (dao.tableExists(table)) {
boolean newColumnHasEntries = dao.getNativeQueryResults("SELECT translation_value FROM " + table).stream().anyMatch(Objects::nonNull);
if (!newColumnHasEntries) {
logger.debug("Updating table: {}", table);
dao.executeUpdate(StringConstants.SQL_ALTER_TABLE + table + " DROP translation_value;");
try {
dao.executeUpdate(StringConstants.SQL_ALTER_TABLE + table + " RENAME COLUMN value TO translation_value");
Expand All @@ -54,12 +60,11 @@ public boolean update(IDAO dao, CMSTemplateManager templateManager) throws DAOEx
if (!dao.columnsExists("cms_pages", "page_template_id")) {
dao.executeUpdate(StringConstants.SQL_ALTER_TABLE + table + " ADD COLUMN page_template_id varchar(255);");
}

return true;
}

}
}

return true;
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ public class UserUpdate implements IModelUpdate {
@Override
@SuppressWarnings("unchecked")
public boolean update(IDAO dao, CMSTemplateManager templateManager) throws DAOException, SQLException {
boolean ret = false;

// Update table name
if (dao.tableExists("users")) {

// Delete new table with anonymous use, if already created by EclipseLink
if (dao.tableExists(TABLE_NAME_CURRENT)) {
boolean newTableEmpty = dao.getNativeQueryResults("SELECT * FROM " + TABLE_NAME_CURRENT).size() <= 1;
Expand All @@ -52,8 +54,9 @@ public boolean update(IDAO dao, CMSTemplateManager templateManager) throws DAOEx
}

}

dao.executeUpdate("RENAME TABLE users TO " + TABLE_NAME_CURRENT);
ret = true;
}

if (dao.columnsExists(TABLE_NAME_CURRENT, "use_gravatar")) {
Expand All @@ -62,9 +65,10 @@ public boolean update(IDAO dao, CMSTemplateManager templateManager) throws DAOEx
dao.executeUpdate("UPDATE " + TABLE_NAME_CURRENT + " SET avatar_type='GRAVATAR' WHERE " + TABLE_NAME_CURRENT + ".user_id=" + userId);
}
dao.executeUpdate(StringConstants.SQL_ALTER_TABLE + TABLE_NAME_CURRENT + " DROP COLUMN use_gravatar");
ret = true;
}

return true;
return ret;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private static Locale checkAndLoadResourceBundles(Locale inLocale) {
// Bundle could have been initialized by a different thread in the meanwhile
if (!localBundles.containsKey(locale)
|| (reloadNeededMap.containsKey(locale.getLanguage()) && reloadNeededMap.get(locale.getLanguage()))) {
logger.debug("Reloading local resource bundle for '{}'...", locale.getLanguage());
// logger.trace("Reloading local resource bundle for '{}'...", locale.getLanguage());
try {
ResourceBundle localBundle = loadLocalResourceBundle(locale);
if (localBundle != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public Metadata setType(int type) {
*/
public List<StringPair> getSortFields() {
if (StringUtils.isEmpty(sortField)) {
return null;
return Collections.emptyList();
}

return Collections.singletonList(new StringPair(sortField, "asc"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ private static SolrDocumentList filterChildDocs(SolrDocumentList docs, String ma
} else {
ownerDocs.put(ownerIDDoc, null); //put an empty entry to mark that the owner doc needs to be added to result list
}

}
} else if (hitType == HitType.DOCSTRCT) {
if (ownerDocs.containsKey(iddoc)) {
Expand Down Expand Up @@ -1485,9 +1484,11 @@ public static String applyHighlightingToPhrase(String phrase, Set<String> terms)

String highlightedValue = phrase;
for (final String t : terms) {
// Remove quotation
String term = StringTools.removeQuotations(t);
//remove fuzzy search suffix
FuzzySearchTerm fuzzyTerm = new FuzzySearchTerm(t);
String term = fuzzyTerm.getTerm();
FuzzySearchTerm fuzzyTerm = new FuzzySearchTerm(term);
term = fuzzyTerm.getTerm();
// Highlighting single-character terms can take a long time, so skip them
if (term.length() < 2) { //NOSONAR Debug
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,30 @@

<composite:implementation>

<!-- CUSTOM SIDEBAR -->
<c:if test="#{!cmsPage.useDefaultSidebar}">
<h:panelGroup binding="#{cmsSidebarWidgetsBean.sidebarGroup}"></h:panelGroup>
</c:if>

<!-- DEFAULT SIDEBAR -->
<c:if test="#{cmsPage.useDefaultSidebar}">

<!-- GLOBAL -->
<c:if test="#{!cmsBean.relatedWorkLoaded}">
<c:if test="#{browseBean.browsingMenuEnabled}">
<widgetComponent:widget_browsing />
</c:if>
<c:if test="#{cmsPage.published or userBean.hasAdminBackendAccess}">

<!-- CUSTOM SIDEBAR -->
<c:if test="#{!cmsPage.useDefaultSidebar}">
<h:panelGroup binding="#{cmsSidebarWidgetsBean.sidebarGroup}"></h:panelGroup>
</c:if>

<!-- WORK -->
<c:if test="#{cmsBean.relatedWorkLoaded}">
<!-- DEFAULT SIDEBAR -->
<c:if test="#{cmsPage.useDefaultSidebar}">

<viewerComponent:record_sidebar/>
<!-- GLOBAL -->
<c:if test="#{!cmsBean.relatedWorkLoaded}">
<c:if test="#{browseBean.browsingMenuEnabled}">
<widgetComponent:widget_browsing />
</c:if>
</c:if>

<!-- WORK -->
<c:if test="#{cmsBean.relatedWorkLoaded}">
<viewerComponent:record_sidebar />
</c:if>

</c:if>

</c:if>



</composite:implementation>
</ui:composition>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 527a57d

Please sign in to comment.