Permalink
Browse files

Rod i github-admin, så det tidligere pushede tilsyneladende er væk. P…

…ush igen
  • Loading branch information...
0 parents commit 0d576ad4c9e3788b97cc8606fca0a69775c58461 @jrftrifork jrftrifork committed Sep 4, 2012
Showing with 14,855 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +99 −0 pom.xml
  3. +23 −0 src/main/java/dk/nsi/sdm4/dosering/config/DoseringparserApplicationConfig.java
  4. +21 −0 src/main/java/dk/nsi/sdm4/dosering/config/DoseringparserInfrastructureConfig.java
  5. +16 −0 src/main/java/dk/nsi/sdm4/dosering/config/WebConfig.java
  6. +49 −0 src/main/java/dk/nsi/sdm4/dosering/model/DosageRecord.java
  7. +126 −0 src/main/java/dk/nsi/sdm4/dosering/model/DosageStructure.java
  8. +72 −0 src/main/java/dk/nsi/sdm4/dosering/model/DosageUnit.java
  9. +79 −0 src/main/java/dk/nsi/sdm4/dosering/model/DosageVersion.java
  10. +69 −0 src/main/java/dk/nsi/sdm4/dosering/model/Drug.java
  11. +86 −0 src/main/java/dk/nsi/sdm4/dosering/model/DrugDosageStructureRelation.java
  12. +244 −0 src/main/java/dk/nsi/sdm4/dosering/parser/DoseringParser.java
  13. +8 −0 src/main/resources/db/migration/V20120828_1342__Dosering_ImporterStatus.sql
  14. +92 −0 src/main/resources/db/migration/V20120828_1343__Dosering_Tables.sql
  15. +3 −0 src/main/resources/default-config.properties
  16. +38 −0 src/main/webapp/WEB-INF/web.xml
  17. +11 −0 src/test/java/dk/nsi/sdm4/dosering/integrationtest/DoseringimporterIsUpIT.java
  18. +194 −0 src/test/java/dk/nsi/sdm4/dosering/parser/DoseringParserIntegrationTest.java
  19. +589 −0 src/test/resources/data/doseringsforslag/multiple/DosageStructures.json
  20. +23 −0 src/test/resources/data/doseringsforslag/multiple/DosageUnits.json
  21. +1 −0 src/test/resources/data/doseringsforslag/multiple/DosageVersion.json
  22. +3,712 −0 src/test/resources/data/doseringsforslag/multiple/Drugs.json
  23. +9,281 −0 src/test/resources/data/doseringsforslag/multiple/DrugsDosageStructures.json
  24. +3 −0 src/test/resources/data/doseringsforslag/single/DosageStructures.json
  25. +3 −0 src/test/resources/data/doseringsforslag/single/DosageUnits.json
  26. +1 −0 src/test/resources/data/doseringsforslag/single/DosageVersion.json
  27. +1 −0 src/test/resources/data/doseringsforslag/single/Drugs.json
  28. +3 −0 src/test/resources/data/doseringsforslag/single/DrugsDosageStructures.json
  29. +5 −0 src/test/resources/log4j.properties
  30. +2 −0 src/test/resources/test.properties
@@ -0,0 +1 @@
+target
99 pom.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>dk.nsi.stamdata4</groupId>
+ <artifactId>sdm-parent</artifactId>
+ <version>4.1</version>
+ </parent>
+
+ <artifactId>doseringimporter</artifactId>
+ <packaging>war</packaging>
+ <version>4.1-SNAPSHOT</version>
+
+ <scm>
+ <url>scm:git:git@github.com:trifork/sdm4-doseringimporter</url>
+ <connection>scm:git:git@github.com:trifork/sdm4-doseringimporter.git</connection>
+ <developerConnection>scm:git:git@github.com:trifork/sdm4-doseringimporter.git</developerConnection>
+ </scm>
+ <issueManagement>
+ <system>JIRA</system>
+ <url>https://jira.trifork.com/</url>
+ </issueManagement>
+ <ciManagement>
+ <system>Jenkins</system>
+ <url>https://ci02.trifork.com:8443/view/SDM4/job/SDM4-doseringimporter/</url>
+ </ciManagement>
+
+ <prerequisites>
+ <maven>3.0.0</maven>
+ </prerequisites>
+
+ <distributionManagement>
+ <repository>
+ <id>Trifork-Nexus-Release-Repository</id>
+ <name>Trifork Nexus Release Repository</name>
+ <url>https://nexus.trifork.com/content/repositories/releases/</url>
+ </repository>
+ </distributionManagement>
+
+ <repositories>
+ <repository>
+ <id>Trifork-Nexus-Public-Repository</id>
+ <name>Trifork Nexus Public Repository</name>
+ <url>https://nexus.trifork.com/content/groups/public/</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>Trifork-Nexus-Public-Repository</id>
+ <name>Trifork Nexus Public Repository</name>
+ <url>https://nexus.trifork.com/content/groups/public/</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>dk.nsi.stamdata4</groupId>
+ <artifactId>sdm-core</artifactId>
+ <version>4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>1.6</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>dk.nsi.stamdata4</groupId>
+ <artifactId>testutils</artifactId>
+ <version>4.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
@@ -0,0 +1,23 @@
+package dk.nsi.sdm4.dosering.config;
+
+import dk.nsi.sdm4.core.parser.Parser;
+import dk.nsi.sdm4.core.persistence.AuditingPersister;
+import dk.nsi.sdm4.core.persistence.Persister;
+import dk.nsi.sdm4.dosering.parser.DoseringParser;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+// The Spring Java Configuration annotations above needs to be on this class, not on the abstract superclass to
+// make Spring stop complaining about weird things
+public class DoseringparserApplicationConfig {
+ @Bean
+ public Parser parser() {
+ return new DoseringParser();
+ }
+
+ @Bean
+ public Persister persister() {
+ return new AuditingPersister();
+ }
+}
@@ -0,0 +1,21 @@
+package dk.nsi.sdm4.dosering.config;
+
+import dk.nsi.sdm4.core.config.StamdataConfiguration;
+import dk.sdsd.nsp.slalog.api.SLALogConfig;
+import dk.sdsd.nsp.slalog.api.SLALogger;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Configuration
+@EnableScheduling
+@EnableTransactionManagement
+//The Spring Java Configuration annotations above needs to be on this class, not on the abstract superclass to
+// make Spring stop complaining about weird things
+public class DoseringparserInfrastructureConfig extends StamdataConfiguration {
+ @Bean
+ public SLALogger slaLogger() {
+ return new SLALogConfig("Stamdata Dosering-importer", "doseringimporter").getSLALogger();
+ }
+}
@@ -0,0 +1,16 @@
+package dk.nsi.sdm4.dosering.config;
+
+import dk.nsi.sdm4.core.status.StatusReporter;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+
+@Configuration
+@EnableWebMvc
+public class WebConfig {
+
+ @Bean
+ public StatusReporter statusReporter() {
+ return new StatusReporter();
+ }
+}
@@ -0,0 +1,49 @@
+/**
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Contributor(s): Contributors are attributed in the source code
+ * where applicable.
+ *
+ * The Original Code is "Stamdata".
+ *
+ * The Initial Developer of the Original Code is Trifork Public A/S.
+ *
+ * Portions created for the Original Code are Copyright 2011,
+ * Lægemiddelstyrelsen. All Rights Reserved.
+ *
+ * Portions created for the FMKi Project are Copyright 2011,
+ * National Board of e-Health (NSI). All Rights Reserved.
+ */
+
+package dk.nsi.sdm4.dosering.model;
+
+import java.util.Date;
+
+import org.apache.log4j.Logger;
+
+import dk.nsi.sdm4.core.domain.AbstractStamdataEntity;
+
+public abstract class DosageRecord extends AbstractStamdataEntity {
+
+ private Date validFrom;
+ private static final Logger logger = Logger.getLogger(DosageRecord.class);
+
+ public void setVersion(Date validFrom) {
+
+ this.validFrom = validFrom;
+ }
+
+ @Override
+ public Date getValidFrom() {
+
+ return validFrom;
+ }
+}
@@ -0,0 +1,126 @@
+/**
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Contributor(s): Contributors are attributed in the source code
+ * where applicable.
+ *
+ * The Original Code is "Stamdata".
+ *
+ * The Initial Developer of the Original Code is Trifork Public A/S.
+ *
+ * Portions created for the Original Code are Copyright 2011,
+ * Lægemiddelstyrelsen. All Rights Reserved.
+ *
+ * Portions created for the FMKi Project are Copyright 2011,
+ * National Board of e-Health (NSI). All Rights Reserved.
+ */
+
+
+package dk.nsi.sdm4.dosering.model;
+
+import org.apache.commons.lang.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.Arrays;
+import java.util.Collections;
+
+@Entity
+public class DosageStructure extends DosageRecord
+{
+ // Reference til releaseNumber i Version. Obligatorisk. Heltal, 15 cifre.
+ private long releaseNumber;
+
+ // Unik kode for doseringstrukturen. Obligatorisk. Heltal, 11 cifre.
+ private long code;
+
+ // Typen af dosering, enten "M+M+A+N", "PN", "N daglig",
+ // "Fritekst" eller "Kompleks". Obligatorisk. Streng, 100 tegn.
+ private String type;
+
+ // For simple typer (dvs. alt andet end "Kompleks")
+ // indeholder feltet doseringen på simpel form. Optionelt. Streng, 100 tegn.
+ private String simpleString;
+
+ // For simple typer en eventuel supplerende tekst.
+ // Optionelt. Streng, 200 tegn.
+ private String supplementaryText;
+
+ // FMKs strukturerede dosering i XML format. Bemærk at enkelte
+ // værdier vil være escaped. Obligatorisk. Streng, 10000 tegn.
+ private String xml;
+
+ // Såfremt det er muligt at lave en kort
+ // doseringstekst på baggrund af xml og lægemidlets doseringsenhed vil
+ // dette felt indeholde denne. Optionelt. Streng, 70 tegn.
+ private String shortTranslation;
+
+ // En lang doseringstekst baggrund af xml og
+ // lægemidlets doseringsenhed. Obligatorisk. Strengm 10000 tegn.
+ // TODO: While this is marked as (Mandatory) in practice it is
+ // sometimes null. This will change in future. (Tom K)
+ private String longTranslation;
+
+ @Column
+ public long getReleaseNumber()
+ {
+ return releaseNumber;
+ }
+
+ @Id
+ @Column
+ public long getCode()
+ {
+ return code;
+ }
+
+ @Column
+ public String getType()
+ {
+ return type;
+ }
+
+ @Column
+ public String getSimpleString()
+ {
+ return simpleString;
+ }
+
+ @Column
+ public String getSupplementaryText()
+ {
+ return supplementaryText;
+ }
+
+ @Column
+ public String getXml()
+ {
+ return xml;
+ }
+
+ @Column
+ public String getShortTranslation()
+ {
+ return shortTranslation;
+ }
+
+ @Column
+ public String getLongTranslation()
+ {
+ return longTranslation;
+ }
+
+ public String toString() {
+ return new ReflectionToStringBuilder(this).setExcludeFieldNames(new String[] {"xml"}).toString();
+ }
+}
Oops, something went wrong.

0 comments on commit 0d576ad

Please sign in to comment.