Skip to content

Commit

Permalink
litt diverse
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhaugsdal committed Jan 6, 2024
1 parent 28a2a87 commit 439077a
Show file tree
Hide file tree
Showing 129 changed files with 27,108 additions and 86 deletions.
34 changes: 33 additions & 1 deletion messages/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit/junit-bom -->
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.10.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -40,6 +48,14 @@
<groupId>io.github.mjhaugsdal</groupId>
<artifactId>er-m9na2-2016-10-26</artifactId>
</dependency>
<dependency>
<groupId>io.github.mjhaugsdal</groupId>
<artifactId>er-m9na3-2016-06-06</artifactId>
</dependency>
<dependency>
<groupId>io.github.mjhaugsdal</groupId>
<artifactId>er-m9na4-2016-06-06</artifactId>
</dependency>
<dependency>
<groupId>io.github.mjhaugsdal</groupId>
<artifactId>kith</artifactId>
Expand Down Expand Up @@ -67,7 +83,23 @@
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version> <!-- TODO remove? -->
<version>4.0.1</version> <!-- TODO remove? -->
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>4.0.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

This file was deleted.

43 changes: 43 additions & 0 deletions messages/src/main/java/io/github/mjhaugsdal/kith/xml/XMLUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package io.github.mjhaugsdal.kith.xml;

import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;

import java.io.ByteArrayInputStream;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

public class XMLUtil {

private static JAXBContext jaxbContext;

private static Marshaller marshaller;

private static jakarta.xml.bind.Unmarshaller unmarshaller;

public XMLUtil(Class<?>... classes) {
try {
jaxbContext = JAXBContext.newInstance(classes);
unmarshaller = jaxbContext.createUnmarshaller();
marshaller = jaxbContext.createMarshaller();
} catch (JAXBException e) {
throw new RuntimeException(e);
}
}

public Object unmarshall(String filePath) throws JAXBException {
return unmarshaller.unmarshal(XMLUtil.class.getClassLoader().getResourceAsStream(filePath));
}

public Object unmarshall(String xml, Charset charset) throws JAXBException {
return unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes(charset)));
}

public String marshall(Object objectToBeMarshalled) throws JAXBException {
StringWriter sw = new StringWriter();
marshaller.marshal(objectToBeMarshalled, sw);
return sw.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<MsgHead xmlns="http://www.kith.no/xmlstds/msghead/2006-05-24" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kith.no/xmlstds/msghead/2006-05-24 ../felles/MsgHead-v1_2.xsd">
<MsgInfo>
<Type V="ERM14" DN="Søknad til Legemiddelverket"/>
<MIGversion>v1.2 2006-05-24</MIGversion>
<GenDate>2007-03-12T19:20:00</GenDate>
<MsgId>5f723921-76d0-44ed-acd0-f7ed2baec16c</MsgId>
<Sender>
<Organisation>
<OrganisationName>Kattskinnet legesenter</OrganisationName>
<Ident>
<Id>971318864</Id>
<TypeId S="2.16.578.1.12.4.1.1.9051" V="ENH" DN="Organisasjonsnummeret i Enhetsregister"/>
</Ident>
<HealthcareProfessional>
<FamilyName>Koman</FamilyName>
<GivenName>Magnar</GivenName>
<Ident>
<Id>009144889</Id>
<TypeId S="2.16.578.1.12.4.1.1.8116" V="HPR" DN="HPR-nummer"/>
</Ident>
</HealthcareProfessional>
</Organisation>
</Sender>
<Receiver>
<Organisation>
<OrganisationName>Statens Legemiddelverk, Avdeling for legemiddelgodkjenning</OrganisationName>
<Ident>
<Id>1234567890-example</Id>
<TypeId S="2.16.578.1.12.4.1.1.9051" V="ENH" DN="Organisasjonsnummeret i Enhetsregister"/>
</Ident>
</Organisation>
</Receiver>
</MsgInfo>
<Document>
<RefDoc>
<MsgType V="XML" DN="XML-instans"/>
<Content>
<SoknadSLV xsi:schemaLocation="http://www.kith.no/xmlstds/eresept/m14/2008-12-12 ER-M14-2008-12-12.xsd" xmlns="http://www.kith.no/xmlstds/eresept/m14/2008-12-12" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ReseptId>7c77a590-317a-11dd-bd11-0800200c9a66</ReseptId>
<AnmodningSLVId>f3eb5400-317a-11dd-bd11-0800200c9a66</AnmodningSLVId>
</SoknadSLV>
</Content>
</RefDoc>
</Document>
</MsgHead>


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<SoknadSLV xsi:schemaLocation="http://www.kith.no/xmlstds/eresept/m14/2008-12-12 ER-M14-2008-12-12.xsd" xmlns="http://www.kith.no/xmlstds/eresept/m14/2008-12-12" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ReseptId>7c77a590-317a-11dd-bd11-0800200c9a66</ReseptId>
<AnmodningSLVId>f3eb5400-317a-11dd-bd11-0800200c9a66</AnmodningSLVId>
</SoknadSLV>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<MsgHead xmlns="http://www.kith.no/xmlstds/msghead/2006-05-24" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kith.no/xmlstds/msghead/2006-05-24 ../felles/MsgHead-v1_2.xsd">
<MsgInfo>
<Type V="ERM15" DN="Søknadssvar fra Legemiddelverket"/>
<MIGversion>v1.2 2006-05-24</MIGversion>
<GenDate>2007-03-12T19:20:00</GenDate>
<MsgId>5f723921-76d0-44ed-acd0-f7ed2baec16c</MsgId>
<Sender>
<Organisation>
<OrganisationName>Statens Legemiddelverk, Avdeling for legemiddelgodkjenning</OrganisationName>
<Ident>
<Id>1234567890-example</Id>
<TypeId S="2.16.578.1.12.4.1.1.9051" V="ENH" DN="Organisasjonsnummeret i Enhetsregister"/>
</Ident>
</Organisation>
</Sender>
<Receiver>
<Organisation>
<OrganisationName>Kattskinnet legesenter</OrganisationName>
<Ident>
<Id>971318864</Id>
<TypeId S="2.16.578.1.12.4.1.1.9051" V="ENH" DN="Organisasjonsnummeret i Enhetsregister"/>
</Ident>
<HealthcareProfessional>
<FamilyName>Koman</FamilyName>
<GivenName>Magnar</GivenName>
<Ident>
<Id>009144889</Id>
<TypeId S="2.16.578.1.12.4.1.1.8116" V="HPR" DN="HPR-nummer"/>
</Ident>
</HealthcareProfessional>
</Organisation>
</Receiver>
</MsgInfo>
<Document>
<RefDoc>
<MsgType V="XML" DN="XML-instans"/>
<Content>
<SvarSLV xmlns="http://www.kith.no/xmlstds/eresept/m15/2006-10-06" xmlns:kith="http://www.kith.no/xmlstds" xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kith.no/xmlstds/eresept/m15/2006-10-06 ER-M15-2006-10-06.xsd">
<ReseptId>1234567890</ReseptId>
<Innvilget V="N"/>
<BegrunnelseAvslag>Statshemmelighet</BegrunnelseAvslag>
<Saksbehandler>BEH123</Saksbehandler>
</SvarSLV>
</Content>
</RefDoc>
</Document>
</MsgHead>
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<MsgHead xmlns="http://www.kith.no/xmlstds/msghead/2006-05-24" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kith.no/xmlstds/msghead/2006-05-24 ../felles/MsgHead-v1_2.xsd">
<MsgInfo>
<Type V="ERM21" DN="Ekspederingsanmodning"/>
<MIGversion>v1.2 2006-05-24</MIGversion>
<GenDate>2007-03-12T19:20:00</GenDate>
<MsgId>fa662190-cc17-4a0d-959c-7e3c2a8523ff</MsgId>
<Sender>
<Organisation>
<OrganisationName>Reseptformidleren</OrganisationName>
<Ident>
<Id>1234567890-example</Id>
<TypeId S="2.16.578.1.12.4.1.1.9051" V="ENH" DN="Organisasjonsnummeret i Enhetsregister"/>
</Ident>
</Organisation>
</Sender>
<Receiver>
<Organisation>
<OrganisationName>Apoteket Flodhesten</OrganisationName>
<Ident>
<Id>971033541</Id>
<TypeId S="2.16.578.1.12.4.1.1.9051" V="ENH" DN="Organisasjonsnummeret i Enhetsregister"/>
</Ident>
<Ident>
<Id>9001</Id>
<TypeId S="2.16.578.1.12.4.1.1.9051" V="AKO" DN="Apotekets konsesjonsnummer"/>
</Ident>
</Organisation>
</Receiver>
</MsgInfo>
<Document>
<RefDoc>
<MsgType V="XML" DN="XML-instans"/>
<Content>
<Ekspederingsanmodning xsi:schemaLocation="http://www.kith.no/xmlstds/eresept/m21/2013-10-08 ER-M21-2013-10-08.xsd" xmlns:m1="http://www.kith.no/xmlstds/eresept/m1/2013-10-08" xmlns="http://www.kith.no/xmlstds/eresept/m21/2013-10-08" xmlns:fk1="http://www.kith.no/xmlstds/felleskomponent1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ReseptId>8eaa6000-3ec6-11dd-ae16-0800200c9a66</ReseptId>
<RefNr>THX1138</RefNr>
<Fnr>15076500565</Fnr>
<Navn>Roland Gundersen</Navn>
<m1:EkspAnm>
<m1:Vilkar>true</m1:Vilkar>
<m1:MetodeEkspedering DN="Forsendelse" V="F"/>
<m1:Utleverer>HER1234567890</m1:Utleverer>
<m1:Kontaktperson>Roland Gundersen</m1:Kontaktperson>
<m1:Adresse>
<fk1:StreetAdr>Flåklypa 31</fk1:StreetAdr>
<fk1:PostalCode>2560</fk1:PostalCode>
<fk1:City>Alvdal</fk1:City>
</m1:Adresse>
<m1:Merknad>Ikke bruk innpakkingsmateriale laget av biomateriale grunnet allergi. </m1:Merknad>
<m1:OrgNrUtleverer>971033541</m1:OrgNrUtleverer>
<m1:UtlevererNavn>Heidundradegår Sykepleieartikler</m1:UtlevererNavn>
</m1:EkspAnm>
</Ekspederingsanmodning>
</Content>
</RefDoc>
</Document>
</MsgHead>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Samtykke xsi:schemaLocation="http://www.kith.no/xmlstds/eresept/m241/2009-02-20 ER-M241-2009-02-20.xsd" xmlns="http://www.kith.no/xmlstds/eresept/m241/2009-02-20" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SamtykkeGittAv DN="Kodeverk mangler" V="TODO"/>
<SamtykkeTil>2077-03-12</SamtykkeTil>
<TypeSamtykke DN="Samtykke for utleveringsmelding" V="1"/>
<Samtykkeverdi DN="Ja" V="1"/>
</Samtykke>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<SvarSamtykke xsi:schemaLocation="http://www.kith.no/xmlstds/eresept/m242/2008-10-03 ER-M242-2008-10-03.xsd" xmlns="http://www.kith.no/xmlstds/eresept/m242/2008-10-03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Svar DN="Avvist" V="2"/>
<Begrunnelse DN="Rekvirent er ikke pasientens fastlege" V="2"/>
</SvarSamtykke>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<AnmodningSLV xsi:schemaLocation="http://www.kith.no/xmlstds/eresept/m3/2010-05-01 ER-M3-2010-05-01.xsd" xmlns="http://www.kith.no/xmlstds/eresept/m3/2010-05-01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ReseptId>7c77a590-317a-11dd-bd11-0800200c9a66</ReseptId>
<Kommentar>Denne bør dere ta en titt på</Kommentar>
</AnmodningSLV>
Loading

0 comments on commit 439077a

Please sign in to comment.