Skip to content

Commit d0836a0

Browse files
author
Dominick Leppich
committed
Merge pull request 'Release v25.02' (#23) from release_25.02 into master
2 parents 57bdff3 + d0bb948 commit d0836a0

File tree

10 files changed

+167
-172
lines changed

10 files changed

+167
-172
lines changed

.github/workflows/develop-build.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ jobs:
1414
steps:
1515
- name: Check out source code
1616
uses: actions/checkout@v4
17-
- name: Set up JDK 17
18-
uses: actions/setup-java@v1
17+
- name: Set up JDK 21
18+
uses: actions/setup-java@v4
1919
with:
20-
java-version: 17
20+
distribution: 'temurin'
21+
java-version: 21
2122
- name: Set up Maven cache
22-
uses: actions/cache@v1
23+
uses: actions/cache@v4
2324
with:
2425
path: ~/.m2/repository
2526
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

.github/workflows/release-build.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ jobs:
1414
steps:
1515
- name: Check out source code
1616
uses: actions/checkout@v4
17-
- name: Set up JDK 17
18-
uses: actions/setup-java@v1
17+
- name: Set up JDK 21
18+
uses: actions/setup-java@v4
1919
with:
20-
java-version: 17
20+
distribution: 'temurin'
21+
java-version: 21
2122
- name: Set up Maven cache
22-
uses: actions/cache@v1
23+
uses: actions/cache@v4
2324
with:
2425
path: ~/.m2/repository
2526
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}

Jenkinsfile

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ pipeline {
33

44
agent {
55
docker {
6-
/* using a custom build image with a defined home directory for UID 1000 among other things */
7-
image 'nexus.intranda.com:4443/maven:3.9.3-eclipse-temurin-17'
8-
registryUrl 'https://nexus.intranda.com:4443'
9-
registryCredentialsId 'jenkins-docker'
6+
image 'maven:3-eclipse-temurin-21'
107
args '-v $HOME/.m2:/var/maven/.m2:z -v $HOME/.config:/var/maven/.config -v $HOME/.sonar:/var/maven/.sonar -u 1000 -ti -e _JAVA_OPTIONS=-Duser.home=/var/maven -e MAVEN_CONFIG=/var/maven/.m2'
118
}
129
}

module-base/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>io.goobi.workflow.plugin</groupId>
55
<artifactId>plugin-administration-wellcome</artifactId>
6-
<version>24.12</version>
6+
<version>25.02</version>
77
</parent>
88
<artifactId>plugin-administration-wellcome-base</artifactId>
99
<packaging>jar</packaging>

module-base/src/main/java/de/intranda/counterscript/model/MetadataInformation.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
import java.util.Date;
44

5-
import javax.xml.bind.annotation.XmlRootElement;
6-
75
import com.fasterxml.jackson.annotation.JsonAutoDetect;
86
import com.fasterxml.jackson.annotation.JsonFormat;
97
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
108

9+
import jakarta.xml.bind.annotation.XmlRootElement;
1110
import lombok.AccessLevel;
1211
import lombok.Data;
1312
import lombok.experimental.FieldDefaults;

module-base/src/main/java/de/intranda/goobi/plugins/BNumberDeletionPlugin.java

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
@PluginImplementation
4141
public class BNumberDeletionPlugin implements IAdministrationPlugin, IPlugin {
4242

43+
private static final long serialVersionUID = -4478973187665181921L;
44+
4345
private String bnumber;
4446

4547
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

module-base/src/main/java/de/intranda/goobi/plugins/CounterscriptPlugin.java

+93-94
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,30 @@
88
import java.util.Date;
99
import java.util.List;
1010

11-
import javax.faces.context.ExternalContext;
12-
import javax.ws.rs.client.Client;
13-
import javax.ws.rs.client.ClientBuilder;
14-
import javax.ws.rs.client.WebTarget;
15-
import javax.ws.rs.core.GenericType;
16-
1711
import org.goobi.beans.User;
1812
import org.goobi.production.enums.PluginType;
1913
import org.goobi.production.plugin.interfaces.IAdministrationPlugin;
2014
import org.goobi.production.plugin.interfaces.IPlugin;
15+
import org.jfree.util.Log;
2116

2217
import de.intranda.counterscript.model.MetadataInformation;
2318
import de.sub.goobi.config.ConfigPlugins;
2419
import de.sub.goobi.helper.FacesContextHelper;
2520
import de.sub.goobi.helper.Helper;
21+
import jakarta.faces.context.ExternalContext;
22+
import jakarta.ws.rs.client.Client;
23+
import jakarta.ws.rs.client.ClientBuilder;
24+
import jakarta.ws.rs.client.WebTarget;
25+
import jakarta.ws.rs.core.GenericType;
2626
import lombok.Cleanup;
2727
import lombok.Data;
2828
import net.xeoh.plugins.base.annotations.PluginImplementation;
2929

3030
@PluginImplementation
3131
public @Data class CounterscriptPlugin implements IAdministrationPlugin, IPlugin {
3232

33-
private String REST_URL = "http://localhost:8081/Counterscript/api/";
33+
private static final long serialVersionUID = 2320742556608952269L;
34+
private String restUrl = "http://localhost:8081/Counterscript/api/";
3435
private String token;
3536

3637
private static final String TITLE = "Counterscript";
@@ -42,10 +43,10 @@
4243
private boolean includeOutdatedData = false;
4344
private String currentNumber;
4445

45-
private List<MetadataInformation> dataList = null;
46-
private List<MetadataInformation> detailList = null;
46+
private transient List<MetadataInformation> dataList = null;
47+
private transient List<MetadataInformation> detailList = null;
4748

48-
private int NUMBER_OF_OBJECTS_PER_PAGE = 10;
49+
private int entriesPerPage = 10;
4950

5051
private int pageNo = 0;
5152

@@ -54,11 +55,10 @@
5455
public CounterscriptPlugin() {
5556
User user = Helper.getCurrentUser();
5657
if (user != null) {
57-
NUMBER_OF_OBJECTS_PER_PAGE = user.getTabellengroesse();
58+
entriesPerPage = user.getTabellengroesse();
5859
}
59-
REST_URL = ConfigPlugins.getPluginConfig(PLUGIN_TITLE).getString("rest_url", "http://localhost:8080/Counterscript/api/");
60+
restUrl = ConfigPlugins.getPluginConfig(PLUGIN_TITLE).getString("rest_url", "http://localhost:8080/Counterscript/api/");
6061
token = ConfigPlugins.getPluginConfig(PLUGIN_TITLE).getString("rest_token");
61-
// REST_URL = ConfigPlugins.getPluginConfig(this).getString("rest_url", "http://localhost:8080/Counterscript/api/");
6262

6363
}
6464

@@ -72,31 +72,27 @@ public String getTitle() {
7272
return TITLE;
7373
}
7474

75-
public String getDescription() {
76-
return TITLE;
77-
}
78-
7975
@Override
8076
public String getGui() {
8177
return "/uii/administration_Counterscript.xhtml";
8278
}
8379

8480
public void getData() {
85-
Client client = ClientBuilder.newClient();
86-
WebTarget base = client.target(REST_URL);
87-
WebTarget xml = base.path("xml");
88-
if (includeOutdatedData) {
89-
xml = xml.path("withinactive");
90-
}
81+
try (Client client = ClientBuilder.newClient()) {
82+
WebTarget base = client.target(restUrl);
83+
WebTarget xml = base.path("xml");
84+
if (includeOutdatedData) {
85+
xml = xml.path("withinactive");
86+
}
9187

92-
if (startDate != null && endDate != null) {
93-
String start = dateConverter.format(startDate);
94-
String end = dateConverter.format(endDate);
95-
xml = xml.path(start).path(end);
88+
if (startDate != null && endDate != null) {
89+
String start = dateConverter.format(startDate);
90+
String end = dateConverter.format(endDate);
91+
xml = xml.path(start).path(end);
92+
}
93+
dataList = xml.request().header("token", token).get(new GenericType<List<MetadataInformation>>() {
94+
});
9695
}
97-
dataList = xml.request().header("token", token).get(new GenericType<List<MetadataInformation>>() {
98-
});
99-
10096
}
10197

10298
public void resetData() {
@@ -105,80 +101,83 @@ public void resetData() {
105101
}
106102

107103
public void getDetails() {
108-
Client client = ClientBuilder.newClient();
109-
WebTarget base = client.target(REST_URL);
110-
WebTarget xml = base.path("xml");
111-
xml = xml.path("bnumber").path(currentNumber);
112-
detailList = xml.request().header("token", token).get(new GenericType<List<MetadataInformation>>() {
113-
});
104+
try (Client client = ClientBuilder.newClient()) {
105+
WebTarget base = client.target(restUrl);
106+
WebTarget xml = base.path("xml");
107+
xml = xml.path("bnumber").path(currentNumber);
108+
detailList = xml.request().header("token", token).get(new GenericType<List<MetadataInformation>>() {
109+
});
110+
}
114111
}
115112

116113
public void download() {
117114

118-
Client client = ClientBuilder.newClient();
119-
WebTarget base = client.target(REST_URL);
120-
WebTarget csv = base.path("csv");
121-
if (includeOutdatedData) {
122-
csv = csv.path("withinactive");
123-
}
124-
125-
if (startDate != null && endDate != null) {
126-
String start = dateConverter.format(startDate);
127-
String end = dateConverter.format(endDate);
128-
csv = csv.path(start).path(end);
129-
}
130-
csv = csv.queryParam("token", token);
131-
try {
132-
ExternalContext ec = FacesContextHelper.getCurrentFacesContext().getExternalContext();
133-
134-
ec.responseReset(); // Some JSF component library or some Filter might have set some headers in the
135-
// buffer beforehand. We want to get rid of them, else it may collide.
136-
ec.setResponseContentType("text/csv"); // Check http://www.iana.org/assignments/media-types for all types.
137-
// Use if necessary ExternalContext#getMimeType() for auto-detection
138-
// based on filename.
139-
ec.setResponseHeader("Content-Disposition", "attachment; filename=\"counterscript.csv\""); // The Save As
140-
// popup magic
141-
// is done here.
142-
// You can give
143-
// it any file
144-
// name you
145-
// want, this
146-
// only won't
147-
// work in MSIE,
148-
// it will use
149-
// current
150-
// request URL
151-
// as file name
152-
// instead.
153-
154-
OutputStream outStream = ec.getResponseOutputStream();
155-
156-
@Cleanup
157-
InputStream inStream = csv.getUri().toURL().openStream();
158-
159-
byte[] buffer = new byte[1024];
160-
161-
int length;
162-
163-
while ((length = inStream.read(buffer)) > 0) {
164-
outStream.write(buffer, 0, length);
115+
try (Client client = ClientBuilder.newClient()) {
116+
WebTarget base = client.target(restUrl);
117+
WebTarget csv = base.path("csv");
118+
if (includeOutdatedData) {
119+
csv = csv.path("withinactive");
165120
}
166-
FacesContextHelper.getCurrentFacesContext().responseComplete(); // Important! Otherwise JSF will attempt to
167-
// render the response which obviously will
168-
// fail since it's already written with a
169-
// file and closed.
170121

171-
} catch (IOException e) {
122+
if (startDate != null && endDate != null) {
123+
String start = dateConverter.format(startDate);
124+
String end = dateConverter.format(endDate);
125+
csv = csv.path(start).path(end);
126+
}
127+
csv = csv.queryParam("token", token);
128+
try {
129+
ExternalContext ec = FacesContextHelper.getCurrentFacesContext().getExternalContext();
130+
131+
ec.responseReset(); // Some JSF component library or some Filter might have set some headers in the
132+
// buffer beforehand. We want to get rid of them, else it may collide.
133+
ec.setResponseContentType("text/csv"); // Check http://www.iana.org/assignments/media-types for all types.
134+
// Use if necessary ExternalContext#getMimeType() for auto-detection
135+
// based on filename.
136+
ec.setResponseHeader("Content-Disposition", "attachment; filename=\"counterscript.csv\""); // The Save As
137+
// popup magic
138+
// is done here.
139+
// You can give
140+
// it any file
141+
// name you
142+
// want, this
143+
// only won't
144+
// work in MSIE,
145+
// it will use
146+
// current
147+
// request URL
148+
// as file name
149+
// instead.
150+
151+
OutputStream outStream = ec.getResponseOutputStream();
152+
153+
@Cleanup
154+
InputStream inStream = csv.getUri().toURL().openStream();
155+
156+
byte[] buffer = new byte[1024];
157+
158+
int length;
159+
160+
while ((length = inStream.read(buffer)) > 0) {
161+
outStream.write(buffer, 0, length);
162+
}
163+
FacesContextHelper.getCurrentFacesContext().responseComplete(); // Important! Otherwise JSF will attempt to
164+
// render the response which obviously will
165+
// fail since it's already written with a
166+
// file and closed.
167+
168+
} catch (IOException e) {
169+
Log.error(e);
170+
}
172171
}
173172
}
174173

175174
public List<MetadataInformation> getPaginatorList() {
176175
List<MetadataInformation> subList = new ArrayList<>();
177176
if (dataList != null) {
178-
if (dataList.size() > (pageNo * NUMBER_OF_OBJECTS_PER_PAGE) + NUMBER_OF_OBJECTS_PER_PAGE) {
179-
subList = dataList.subList(pageNo * NUMBER_OF_OBJECTS_PER_PAGE, (pageNo * NUMBER_OF_OBJECTS_PER_PAGE) + NUMBER_OF_OBJECTS_PER_PAGE);
177+
if (dataList.size() > (pageNo * entriesPerPage) + entriesPerPage) {
178+
subList = dataList.subList(pageNo * entriesPerPage, (pageNo * entriesPerPage) + entriesPerPage);
180179
} else {
181-
subList = dataList.subList(pageNo * NUMBER_OF_OBJECTS_PER_PAGE, dataList.size());
180+
subList = dataList.subList(pageNo * entriesPerPage, dataList.size());
182181
}
183182
}
184183
return subList;
@@ -228,8 +227,8 @@ public int getTxtMoveTo() {
228227
}
229228

230229
public int getLastPageNumber() {
231-
int ret = new Double(Math.floor(this.dataList.size() / NUMBER_OF_OBJECTS_PER_PAGE)).intValue();
232-
if (this.dataList.size() % NUMBER_OF_OBJECTS_PER_PAGE == 0) {
230+
int ret = Double.valueOf(Math.floor(this.dataList.size() / entriesPerPage)).intValue();
231+
if (this.dataList.size() % entriesPerPage == 0) {
233232
ret--;
234233
}
235234
return ret;
@@ -244,7 +243,7 @@ public boolean isLastPage() {
244243
}
245244

246245
public boolean hasNextPage() {
247-
return this.dataList.size() > NUMBER_OF_OBJECTS_PER_PAGE;
246+
return this.dataList.size() > entriesPerPage;
248247
}
249248

250249
public boolean hasPreviousPage() {

module-gui/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>io.goobi.workflow.plugin</groupId>
55
<artifactId>plugin-administration-wellcome</artifactId>
6-
<version>24.12</version>
6+
<version>25.02</version>
77
</parent>
88
<artifactId>plugin-administration-wellcome-gui</artifactId>
99
<packaging>jar</packaging>

0 commit comments

Comments
 (0)