Skip to content

Commit

Permalink
switched to DSF 0.7.0-SNAPSHOT, remove not needed code and dependencies
Browse files Browse the repository at this point in the history
These changes depend on highmed/highmed-dsf#354 being merged.
  • Loading branch information
hhund committed Jun 13, 2022
1 parent 2197f92 commit 4cdaffd
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 286 deletions.
174 changes: 0 additions & 174 deletions codex-process-data-transfer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,6 @@
<artifactId>dsf-tools-documentation-generator</artifactId>
</dependency>

<!-- TODO add org.springframework:spring-web to dsf-bpe-process-base's dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<!-- TODO add org.highmed.dsf:dsf-fhir-validation to dsf-bpe-process-base's dependencies -->
<dependency>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-fhir-validation</artifactId>
<scope>provided</scope>
</dependency>
<!-- TODO add org.apache.commons:commons-compress to dsf-bpe-process-base's dependencies -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<scope>provided</scope>
</dependency>
<!-- TODO add de.hs-heilbronn.mi:log4j2-utils to dsf-bpe-process-base's dependencies -->
<dependency>
<groupId>de.hs-heilbronn.mi</groupId>
<artifactId>log4j2-utils</artifactId>
<scope>provided</scope>
</dependency>
<!-- TODO add org.slf4j:jul-to-slf4j to dsf-bpe-process-base's dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<scope>provided</scope>
</dependency>

<!-- must be added as regular DSF plugins -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
Expand Down Expand Up @@ -148,149 +117,6 @@
<artifactId>hapi-fhir-client</artifactId>
<version>${hapi.version}</version>
</artifactItem>

<!-- TODO vv remove when part of dsf-bpe-process-base dependencies -->
<artifactItem>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r5</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.r5</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-converter</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.convertors</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.5.1-5</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.validation</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.dstu2</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.dstu2016may</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.dstu3</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
<version>1.1.4c</version>
</artifactItem>
<artifactItem>
<groupId>xpp3</groupId>
<artifactId>xpp3_xpath</artifactId>
<version>1.1.4c</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.21</version>
</artifactItem>
<artifactItem>
<groupId>org.fhir</groupId>
<artifactId>ucum</artifactId>
<version>1.0.2</version>
</artifactItem>
<artifactItem>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.9.RELEASE</version>
</artifactItem>
<artifactItem>
<groupId>ognl</groupId>
<artifactId>ognl</artifactId>
<version>3.1.12</version>
</artifactItem>
<artifactItem>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
</artifactItem>
<artifactItem>
<groupId>org.attoparser</groupId>
<artifactId>attoparser</artifactId>
<version>2.0.4.RELEASE</version>
</artifactItem>
<artifactItem>
<groupId>org.unbescape</groupId>
<artifactId>unbescape</artifactId>
<version>1.1.5.RELEASE</version>
</artifactItem>
<artifactItem>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.7.0</version>
</artifactItem>
<artifactItem>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>2.6.0</version>
</artifactItem>
<artifactItem>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<version>2.3.3</version>
</artifactItem>
<artifactItem>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</artifactItem>
<artifactItem>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r5</artifactId>
<version>${hapi.version}</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</artifactItem>
<!-- TODO ^^ remove when part of dsf-bpe-process-base dependencies -->

</artifactItems>
<outputDirectory>../codex-processes-ap1-docker-test-setup/dic/bpe/plugin</outputDirectory>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.bouncycastle.pkcs.PKCSException;
import org.highmed.dsf.fhir.json.ObjectMapperFactory;
import org.highmed.dsf.fhir.validation.SnapshotGenerator;
import org.highmed.dsf.fhir.validation.ValueSetExpander;
import org.highmed.dsf.fhir.validation.ValueSetExpanderImpl;
import org.highmed.dsf.tools.generator.ProcessDocumentation;
Expand All @@ -37,7 +38,6 @@

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
import de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.validation.PluginSnapshotGenerator;
import de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.validation.PluginSnapshotGeneratorImpl;
import de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.validation.PluginSnapshotGeneratorWithFileSystemCache;
import de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.validation.ValidationPackageClient;
Expand Down Expand Up @@ -238,7 +238,7 @@ private StructureDefinitionModifier createStructureDefinitionModifier(String cla
}

@Bean
public BiFunction<FhirContext, IValidationSupport, PluginSnapshotGenerator> internalSnapshotGeneratorFactory()
public BiFunction<FhirContext, IValidationSupport, SnapshotGenerator> internalSnapshotGeneratorFactory()
{
return (fc, vs) -> new PluginSnapshotGeneratorWithFileSystemCache(structureDefinitionCacheFolder(), fc,
new PluginSnapshotGeneratorImpl(fc, vs));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
package de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.validation;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import org.hl7.fhir.r4.conformance.ProfileUtilities;
import org.highmed.dsf.fhir.validation.SnapshotGeneratorImpl;
import org.hl7.fhir.r4.context.IWorkerContext;
import org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;

public class PluginSnapshotGeneratorImpl implements PluginSnapshotGenerator
public class PluginSnapshotGeneratorImpl extends SnapshotGeneratorImpl
{
private static final Logger logger = LoggerFactory.getLogger(PluginSnapshotGeneratorImpl.class);

private final IWorkerContext worker;

public PluginSnapshotGeneratorImpl(FhirContext fhirContext, IValidationSupport validationSupport)
{
worker = createWorker(fhirContext, validationSupport);
super(fhirContext, validationSupport);
}

protected IWorkerContext createWorker(FhirContext context, IValidationSupport validationSupport)
Expand All @@ -32,38 +20,4 @@ protected IWorkerContext createWorker(FhirContext context, IValidationSupport va
workerContext.setLocale(context.getLocalizer().getLocale());
return new PluginWorkerContext(workerContext);
}

@Override
public PluginSnapshotWithValidationMessages generateSnapshot(StructureDefinition differential)
{
Objects.requireNonNull(differential, "differential");

logger.debug("Generating snapshot for StructureDefinition with id {}, url {}, version {}, base {}",
differential.getIdElement().getIdPart(), differential.getUrl(), differential.getVersion(),
differential.getBaseDefinition());

StructureDefinition base = worker.fetchResource(StructureDefinition.class, differential.getBaseDefinition());

if (base == null)
logger.warn("Base definition with url {} not found", differential.getBaseDefinition());

/* ProfileUtilities is not thread safe */
List<ValidationMessage> messages = new ArrayList<>();
ProfileUtilities profileUtils = new ProfileUtilities(worker, messages, null);

profileUtils.generateSnapshot(base, differential, "", "", null);

if (messages.isEmpty())
logger.debug("Snapshot generated for StructureDefinition with id {}, url {}, version {}",
differential.getIdElement().getIdPart(), differential.getUrl(), differential.getVersion());
else
{
logger.warn("Snapshot not generated for StructureDefinition with id {}, url {}, version {}",
differential.getIdElement().getIdPart(), differential.getUrl(), differential.getVersion());
messages.forEach(m -> logger.warn("Issue while generating snapshot: {} - {} - {}", m.getDisplay(),
m.getLine(), m.getMessage()));
}

return new PluginSnapshotWithValidationMessages(differential, messages);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.util.Collections;
import java.util.Objects;

import org.highmed.dsf.fhir.validation.SnapshotGenerator;
import org.highmed.dsf.fhir.validation.SnapshotGenerator.SnapshotWithValidationMessages;
import org.hl7.fhir.r4.model.Enumerations.PublicationStatus;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.slf4j.Logger;
Expand All @@ -16,12 +18,12 @@
import ca.uhn.fhir.context.FhirContext;

public class PluginSnapshotGeneratorWithFileSystemCache
extends AbstractFhirResourceFileSystemCache<PluginSnapshotWithValidationMessages, StructureDefinition>
implements PluginSnapshotGenerator, InitializingBean
extends AbstractFhirResourceFileSystemCache<SnapshotWithValidationMessages, StructureDefinition>
implements SnapshotGenerator, InitializingBean
{
private static final Logger logger = LoggerFactory.getLogger(ValidationPackageClientWithFileSystemCache.class);

private final PluginSnapshotGenerator delegate;
private final SnapshotGenerator delegate;

/**
* For JSON content with gzip compression using the <code>.json.xz</code> file name suffix.
Expand All @@ -37,7 +39,7 @@ public class PluginSnapshotGeneratorWithFileSystemCache
* @see AbstractFileSystemCache#IN_COMPRESSOR_FACTORY
*/
public PluginSnapshotGeneratorWithFileSystemCache(Path cacheFolder, FhirContext fhirContext,
PluginSnapshotGenerator delegate)
SnapshotGenerator delegate)
{
super(cacheFolder, StructureDefinition.class, fhirContext);

Expand All @@ -47,7 +49,7 @@ public PluginSnapshotGeneratorWithFileSystemCache(Path cacheFolder, FhirContext
public PluginSnapshotGeneratorWithFileSystemCache(Path cacheFolder, String fileNameSuffix,
FunctionWithIoException<OutputStream, OutputStream> outCompressorFactory,
FunctionWithIoException<InputStream, InputStream> inCompressorFactory, FhirContext fhirContext,
PluginSnapshotGenerator delegate)
SnapshotGenerator delegate)
{
super(cacheFolder, fileNameSuffix, outCompressorFactory, inCompressorFactory, StructureDefinition.class,
fhirContext);
Expand All @@ -64,26 +66,26 @@ public void afterPropertiesSet() throws Exception
}

@Override
public PluginSnapshotWithValidationMessages generateSnapshot(StructureDefinition structureDefinition)
public SnapshotWithValidationMessages generateSnapshot(StructureDefinition structureDefinition)
{
Objects.requireNonNull(structureDefinition, "differential");

if (structureDefinition.hasSnapshot())
{
logger.debug("StructureDefinition {}|{} has snapshot", structureDefinition.getUrl(),
structureDefinition.getVersion());
return new PluginSnapshotWithValidationMessages(structureDefinition, Collections.emptyList());
return new SnapshotWithValidationMessages(structureDefinition, Collections.emptyList());
}

Objects.requireNonNull(structureDefinition.getUrl(), "structureDefinition.url");
Objects.requireNonNull(structureDefinition.getVersion(), "structureDefinition.version");

try
{
PluginSnapshotWithValidationMessages read = readResourceFromCache(structureDefinition.getUrl(),
SnapshotWithValidationMessages read = readResourceFromCache(structureDefinition.getUrl(),
structureDefinition.getVersion(),
// needs to return original structureDefinition object with included snapshot
sd -> new PluginSnapshotWithValidationMessages(structureDefinition.setSnapshot(sd.getSnapshot()),
sd -> new SnapshotWithValidationMessages(structureDefinition.setSnapshot(sd.getSnapshot()),
Collections.emptyList()));
if (read != null)
return read;
Expand All @@ -96,10 +98,10 @@ public PluginSnapshotWithValidationMessages generateSnapshot(StructureDefinition
}
}

private PluginSnapshotWithValidationMessages downloadAndWriteToCache(StructureDefinition structureDefinition)
private SnapshotWithValidationMessages downloadAndWriteToCache(StructureDefinition structureDefinition)
throws IOException
{
PluginSnapshotWithValidationMessages snapshot = delegate.generateSnapshot(structureDefinition);
SnapshotWithValidationMessages snapshot = delegate.generateSnapshot(structureDefinition);

if (PublicationStatus.DRAFT.equals(snapshot.getSnapshot().getStatus()))
{
Expand All @@ -109,7 +111,14 @@ private PluginSnapshotWithValidationMessages downloadAndWriteToCache(StructureDe
return snapshot;
}
else
return writeRsourceToCache(snapshot, PluginSnapshotWithValidationMessages::getSnapshot,
return writeRsourceToCache(snapshot, SnapshotWithValidationMessages::getSnapshot,
StructureDefinition::getUrl, StructureDefinition::getVersion);
}

@Override
public SnapshotWithValidationMessages generateSnapshot(StructureDefinition differential,
String baseAbsoluteUrlPrefix)
{
throw new UnsupportedOperationException("not implemented");
}
}
Loading

0 comments on commit 4cdaffd

Please sign in to comment.