diff --git a/archetype/generated-validator/pom.xml b/archetype/generated-validator/pom.xml index ed6c5b65d509085d6c88d70b6953678011b6beeb..e7bc135a237fe0a6715de54da76413c3e10a34c0 100644 --- a/archetype/generated-validator/pom.xml +++ b/archetype/generated-validator/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>gazelle-objects-checker</artifactId> <groupId>net.ihe.gazelle</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -13,7 +13,7 @@ <groupId>net.ihe.gazelle.goc</groupId> <artifactId>generated-validator</artifactId> <packaging>pom</packaging> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <modules> <module>validator-archetype-instantiator</module> <module>validator-archetype</module> @@ -47,7 +47,7 @@ <dependency> <groupId>net.ihe.gazelle.goctests</groupId> <artifactId>goc-annotations</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </dependency> </dependencies> </project> diff --git a/archetype/generated-validator/validator-archetype-instantiator/pom.xml b/archetype/generated-validator/validator-archetype-instantiator/pom.xml index 0a39ce8640378b70451451fbe09759849827ee92..741eda28cb9743a67456151a02ee8f1cd7a0f61a 100644 --- a/archetype/generated-validator/validator-archetype-instantiator/pom.xml +++ b/archetype/generated-validator/validator-archetype-instantiator/pom.xml @@ -3,12 +3,12 @@ <parent> <artifactId>generated-validator</artifactId> <groupId>net.ihe.gazelle.goc</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>validator-archetype-instantiator</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <packaging>jar</packaging> </project> \ No newline at end of file diff --git a/archetype/generated-validator/validator-archetype/pom.xml b/archetype/generated-validator/validator-archetype/pom.xml index 8e17b20bf3dafef31c9dd02e141c6bfe216f9216..1f02043db8a0df7cccc8d08d70e123cdfc3a3eb3 100644 --- a/archetype/generated-validator/validator-archetype/pom.xml +++ b/archetype/generated-validator/validator-archetype/pom.xml @@ -3,11 +3,11 @@ <parent> <artifactId>generated-validator</artifactId> <groupId>net.ihe.gazelle.goc</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>validator-archetype</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <packaging>maven-archetype</packaging> <build> diff --git a/hl7templates/goc-tests/goc-annotations/pom.xml b/hl7templates/goc-tests/goc-annotations/pom.xml index d9b9dc94b565591ca54a2d46928f97f2642c9d7c..68a67c0712f7100dd23340ff50020228f718569b 100644 --- a/hl7templates/goc-tests/goc-annotations/pom.xml +++ b/hl7templates/goc-tests/goc-annotations/pom.xml @@ -3,7 +3,7 @@ <parent> <artifactId>goc-tests</artifactId> <groupId>net.ihe.gazelle</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> @@ -11,7 +11,7 @@ <groupId>net.ihe.gazelle.goctests</groupId> <artifactId>goc-annotations</artifactId> <name>GOC Annotations</name> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <build> diff --git a/hl7templates/goc-tests/goc-tests-runner/pom.xml b/hl7templates/goc-tests/goc-tests-runner/pom.xml index 398b963ce142e5d595677cc0e42138c96543e219..950df4d84a25c1f4ab33a00543eb5739bfcfddd1 100644 --- a/hl7templates/goc-tests/goc-tests-runner/pom.xml +++ b/hl7templates/goc-tests/goc-tests-runner/pom.xml @@ -3,7 +3,7 @@ <parent> <artifactId>goc-tests</artifactId> <groupId>net.ihe.gazelle</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> @@ -11,7 +11,7 @@ <groupId>net.ihe.gazelle.goctests</groupId> <artifactId>goc-tests-runner</artifactId> <name>GOC Tests Runner</name> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <build> @@ -110,7 +110,7 @@ <dependency> <groupId>net.ihe.gazelle</groupId> <artifactId>hl7templates-packager-jar</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </dependency> </dependencies> </project> diff --git a/hl7templates/goc-tests/goc-tests-runner/src/test/java/net/ihe/gazelle/goctests/interlay/ValidatorGeneratorTest.java b/hl7templates/goc-tests/goc-tests-runner/src/test/java/net/ihe/gazelle/goctests/interlay/ValidatorGeneratorTest.java index cb4edf4c54478300c29263ca442ed8285dc7628b..bf96e4546f26f98df36e61915470f8e3bde2b43e 100644 --- a/hl7templates/goc-tests/goc-tests-runner/src/test/java/net/ihe/gazelle/goctests/interlay/ValidatorGeneratorTest.java +++ b/hl7templates/goc-tests/goc-tests-runner/src/test/java/net/ihe/gazelle/goctests/interlay/ValidatorGeneratorTest.java @@ -7,6 +7,7 @@ import org.junit.Ignore; import org.junit.Test; import java.io.BufferedInputStream; +import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; @@ -27,7 +28,7 @@ public class ValidatorGeneratorTest { String output = "[YOUR CDA PATH]"; String mvn = "[YOUR MVN PATH]"; try { - GeneratedValidator validator = validatorGenerator.generateValidator(new URL(bbr),output,mvn); + GeneratedValidator validator = validatorGenerator.generateValidator(new File(bbr).toURI().toURL(),output,mvn); org.junit.Assert.assertTrue(validator.getValidatorBinaryPath() != null); System.out.println(validator); } catch (ValidatorGenerationException | MalformedURLException e) { diff --git a/hl7templates/goc-tests/pom.xml b/hl7templates/goc-tests/pom.xml index 1e8025b9450d4c895a97a8051410b1a2665af0fb..a5fe013b78d06711c676e0cd9846b7e9762514f9 100644 --- a/hl7templates/goc-tests/pom.xml +++ b/hl7templates/goc-tests/pom.xml @@ -3,7 +3,7 @@ <parent> <artifactId>gazelle-objects-checker</artifactId> <groupId>net.ihe.gazelle</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -11,7 +11,7 @@ <groupId>net.ihe.gazelle</groupId> <artifactId>goc-tests</artifactId> <name>GOC Tests</name> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <packaging>pom</packaging> diff --git a/hl7templates/gocmodel-jar/pom.xml b/hl7templates/gocmodel-jar/pom.xml index 5edc7683f52c30001f5034fe41eba13449426349..0b88308c3c1326dae599747baa99375ce1756f75 100644 --- a/hl7templates/gocmodel-jar/pom.xml +++ b/hl7templates/gocmodel-jar/pom.xml @@ -3,7 +3,7 @@ <parent> <artifactId>gazelle-objects-checker</artifactId> <groupId>net.ihe.gazelle</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -11,7 +11,7 @@ <groupId>net.ihe.gazelle</groupId> <artifactId>gocmodel-jar</artifactId> <name>GOC Model JAR</name> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <organization> <name>IHE-Europe</name> @@ -337,7 +337,7 @@ <dependency> <groupId>net.ihe.gazelle.goctests</groupId> <artifactId>goc-annotations</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </dependency> </dependencies> diff --git a/hl7templates/hl7templates-api-jar/pom.xml b/hl7templates/hl7templates-api-jar/pom.xml index 03c390d59b61e1570ea1d448570c86e90e6bb3f0..2dabd1e8462aa4181218be2e430c6e66b468e7a9 100644 --- a/hl7templates/hl7templates-api-jar/pom.xml +++ b/hl7templates/hl7templates-api-jar/pom.xml @@ -3,7 +3,7 @@ <parent> <artifactId>gazelle-objects-checker</artifactId> <groupId>net.ihe.gazelle</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -11,7 +11,7 @@ <groupId>net.ihe.gazelle</groupId> <artifactId>hl7templates-api-jar</artifactId> <name>HL7Templates API JAR</name> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <organization> <name>IHE-Europe</name> @@ -81,7 +81,7 @@ <dependency> <groupId>net.ihe.gazelle</groupId> <artifactId>hl7templates-model-jar</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </dependency> <dependency> diff --git a/hl7templates/hl7templates-api-jar/src/main/java/net/ihe/gazelle/tempapi/impl/ChoiceDefinitionProcessorImpl.java b/hl7templates/hl7templates-api-jar/src/main/java/net/ihe/gazelle/tempapi/impl/ChoiceDefinitionProcessorImpl.java index f59463cab9b419b3dfcf4e9531a1185b170effac..e69db691168428e966740185eaebdc8baf3d69a7 100644 --- a/hl7templates/hl7templates-api-jar/src/main/java/net/ihe/gazelle/tempapi/impl/ChoiceDefinitionProcessorImpl.java +++ b/hl7templates/hl7templates-api-jar/src/main/java/net/ihe/gazelle/tempapi/impl/ChoiceDefinitionProcessorImpl.java @@ -19,7 +19,7 @@ public abstract class ChoiceDefinitionProcessorImpl implements ChoiceDefinitionP this.processConstraints(ChoiceDefinitionUtil.getConstraints(t)); this.processDescs(t.getDesc()); //elements are processed according to the predicates type - //this.processElements(ChoiceDefinitionUtil.getElements(t)); + this.processElements(ChoiceDefinitionUtil.getElements(t)); this.processIncludes(ChoiceDefinitionUtil.getIncludes(t)); this.processMaximumMultiplicity(t.getMaximumMultiplicity()); this.processMinimumMultiplicity(t.getMinimumMultiplicity()); @@ -27,7 +27,7 @@ public abstract class ChoiceDefinitionProcessorImpl implements ChoiceDefinitionP this.processItem(t.getItem()); //Comment next line to disable processing of the unsported HL7 choices specs - this.processPredicates(ChoiceDefinitionUtil.getElements(t)); + //this.processPredicates(ChoiceDefinitionUtil.getElements(t)); } } diff --git a/hl7templates/hl7templates-generator-jar/pom.xml b/hl7templates/hl7templates-generator-jar/pom.xml index 28e2a28c26b941e80bb438e10d6b08e11dbc4c47..a5d7ed854cacf40eec5fb6a060a170067c66b500 100644 --- a/hl7templates/hl7templates-generator-jar/pom.xml +++ b/hl7templates/hl7templates-generator-jar/pom.xml @@ -3,7 +3,7 @@ <parent> <artifactId>gazelle-objects-checker</artifactId> <groupId>net.ihe.gazelle</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -11,7 +11,7 @@ <groupId>net.ihe.gazelle</groupId> <artifactId>hl7templates-generator-jar</artifactId> <name>HL7Templates Generator JAR</name> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <organization> @@ -143,7 +143,7 @@ <dependency> <groupId>net.ihe.gazelle</groupId> <artifactId>gocmodel-jar</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </dependency> </dependencies> </plugin> @@ -238,7 +238,7 @@ <dependency> <groupId>net.ihe.gazelle</groupId> <artifactId>hl7templates-model-jar</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </dependency> <dependency> @@ -249,7 +249,7 @@ <dependency> <groupId>net.ihe.gazelle</groupId> <artifactId>hl7templates-api-jar</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </dependency> <dependency> <groupId>net.ihe.gazelle.svs</groupId> diff --git a/hl7templates/hl7templates-generator-jar/src/main/java/net/ihe/gazelle/tempgen/action/HL7TemplatesConverter.java b/hl7templates/hl7templates-generator-jar/src/main/java/net/ihe/gazelle/tempgen/action/HL7TemplatesConverter.java index 5f063ee094e02cc52ba5e414959718c76991ff2e..0b3c057f264357b2d62ce75d84d0651e8aefa62a 100644 --- a/hl7templates/hl7templates-generator-jar/src/main/java/net/ihe/gazelle/tempgen/action/HL7TemplatesConverter.java +++ b/hl7templates/hl7templates-generator-jar/src/main/java/net/ihe/gazelle/tempgen/action/HL7TemplatesConverter.java @@ -4,6 +4,8 @@ package net.ihe.gazelle.tempgen.action; import net.ihe.gazelle.goc.uml.utils.XMIUtil; import net.ihe.gazelle.goc.xmi.XMI; import net.ihe.gazelle.goc.xmi.XMIMarshaller; +import net.ihe.gazelle.goc.xmm.OwnedRule; +import net.ihe.gazelle.goc.xmm.PackagedElement; import net.ihe.gazelle.tempgen.flatten.action.GeneralFlattenDecor; import net.ihe.gazelle.tempgen.flatten.action.RulesCleaner; import net.ihe.gazelle.tempgen.inc.action.IncludeFlattener; @@ -19,6 +21,8 @@ import javax.xml.bind.JAXBException; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.net.URL; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * @author Abderrazek Boufahja @@ -138,6 +142,30 @@ public class HL7TemplatesConverter { XMI xmi = XMIUtil.createXMI(prefix); //The entrypoint to convert the decor to OCL! (new DecorAnalyzer()).process(decor, xmi, Boolean.valueOf(ignoreTemplateIdRequirements),ignoreChoicesPredicates); + //Skip incorrect OCL + clearXMI(xmi); return xmi; } + private void clearXMI(XMI xmi){ + for(PackagedElement packagedElement:xmi.getModel().getPackagedElement()){ + for(int ownedRule=0;ownedRule<packagedElement.getOwnedRule().size();ownedRule++) { + if(cleanOCL(packagedElement.getOwnedRule().get(ownedRule))==null) { + packagedElement.getOwnedRule().remove(packagedElement.getOwnedRule().get(ownedRule)); + TamlHandler.removeTAML(packagedElement.getOwnedRule().get(ownedRule)); + } + } + + } + } + + private OwnedRule cleanOCL(OwnedRule ownedRule){ + String mat= ownedRule.getSpecification().getBody(); + String matr= "\\)[A-Za-z]+"; + Pattern pattern = Pattern.compile(matr); + Matcher matcher = pattern.matcher(ownedRule.getSpecification().getBody()); + if(!matcher.find()){ + return ownedRule; + } + return null; + } } diff --git a/hl7templates/hl7templates-model-jar/pom.xml b/hl7templates/hl7templates-model-jar/pom.xml index b97c719bbdf403413189cb9f21e06cde8b74de42..8eef39b472462cc38927a3babb39f5c6542f39ff 100644 --- a/hl7templates/hl7templates-model-jar/pom.xml +++ b/hl7templates/hl7templates-model-jar/pom.xml @@ -3,7 +3,7 @@ <parent> <artifactId>gazelle-objects-checker</artifactId> <groupId>net.ihe.gazelle</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -11,7 +11,7 @@ <groupId>net.ihe.gazelle</groupId> <artifactId>hl7templates-model-jar</artifactId> <name>HL7Templates Model JAR</name> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <organization> <name>IHE-Europe</name> @@ -134,7 +134,7 @@ <dependency> <groupId>net.ihe.gazelle</groupId> <artifactId>gocmodel-jar</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </dependency> </dependencies> </plugin> @@ -214,7 +214,7 @@ <dependency> <groupId>net.ihe.gazelle</groupId> <artifactId>gocmodel-jar</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </dependency> <dependency> diff --git a/hl7templates/hl7templates-packager-jar/pom.xml b/hl7templates/hl7templates-packager-jar/pom.xml index 652546fe46c06db0a96b0dde951fd542cf13bcbb..e5023e7d8280acd7c30dd0df79e97727152ca29e 100644 --- a/hl7templates/hl7templates-packager-jar/pom.xml +++ b/hl7templates/hl7templates-packager-jar/pom.xml @@ -3,7 +3,7 @@ <parent> <artifactId>gazelle-objects-checker</artifactId> <groupId>net.ihe.gazelle</groupId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -11,7 +11,7 @@ <groupId>net.ihe.gazelle</groupId> <artifactId>hl7templates-packager-jar</artifactId> <name>HL7 Templates Packager</name> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <organization> <name>IHE europe</name> @@ -156,7 +156,7 @@ <dependency> <groupId>net.ihe.gazelle</groupId> <artifactId>hl7templates-generator-jar</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> </dependency> <dependency> @@ -186,7 +186,7 @@ <dependency> <groupId>net.ihe.gazelle.goc</groupId> <artifactId>validator-archetype-instantiator</artifactId> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <type>jar</type> </dependency> diff --git a/pom.xml b/pom.xml index 005a2891180a082c31fa42393da36e3cfbf697f7..2fddb463433a7f758b22dec4b50fb73fdf98abee 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ <groupId>net.ihe.gazelle</groupId> <artifactId>gazelle-objects-checker</artifactId> <name>Gazelle Objects Checker</name> - <version>3.0.4-SNAPSHOT</version> + <version>3.0.5-SNAPSHOT</version> <packaging>pom</packaging> <organization>