DEV: Added fonts

This commit is contained in:
deiflaender 2020-11-17 14:28:15 +01:00
parent 44d365ca84
commit 06b2b964bd
3 changed files with 37 additions and 60 deletions

View File

@ -7,3 +7,12 @@ ENV PLATFORM_JAR ${PLATFORM_JAR}
ENV USES_ELASTICSEARCH false ENV USES_ELASTICSEARCH false
COPY ["${PLATFORM_JAR}", "/"] COPY ["${PLATFORM_JAR}", "/"]
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget cabextract xfonts-utils fonts-liberation \
&& rm -rf /var/lib/apt/lists/*
RUN curl http://ftp.br.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.7_all.deb -o /tmp/ttf-mscorefonts-installer_3.7_all.deb \
&& dpkg -i /tmp/ttf-mscorefonts-installer_3.7_all.deb \
&& rm /tmp/ttf-mscorefonts-installer_3.7_all.deb \

View File

@ -14,13 +14,10 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -47,16 +44,10 @@ import com.iqser.red.service.configuration.v1.api.model.DictionaryResponse;
import com.iqser.red.service.configuration.v1.api.model.RulesResponse; import com.iqser.red.service.configuration.v1.api.model.RulesResponse;
import com.iqser.red.service.configuration.v1.api.model.TypeResponse; import com.iqser.red.service.configuration.v1.api.model.TypeResponse;
import com.iqser.red.service.configuration.v1.api.model.TypeResult; import com.iqser.red.service.configuration.v1.api.model.TypeResult;
import com.iqser.red.service.redaction.v1.model.Comment;
import com.iqser.red.service.redaction.v1.model.IdRemoval;
import com.iqser.red.service.redaction.v1.model.ManualRedactionEntry;
import com.iqser.red.service.redaction.v1.model.ManualRedactions; import com.iqser.red.service.redaction.v1.model.ManualRedactions;
import com.iqser.red.service.redaction.v1.model.Point;
import com.iqser.red.service.redaction.v1.model.Rectangle;
import com.iqser.red.service.redaction.v1.model.RedactionLogEntry; import com.iqser.red.service.redaction.v1.model.RedactionLogEntry;
import com.iqser.red.service.redaction.v1.model.RedactionRequest; import com.iqser.red.service.redaction.v1.model.RedactionRequest;
import com.iqser.red.service.redaction.v1.model.RedactionResult; import com.iqser.red.service.redaction.v1.model.RedactionResult;
import com.iqser.red.service.redaction.v1.model.Status;
import com.iqser.red.service.redaction.v1.server.client.DictionaryClient; import com.iqser.red.service.redaction.v1.server.client.DictionaryClient;
import com.iqser.red.service.redaction.v1.server.client.RulesClient; import com.iqser.red.service.redaction.v1.server.client.RulesClient;
import com.iqser.red.service.redaction.v1.server.controller.RedactionController; import com.iqser.red.service.redaction.v1.server.controller.RedactionController;
@ -352,62 +343,39 @@ public class RedactionIntegrationTest {
public void testManualRedaction() throws IOException { public void testManualRedaction() throws IOException {
// { ClassPathResource redactionLogResource = new ClassPathResource("files/ManualRedactions.json");
// "id": "fed70e44fafdfd814d8caf4738296aa7", ManualRedactions manualRedactions = objectMapper.readValue(redactionLogResource.getInputStream(), ManualRedactions.class);
// "user": "9f649779-1b43-4ce1-926a-deadeecbdd94",
// "type": "manual",
// "value": "Shults",
// "reason": "the method of manufacture",
// "legalBasis": "Reg (EC) No 1107/2009 Art. 63 (2a)",
// "positions": [
// {
// "topLeft": {
// "x": 167.04001,
// "y": 449.00894
// },
// "width": 30.494343,
// "height": 11.852395,
// "page": 28
// }
// ],
// "status": "APPROVED",
// "addToDictionary": false,
// "requestDate": "2020-11-17T10:01:21Z",
// "processedDate": "2020-11-17T10:01:21Z"
// },
System.out.println("testManualRedaction"); System.out.println("testManualRedaction");
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
ClassPathResource pdfFileResource = new ClassPathResource("files/21 Chlorothalonil RAR 11 Volume 3CA B 9 August 2017-server.pdf"); ClassPathResource pdfFileResource = new ClassPathResource("files/21 Chlorothalonil RAR 11 Volume 3CA B 9 August 2017.pdf");
ManualRedactions manualRedactions = new ManualRedactions(); // ManualRedactions manualRedactions = new ManualRedactions();
//
String manualAddId = UUID.randomUUID().toString(); // String manualAddId = UUID.randomUUID().toString();
//
Comment comment = Comment.builder() // Comment comment = Comment.builder()
.date(OffsetDateTime.now()) // .date(OffsetDateTime.now())
.user("TEST_USER") // .user("TEST_USER")
.text("This is a comment test") // .text("This is a comment test")
.build(); // .build();
manualRedactions.setIdsToRemove(Set.of(IdRemoval.builder() // manualRedactions.setIdsToRemove(Set.of(IdRemoval.builder()
.id("0836727c3508a0b2ea271da69c04cc2f") // .id("0836727c3508a0b2ea271da69c04cc2f")
.status(Status.REQUESTED) // .status(Status.REQUESTED)
.build())); // .build()));
//
manualRedactions.getComments().put("e5be0f1d941bbb92a068e198648d06c4", List.of(comment)); // manualRedactions.getComments().put("e5be0f1d941bbb92a068e198648d06c4", List.of(comment));
manualRedactions.getComments().put("0836727c3508a0b2ea271da69c04cc2f", List.of(comment)); // manualRedactions.getComments().put("0836727c3508a0b2ea271da69c04cc2f", List.of(comment));
manualRedactions.getComments().put(manualAddId, List.of(comment)); // manualRedactions.getComments().put(manualAddId, List.of(comment));
//
ManualRedactionEntry manualRedactionEntry = new ManualRedactionEntry(); // ManualRedactionEntry manualRedactionEntry = new ManualRedactionEntry();
manualRedactionEntry.setId(manualAddId); // manualRedactionEntry.setId(manualAddId);
manualRedactionEntry.setStatus(Status.REQUESTED); // manualRedactionEntry.setStatus(Status.REQUESTED);
manualRedactionEntry.setType("name"); // manualRedactionEntry.setType("name");
manualRedactionEntry.setValue("O'Loughlin C.K."); // manualRedactionEntry.setValue("O'Loughlin C.K.");
manualRedactionEntry.setReason("Manual Redaction"); // manualRedactionEntry.setReason("Manual Redaction");
manualRedactionEntry.setPositions(List.of(new Rectangle(new Point(375.61096f, 241.282f), 7.648041f, 43.72262f, 1), new Rectangle(new Point(384.83517f, 241.282f), 7.648041f, 17.043358f, 1))); // manualRedactionEntry.setPositions(List.of(new Rectangle(new Point(375.61096f, 241.282f), 7.648041f, 43.72262f, 1), new Rectangle(new Point(384.83517f, 241.282f), 7.648041f, 17.043358f, 1)));
// manualRedactions.getEntriesToAdd().add(manualRedactionEntry); // manualRedactions.getEntriesToAdd().add(manualRedactionEntry);