Skip to content

Commit cafa36c

Browse files
authored
Merge pull request #1174 from qbicsoftware/development
Release
2 parents b0b07f0 + 0304194 commit cafa36c

File tree

129 files changed

+8950
-2190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+8950
-2190
lines changed

GoogleStyle.xml

Lines changed: 601 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ Therefore, in order to be able to run the application, a keystore must be set-up
233233

234234
#### Setup keystore
235235

236-
Before the Java keystore can be referenced in Data Manager's configuration, it has to be created in the first place.
236+
Before the Java keystore can be referenced in Data Manager's configuration, it has to be created in
237+
the first place.
237238

238239
You will need [keytool](https://docs.oracle.com/en/java/javase/11/tools/keytool.html) for this step.
239240

@@ -245,7 +246,8 @@ Start the setup with a dummy entry for creation of a keystore file in PKSC12 for
245246

246247
This secures the keystore with the `mysecretpassword` password. Change it to something only you have
247248
access and with
248-
Please choose a strong password. The application will fail for passwords with entropy below 100. The entropy of your password is calculated as follows
249+
Please choose a strong password. The application will fail for passwords with entropy below 100. The
250+
entropy of your password is calculated as follows
249251

250252
$$
251253
H = -\sum_{i=1}^{n} P(x_i) \log_2 P(x_i) \times n > 100.,
@@ -271,7 +273,9 @@ Verify:
271273
```bash
272274
keytool -list -keystore keystore.p12 -storetype PKCS12 -storepass mysecretpassword
273275
```
276+
274277
which should show something like:
278+
275279
```text
276280
Keystore type: PKCS12
277281
Keystore provider: SUN
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package life.qbic.application.commons;
2+
3+
import java.io.IOException;
4+
import java.io.InputStream;
5+
import java.nio.ByteBuffer;
6+
import java.util.Iterator;
7+
import java.util.Objects;
8+
9+
/**
10+
* An input stream generated from a (lazy) iterator of {@link ByteBuffer}s.
11+
*/
12+
public class ByteBufferIteratorInputStream extends InputStream {
13+
14+
private final Iterator<ByteBuffer> bufferIterator;
15+
private ByteBuffer currentBuffer;
16+
17+
public ByteBufferIteratorInputStream(Iterator<ByteBuffer> iterator) {
18+
this.bufferIterator = iterator;
19+
}
20+
21+
@Override
22+
public int read(byte[] b, int off, int len) throws IOException {
23+
Objects.checkFromIndexSize(off, len, b.length);
24+
if (len == 0) {
25+
return 0;
26+
}
27+
boolean bufferAvailable = makeBufferAvailable();
28+
if (!bufferAvailable) {
29+
return -1;
30+
}
31+
32+
int requestedBytes = Math.min(currentBuffer.remaining(), len);
33+
currentBuffer.get(currentBuffer.position(), b, off, requestedBytes);
34+
currentBuffer.position(currentBuffer.position() + requestedBytes);
35+
36+
return requestedBytes;
37+
}
38+
39+
@Override
40+
public int read() {
41+
boolean bufferAvailable = makeBufferAvailable();
42+
if (!bufferAvailable) {
43+
return -1;
44+
}
45+
var currentPosition = currentBuffer.position();
46+
var value = currentBuffer.get(currentPosition) & 0xFF;
47+
currentBuffer.position(currentPosition + 1);
48+
return value;
49+
}
50+
51+
/**
52+
* Ensures a readable buffer is set.
53+
*
54+
* @return true if a readable buffer is selected; false if no readable buffer is available.
55+
*/
56+
private boolean makeBufferAvailable() {
57+
var buffer = currentBuffer;
58+
if (buffer != null && !buffer.hasRemaining()) {
59+
// the current buffer is read completely
60+
buffer = null;
61+
}
62+
while (buffer == null) {
63+
if (!bufferIterator.hasNext()) {
64+
return false;
65+
}
66+
buffer = bufferIterator.next();
67+
}
68+
currentBuffer = buffer;
69+
return true;
70+
}
71+
}

user-interface/src/main/java/life/qbic/datamanager/files/export/FileNameFormatter.java renamed to application-commons/src/main/java/life/qbic/application/commons/FileNameFormatter.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package life.qbic.datamanager.files.export;
1+
package life.qbic.application.commons;
22

33
import java.time.LocalDate;
44
import java.time.format.DateTimeFormatter;
@@ -15,6 +15,14 @@ private FileNameFormatter() {
1515

1616
}
1717

18+
public static String formatWithTimestampedSimple(LocalDate localDate, String project, String type, String extension) {
19+
return DATE_FORMATTER.format(localDate)
20+
+ PART_JOINER
21+
+ replaceForbiddenCharacters(project)
22+
+ PART_JOINER
23+
+ replaceForbiddenCharacters(type)
24+
+ "." + replaceForbiddenCharacters(extension);
25+
}
1826

1927
public static String formatWithTimestampedContext(LocalDate timestamp, String projectPart,
2028
String experimentPart, String type, String extension) {
@@ -33,7 +41,7 @@ private static String replaceForbiddenCharacters(String input) {
3341
}
3442

3543
private static String replaceSpaces(String projectPart) {
36-
return projectPart.replaceAll("\\s", SPACE_REPLACEMENT);
44+
return projectPart.trim().replaceAll("\\s", SPACE_REPLACEMENT);
3745
}
3846

3947
private static String replaceSlashes(String input) {

finances-api/src/main/java/life/qbic/finances/api/Offer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515
* @since 1.0.0
1616
*/
1717
public record Offer(String id, String title, String objective, String experimentDescription) {
18-
1918
}

project-management-infrastructure/pom.xml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@
3232
<version>1.9.4</version>
3333
<scope>compile</scope>
3434
</dependency>
35+
<dependency>
36+
<groupId>com.fasterxml.jackson.core</groupId>
37+
<artifactId>jackson-databind</artifactId>
38+
</dependency>
39+
<dependency>
40+
<groupId>com.fasterxml.jackson.core</groupId>
41+
<artifactId>jackson-core</artifactId>
42+
</dependency>
43+
<dependency>
44+
<groupId>com.fasterxml.jackson.core</groupId>
45+
<artifactId>jackson-annotations</artifactId>
46+
</dependency>
3547
<dependency>
3648
<groupId>life.qbic</groupId>
3749
<artifactId>openbis-api</artifactId>
@@ -55,6 +67,81 @@
5567
<groupId>org.springframework.security</groupId>
5668
<artifactId>spring-security-oauth2-client</artifactId>
5769
</dependency>
70+
<dependency>
71+
<groupId>org.docx4j</groupId>
72+
<artifactId>docx4j-JAXB-ReferenceImpl</artifactId>
73+
<version>11.5.0</version>
74+
</dependency>
75+
76+
77+
<!-- Needed for building RO-Crates -->
78+
<dependency>
79+
<groupId>edu.kit.datamanager</groupId>
80+
<artifactId>ro-crate-java</artifactId>
81+
<version>1.1.1</version>
82+
<exclusions>
83+
<exclusion>
84+
<groupId>org.slf4j</groupId>
85+
<artifactId>slf4j-log4j12</artifactId>
86+
</exclusion>
87+
<exclusion>
88+
<groupId>log4j</groupId>
89+
<artifactId>log4j</artifactId>
90+
</exclusion>
91+
<exclusion>
92+
<groupId>org.slf4j</groupId>
93+
<artifactId>slf4j-jdk14</artifactId>
94+
</exclusion>
95+
</exclusions>
96+
</dependency>
97+
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml -->
98+
<dependency>
99+
<groupId>com.fasterxml.jackson.dataformat</groupId>
100+
<artifactId>jackson-dataformat-yaml</artifactId>
101+
</dependency>
102+
103+
104+
<!-- docx4j dependencies !-->
105+
<!-- https://mvnrepository.com/artifact/org.docx4j/docx4j-core -->
106+
<dependency>
107+
<groupId>org.docx4j</groupId>
108+
<artifactId>docx4j-core</artifactId>
109+
<version>11.5.0</version>
110+
<exclusions>
111+
<exclusion>
112+
<groupId>org.slf4j</groupId>
113+
<artifactId>slf4j-log4j12</artifactId>
114+
</exclusion>
115+
<exclusion>
116+
<groupId>log4j</groupId>
117+
<artifactId>log4j</artifactId>
118+
</exclusion>
119+
</exclusions>
120+
</dependency>
121+
<!-- Needed for docx4j !-->
122+
<dependency>
123+
<groupId>org.glassfish.jaxb</groupId>
124+
<artifactId>jaxb-runtime</artifactId>
125+
<version>4.0.5</version>
126+
</dependency>
127+
<dependency>
128+
<groupId>jakarta.xml.bind</groupId>
129+
<artifactId>jakarta.xml.bind-api</artifactId>
130+
<version>4.0.2</version>
131+
</dependency>
132+
133+
<!-- Needed for xlsx support !-->
134+
<dependency>
135+
<groupId>org.apache.poi</groupId>
136+
<artifactId>poi</artifactId>
137+
<version>5.4.0</version>
138+
</dependency>
139+
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
140+
<dependency>
141+
<groupId>org.apache.poi</groupId>
142+
<artifactId>poi-ooxml</artifactId>
143+
<version>5.4.0</version>
144+
</dependency>
58145
</dependencies>
59146

60147
</project>

user-interface/src/main/java/life/qbic/datamanager/files/TempDirectory.java renamed to project-management-infrastructure/src/main/java/life/qbic/projectmanagement/infrastructure/TempDirectory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package life.qbic.datamanager.files;
1+
package life.qbic.projectmanagement.infrastructure;
22

33
import java.io.IOException;
44
import java.nio.file.Files;
@@ -8,7 +8,7 @@
88
import org.springframework.stereotype.Component;
99

1010
/**
11-
* <b>Temporary Director</b>
11+
* <b>Temporary Directory</b>
1212
* <p>
1313
* Provides a temporary directory for the application to use when files need to be created for
1414
* exporting them.

user-interface/src/main/java/life/qbic/datamanager/files/export/DocxBuilder.java renamed to project-management-infrastructure/src/main/java/life/qbic/projectmanagement/infrastructure/api/fair/rocrate/DocxBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package life.qbic.datamanager.files.export;
1+
package life.qbic.projectmanagement.infrastructure.api.fair.rocrate;
22

33
import java.util.Collections;
44
import java.util.List;
5-
import life.qbic.datamanager.files.export.FileSupplier.FormatException;
5+
import life.qbic.projectmanagement.infrastructure.api.fair.rocrate.FileSupplier.FormatException;
66
import org.docx4j.openpackaging.exceptions.Docx4JException;
77
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
88
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;

user-interface/src/main/java/life/qbic/datamanager/files/export/DocxFileSupplier.java renamed to project-management-infrastructure/src/main/java/life/qbic/projectmanagement/infrastructure/api/fair/rocrate/DocxFileSupplier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package life.qbic.datamanager.files.export;
1+
package life.qbic.projectmanagement.infrastructure.api.fair.rocrate;
22

33
import java.io.File;
44
import org.docx4j.openpackaging.exceptions.Docx4JException;

user-interface/src/main/java/life/qbic/datamanager/files/export/FileSupplier.java renamed to project-management-infrastructure/src/main/java/life/qbic/projectmanagement/infrastructure/api/fair/rocrate/FileSupplier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package life.qbic.datamanager.files.export;
1+
package life.qbic.projectmanagement.infrastructure.api.fair.rocrate;
22

33
import java.io.File;
44

0 commit comments

Comments
 (0)