Skip to content

Commit

Permalink
Merge pull request 'Release v24.12' (!359) from release_24.12 into ma…
Browse files Browse the repository at this point in the history
…ster
  • Loading branch information
Dominick Leppich committed Jan 13, 2025
2 parents 15a1d5c + 9c01ad7 commit b4f6648
Show file tree
Hide file tree
Showing 39 changed files with 453 additions and 173 deletions.
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ RUN echo $build; if [ "$build" = "true" ]; then mvn clean package; elif [ -f "/w
FROM tomcat:9-jre17 AS assemble
LABEL maintainer="Matthias Geerdsen <[email protected]>"

ENV DB_SERVER goobi-db
ENV DB_SERVER workflow-db
ENV DB_PORT 3306
ENV DB_NAME goobi
ENV DB_USER goobi
ENV DB_PASSWORD goobi

RUN ["/bin/bash","-c", "mkdir -p /opt/digiverso/goobi/{activemq,config,lib,metadata,rulesets,scripts,static_assets,tmp,xslt,plugins/{administration,command,dashboard,export,GUI,import,opac,statistics,step,validation,workflow}}"]
RUN mkdir -p /usr/local/tomcat/conf/Catalina/localhost/ && mkdir -p /usr/local/tomcat/webapps/goobi
RUN mkdir -p /usr/local/tomcat/conf/Catalina/localhost/ && mkdir -p /usr/local/tomcat/webapps/workflow

COPY install/docker/goobi.xml.template /usr/local/tomcat/conf/goobi.xml.template
COPY install/docker/goobi.xml.template /usr/local/tomcat/conf/workflow.xml.template
COPY install/config/ /opt/digiverso/goobi/config/
COPY install/rulesets/ /opt/digiverso/goobi/rulesets/
COPY install/scripts/ /opt/digiverso/goobi/scripts/
Expand All @@ -29,7 +29,7 @@ COPY install/docker/setenv.sh /usr/local/tomcat/bin/setenv.sh
COPY install/docker/server.xml /usr/local/tomcat/conf/server.xml
COPY install/docker/run.sh /run.sh
COPY install/docker/log4j.xml /opt/digiverso/log4j.xml
COPY install/docker/log4j2.xml /opt/digiverso/log4j.xml
COPY install/docker/log4j2.xml /opt/digiverso/log4j2.xml

COPY install/docker/dummy.sh /opt/digiverso/goobi/scripts/
RUN sed -i 's/^script_createSymLink=script_createSymLink.sh/script_createSymLink=dummy.sh/' /opt/digiverso/goobi/config/goobi_config.properties
Expand Down Expand Up @@ -58,12 +58,16 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
rm -rf ${CATALINA_HOME}/webapps/*

# redirect / to /goobi/
# redirect / to /workflow/
RUN mkdir ${CATALINA_HOME}/webapps/ROOT && \
echo '<% response.sendRedirect("/goobi/"); %>' > ${CATALINA_HOME}/webapps/ROOT/index.jsp
echo '<% response.sendRedirect("/workflow/"); %>' > ${CATALINA_HOME}/webapps/ROOT/index.jsp

COPY --from=build /workflow/target/*.war /
RUN unzip /*.war -d /usr/local/tomcat/webapps/goobi && rm /*.war
RUN unzip /*.war -d /usr/local/tomcat/webapps/workflow && rm /*.war

# Manually patch this until 'workflow' is used everywhere
RUN sed -i 's/goobi\.xml/workflow\.xml/g' /run.sh
RUN sed -i 's/\/goobi\/jvmtemp/\/workflow\/jvmtemp/g' /run.sh

EXPOSE 8080
CMD ["/run.sh"]
6 changes: 6 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ pipeline {
branch 'master'
branch 'hotfix_release_*'
branch 'develop'
expression {
return env.BRANCH_NAME =~ /_docker$/
}
}
}
steps {
Expand All @@ -247,6 +250,9 @@ pipeline {
//}
if (env.GIT_BRANCH == 'origin/develop' || env.GIT_BRANCH == 'develop') {
dockerimage_public.push("develop")
} else if (env.GIT_BRANCH.endsWith('_docker')) {
image_tag = env.GIT_BRANCH.substring(0, env.GIT_BRANCH.size()-7).replaceAll("/","_")
dockerimage_public.push(image_tag)
}
if (latestTag != '') {
dockerimage_public.push(latestTag)
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Goobi workflow is an open-source software application for digitisation projects.

## Community

Goobi workflow is currently used for every day production inside of digitisation projects within approx. 70 cultural heritage institutions in 17 countries. The community website is located here:
Goobi workflow is currently used for every day production inside of digitisation projects within approx. 120 cultural heritage institutions in more than 20 countries. The community website is located here:

https://goobi.io

Expand All @@ -28,21 +28,21 @@ https://docs.goobi.io/docs/

A complete German documentation regarding Goobi workflow can be found using this URL:

https://docs.goobi.io/goobi-workflow-de/
https://docs.goobi.io/goobi-workflow/de/

The English documentation for Goobi workflow is located here:

https://docs.goobi.io/goobi-workflow-en/
https://docs.goobi.io/goobi-workflow/en/

## Plugin Documentation

Currently there are about 180 different plugins for Goobi workflow. Not all of those are currently documented. However, the new documentation area lists the first new documented plugins here:
Currently there are about 370 different plugins for Goobi workflow. Not all of those are currently documented. However, the new documentation area lists approx. 160 documented plugins here:

German documentation of the plugins:
https://docs.goobi.io/goobi-workflow-plugins-de/
https://docs.goobi.io/workflow-plugins/de/

English documentation of the plugins:
https://docs.goobi.io/goobi-workflow-plugins-en/
https://docs.goobi.io/workflow-plugins/en/

## Development

Expand Down Expand Up @@ -106,6 +106,9 @@ At present, Goobi supports the following file formats:
- OBJ and STL
- Open Office
- Microsoft Office
- Several video formats
- Several audio formats
- Several 3D-object formats

## Searching for more information?

Expand Down
1 change: 1 addition & 0 deletions docs
Submodule docs added at ab1ea8
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.goobi.workflow</groupId>
<artifactId>workflow-base</artifactId>
<version>24.11</version>
<version>24.12</version>
<relativePath/>
</parent>
<artifactId>workflow-core</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/de/sub/goobi/config/ConfigurationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -1390,4 +1390,8 @@ private void saveLocalConfig() {
}
}
}

public int getMaxDatabaseConnectionRetries() {
return getLocalInt("maxDatabaseConnectionRetries", 5);
}
}
17 changes: 15 additions & 2 deletions src/main/java/de/sub/goobi/forms/ProzesskopieForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import org.goobi.production.properties.AccessCondition;
import org.goobi.production.properties.ProcessProperty;
import org.goobi.production.properties.PropertyParser;
import org.goobi.production.properties.Type;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
Expand Down Expand Up @@ -2135,8 +2136,20 @@ public List<ProcessProperty> getConfiguredProperties() {
match = false;
for (StringPair sp : prop.getProcessCreationConditions()) {
for (ProcessProperty other : configuredProperties) {
if (other.getName().equals(sp.getOne()) && sp.getTwo().equals(other.getValue())) {
match = true;
if (other.getName().equals(sp.getOne())) {
Optional<String> otherValue = Optional.empty();
if (Type.VOCABULARYREFERENCE.equals(other.getType())) {
try {
otherValue = Optional.of(VocabularyAPIManager.getInstance().vocabularyRecords().get(Long.parseLong(other.getValue())).getMainValue());
} catch (NumberFormatException e) {
log.error("Unable to read ID \"{}\"", other.getValue());
}
} else {
otherValue = Optional.ofNullable(other.getValue());
}
if (otherValue.orElse("").equals(sp.getTwo())) {
match = true;
}
}
}
}
Expand Down
35 changes: 32 additions & 3 deletions src/main/java/de/sub/goobi/helper/VariableReplacer.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.naming.ConfigurationException;

import io.goobi.workflow.api.vocabulary.VocabularyAPIManager;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.text.StringTokenizer;
import org.goobi.beans.Masterpiece;
Expand All @@ -64,6 +67,7 @@
import lombok.Getter;
import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import org.goobi.production.properties.Type;
import ugh.dl.DigitalDocument;
import ugh.dl.DocStruct;
import ugh.dl.Metadata;
Expand Down Expand Up @@ -491,7 +495,24 @@ public String replace(String inString) {
List<ProcessProperty> ppList = PropertyParser.getInstance().getPropertiesForProcess(this.process);
for (ProcessProperty pe : ppList) {
if (pe.getName().equalsIgnoreCase(propertyTitle)) {
inString = inString.replace(r.group(), pe.getValue() == null ? "" : pe.getValue());
Optional<String> newValue;
if (Type.VOCABULARYREFERENCE.equals(pe.getType())) {
newValue = Optional.of(VocabularyAPIManager.getInstance().vocabularyRecords().get(pe.getValue()).getMainValue());
} else if (Type.VOCABULARYMULTIREFERENCE.equals(pe.getType())) {
if (!StringUtils.isBlank(pe.getValue())) {
String value = pe.getValue();
// weird case, but only use first value here
if (value.contains("; ")) {
value = value.substring(0, value.indexOf("; "));
}
newValue = Optional.of(VocabularyAPIManager.getInstance().vocabularyRecords().get(value).getMainValue());
} else {
newValue = Optional.empty();
}
} else {
newValue = Optional.ofNullable(pe.getValue());
}
inString = inString.replace(r.group(), newValue.orElse(""));
break;
}
}
Expand All @@ -503,8 +524,16 @@ public String replace(String inString) {
List<ProcessProperty> ppList = PropertyParser.getInstance().getPropertiesForProcess(this.process);
for (ProcessProperty pe : ppList) {
if (pe.getName().equalsIgnoreCase(propertyTitle)) {
if (pe.getValue() != null) {
newValues.add(pe.getValue());
if (Type.VOCABULARYREFERENCE.equals(pe.getType())) {
Optional.of(VocabularyAPIManager.getInstance().vocabularyRecords().get(pe.getValue()).getMainValue()).ifPresent(newValues::add);
} else if (Type.VOCABULARYMULTIREFERENCE.equals(pe.getType())) {
if (!StringUtils.isBlank(pe.getValue())) {
for (String ref : pe.getValue().split("; ")) {
Optional.of(VocabularyAPIManager.getInstance().vocabularyRecords().get(ref).getMainValue()).ifPresent(newValues::add);
}
}
} else {
Optional.ofNullable(pe.getValue()).ifPresent(newValues::add);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class DatabaseVersion {

// TODO ALTER TABLE metadata add fulltext(value) after mysql is version 5.6 or higher

public static int getCurrentVersion() {
public static int getCurrentVersion() throws SQLException {

Connection connection = null;
StringBuilder sql = new StringBuilder();
Expand All @@ -70,8 +70,6 @@ public static int getCurrentVersion() {
log.trace(sql.toString());
}
return new QueryRunner().query(connection, sql.toString(), MySQLHelper.resultSetToIntegerHandler);
} catch (SQLException e) {
log.error(e);
} finally {
if (connection != null) {
try {
Expand All @@ -81,7 +79,6 @@ public static int getCurrentVersion() {
}
}
}
return 0;
}

public static void updateDatabase(int currentVersion) {
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/de/sub/goobi/persistence/managers/MySQLHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import de.sub.goobi.config.ConfigurationHelper;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.format.DateTimeFormat;
Expand All @@ -57,7 +58,6 @@
public class MySQLHelper implements Serializable {

private static final long serialVersionUID = -1396485589047649760L;
private static final int MAX_TRIES_NEW_CONNECTION = 5;
private static final int TIME_FOR_CONNECTION_VALID_CHECK = 5;

private static MySQLHelper helper = new MySQLHelper();
Expand Down Expand Up @@ -189,33 +189,33 @@ public static boolean checkMariadbVersion(String dbVersion) {
}

public Connection getConnection() throws SQLException {
Connection connection = null;

Connection connection = this.cm.getDataSource().getConnection(); //NOSONAR, Connection is closed by the methods that requested the connection
if (connection.isValid(TIME_FOR_CONNECTION_VALID_CHECK)) {
return connection;
}

for (int i = 0; i < MAX_TRIES_NEW_CONNECTION; i++) {
int maxAttempts = ConfigurationHelper.getInstance().getMaxDatabaseConnectionRetries();

log.warn("Connection failed: Trying to get new connection. Attempt:" + i);
for (int attempt = 1; attempt <= maxAttempts; attempt++) {
try {
connection = this.cm.getDataSource().getConnection(); //NOSONAR, Connection is closed by the methods that requested the connection
if (connection.isValid(TIME_FOR_CONNECTION_VALID_CHECK)) {
return connection;
}
} catch (SQLException e) {
log.error("Connection failed: Trying to get new connection. Attempt: {} of {}", attempt, maxAttempts);
}
}

try {
log.error("Connection failed: Trying to get a connection from a new ConnectionManager");
this.cm = new ConnectionManager();
connection = this.cm.getDataSource().getConnection(); //NOSONAR, Connection is closed by the methods that requested the connection

if (connection.isValid(TIME_FOR_CONNECTION_VALID_CHECK)) {
return connection;
}
} catch (SQLException e) {
log.error("Connection failed!");
}

log.warn("Connection failed: Trying to get a connection from a new ConnectionManager");
this.cm = new ConnectionManager();
connection = this.cm.getDataSource().getConnection(); //NOSONAR, Connection is closed by the methods that requested the connection

if (connection.isValid(TIME_FOR_CONNECTION_VALID_CHECK)) {
return connection;
}

log.error("Connection failed!");

return connection;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;

import javax.faces.model.SelectItem;
Expand Down Expand Up @@ -289,13 +286,42 @@ public List<SelectItem> getRecordSelectItems(long vocabularyId) {
}

public List<SelectItem> getRecordSelectItems(VocabularyRecordQueryBuilder query) {
return query
return getAllHierarchicalRecords(query)
.stream()
.map(r -> new SelectItem(String.valueOf(r.getId()), r.getSelectItemLabel()))
.toList();
}

public List<ExtendedVocabularyRecord> getAllHierarchicalRecords(long vocabularyId) {
return getAllHierarchicalRecords(list(vocabularyId));
}

public List<ExtendedVocabularyRecord> getAllHierarchicalRecords(VocabularyRecordQueryBuilder query) {
List<ExtendedVocabularyRecord> topRecords = query
.all()
.request()
.getContent()
.stream()
.map(r -> new SelectItem(String.valueOf(r.getId()), r.getMainValue()))
.sorted(Comparator.comparing(SelectItem::getLabel))
.collect(Collectors.toList());
.getContent();
topRecords.sort(Comparator.comparing(ExtendedVocabularyRecord::getMainValue));
return fullyLoadChildren(topRecords);
}

public List<ExtendedVocabularyRecord> fullyLoadChildren(List<ExtendedVocabularyRecord> records) {
List<ExtendedVocabularyRecord> allRecords = new LinkedList<>();
recursivelyPopulateRecordList(allRecords, records);
return allRecords;
}

private void recursivelyPopulateRecordList(List<ExtendedVocabularyRecord> list, Collection<ExtendedVocabularyRecord> records) {
for (ExtendedVocabularyRecord r : records) {
list.add(r);

List<ExtendedVocabularyRecord> children = Optional.ofNullable(r.getChildren())
.map(l -> l.stream()
.map(id -> VocabularyAPIManager.getInstance().vocabularyRecords().get(id))
.sorted(Comparator.comparing(ExtendedVocabularyRecord::getMainValue))
.toList())
.orElse(Collections.emptyList());
recursivelyPopulateRecordList(list, children);
}
}
}
Loading

0 comments on commit b4f6648

Please sign in to comment.