Skip to content

Commit

Permalink
Udpdates for issue with prefix
Browse files Browse the repository at this point in the history
New logic for  prefix matching in XML parser
  • Loading branch information
swmuir committed Jul 25, 2023
1 parent b7721c3 commit ec3a660
Show file tree
Hide file tree
Showing 13 changed files with 221 additions and 24 deletions.
3 changes: 1 addition & 2 deletions org.mdmi.core.runtime/META-INF/MANIFEST.MF
Expand Up @@ -2,14 +2,13 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Runtime
Bundle-SymbolicName: org.mdmi.core.runtime;singleton:=true
Bundle-Version: 2.5.0.qualifier
Bundle-Version: 2.5.1.qualifier
Bundle-ClassPath: .
Require-Bundle: org.eclipse.emf.common,
org.apache.commons.cli,
org.apache.commons.lang3,
org.mdmi.ecore,
com.google.guava,
org.apache.commons.codec,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi,
org.antlr.runtime;bundle-version="4.7.1";visibility:=reexport,
Expand Down
2 changes: 1 addition & 1 deletion org.mdmi.core.runtime/pom.xml
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.mdmi</groupId>
<artifactId>org.mdmi.pom</artifactId>
<version>2.5.0-SNAPSHOT</version>
<version>2.5.1-SNAPSHOT</version>
</parent>
<artifactId>org.mdmi.core.runtime</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
Expand Up @@ -744,6 +744,10 @@ public void startElement(String uri, String localName, String qName, Attributes

List<Node> matchingSyntaxNodes = lookForMatch(qName);

if (matchingSyntaxNodes.isEmpty()) {
matchingSyntaxNodes = lookForMatch(localName);
}

Node matchingSyntaxNode = null;

if (!matchingSyntaxNodes.isEmpty()) {
Expand Down
10 changes: 7 additions & 3 deletions org.mdmi.core.runtime/src/org/mdmi/core/util/StringUtil.java
Expand Up @@ -16,8 +16,9 @@

import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.Base64;

import org.apache.commons.codec.binary.Base64;
//import org.apache.commons.codec.binary.Base64;
import org.mdmi.core.MdmiException;

/**
Expand Down Expand Up @@ -103,7 +104,8 @@ public static byte[] decodeBytes(String z) {
throw new IllegalArgumentException("null argument in Util.decodeBytes()");
}
try {
return Base64.decodeBase64(z);

return Base64.getDecoder().decode(z); // .decodeBase64(z);
} catch (Exception ex) {
throw new MdmiException(ex, "Decode fails");
}
Expand Down Expand Up @@ -145,7 +147,9 @@ public static String encodeBytes(byte[] a) {
throw new IllegalArgumentException("null argument in Util.encodeBytes()");
}
try {
return Base64.encodeBase64String(a);
return Base64.getEncoder().encodeToString(a);

// return Base64.encodeBase64String(a);
} catch (Exception ex) {
throw new MdmiException(ex, "Encode fails");
}
Expand Down
2 changes: 1 addition & 1 deletion org.mdmi.ecore/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
Expand Down
118 changes: 109 additions & 9 deletions org.mdmi.ecore/.settings/org.eclipse.jdt.core.prefs

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions org.mdmi.ecore/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,3 @@
#Tue Mar 29 22:38:51 EDT 2011
cleanup.add_default_serial_version_id=true
cleanup.add_generated_serial_version_id=false
cleanup.add_missing_annotations=true
Expand Down Expand Up @@ -55,7 +54,7 @@ cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_MDHT
formatter_settings_version=11
formatter_settings_version=21
org.eclipse.jdt.ui.exception.name=e
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.ignorelowercasenames=true
Expand Down
Expand Up @@ -3,5 +3,5 @@
<fixed facet="jst.utility"/>
<fixed facet="java"/>
<installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.8"/>
<installed facet="java" version="11"/>
</faceted-project>
2 changes: 1 addition & 1 deletion org.mdmi.ecore/META-INF/MANIFEST.MF
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MDMI
Bundle-SymbolicName: org.mdmi.ecore;singleton:=true
Bundle-Version: 2.5.0.qualifier
Bundle-Version: 2.5.1.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.mdmi.ecore.MDMIPlugin$Implementation
Bundle-Vendor: MDMI
Expand Down
2 changes: 1 addition & 1 deletion org.mdmi.ecore/pom.xml
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.mdmi</groupId>
<artifactId>org.mdmi.pom</artifactId>
<version>2.5.0-SNAPSHOT</version>
<version>2.5.1-SNAPSHOT</version>
</parent>
<packaging>eclipse-plugin</packaging>
</project>
23 changes: 20 additions & 3 deletions pom.xml
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.mdmi</groupId>
<artifactId>org.mdmi.pom</artifactId>
<version>2.5.0-SNAPSHOT</version>
<version>2.5.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>MDMI Eclipse Plugin Parent POM</name>
<description>MDMI Eclipse Plugin Parent POM</description>
Expand All @@ -27,16 +27,33 @@
<id>R20201130205003</id>
<layout>p2</layout>
<url>http://download.eclipse.org/tools/orbit/downloads/drops/R20201130205003/repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>

<repository>
<id>MDMI2021-03</id>
<id>R20201118194144</id>
<layout>p2</layout>
<url>http://mdmi.sourceforge.net/mdmi-2.5.0</url>
<url>http://download.eclipse.org/tools/orbit/downloads/drops/R20201118194144/repository</url>

<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>




<repository>
<id>mdmi3rdparty</id>
<layout>p2</layout>
<url>http://mdmi.sourceforge.net/mdmi3rdparty</url>

<snapshots>
<enabled>true</enabled>
</snapshots>

</repository>
</repositories>

Expand Down
41 changes: 41 additions & 0 deletions t.xml
@@ -0,0 +1,41 @@

<foo>
<datatypeMaps xmi:id="_txRJpaI_Eem3sI_lln0jxw"
name="FHIR_ReferenceToInstanceIdentifier"
fromMDMI="
function mapInstanceIdentifierToFHIR_Reference(source, target, properties, conversionrule) {
var fhirResource = org.mdmi.core.engine.javascript.Utils.getSemanticProperyQualifier(conversionrule, 'fhirResource:');
target.setValueSafely('reference.type', fhirResource);
if (properties.get('REFERENCEURL') != null) {
if (source.getValue('extension') != null) {
target.setValueSafely('reference.value', properties.get('REFERENCEURL') + fhirResource + source.getValue('extension'));
}
if (source.getValue('root') != null) {
target.setValueSafely('reference.value', properties.get('REFERENCEURL') + fhirResource + source.getValue('root'));
}
} else {
if (source.getValue('extension') != null &amp;&amp; source.getValue('root') != null) {
target.setValueSafely('reference.value', properties.get('REFERENCEURL') + fhirResource +source.getValue('root') + '::' + source.getValue('extension'));
} else {
if (source.getValue('extension') != null) {
target.setValueSafely('reference.value', properties.get('REFERENCEURL') + fhirResource +source.getValue('extension'));
}
if (source.getValue('root') != null) {
target.setValueSafely('reference.value', properties.get('REFERENCEURL') + fhirResource +source.getValue('root'));
}
}
}
}
"
toMDMI="function mapFHIR_ReferenceToInstanceIdentifier(s,t) { &#xA; if (s.getValue(&quot;reference&quot;) != null) {&#xA; var sc = s.getValue(&quot;reference&quot;);&#xA; if (sc.getValue(&quot;value&quot;) != null) {&#xA; t.setValue(&quot;extension&quot;, sc.getValue(&quot;value&quot;));&#xA; }&#xA; }&#xA;}&#xA; " />
</foo>
33 changes: 33 additions & 0 deletions xxx.js
@@ -0,0 +1,33 @@

function mapInstanceIdentifierToFHIR_Reference(source, target, properties, conversionrule) {


var fhirResource = org.mdmi.core.engine.javascript.Utils.getSemanticProperyQualifier(conversionrule, 'fhirResource:');
target.setValueSafely('reference.type', fhirResource);

if (properties.get('REFERENCEURL') != null) {
if (source.getValue('extension') != null) {
target.setValueSafely('reference.value', properties.get('REFERENCEURL') + fhirResource + source.getValue('extension'));
}

if (source.getValue('root') != null) {
target.setValueSafely('reference.value', properties.get('REFERENCEURL') + fhirResource + source.getValue('root'));
}
} else {

if (source.getValue('extension') != null &amp;&amp; source.getValue('root') != null) {
target.setValueSafely('reference.value', properties.get('REFERENCEURL') + fhirResource +source.getValue('root') + '::' + source.getValue('extension'));
} else {
if (source.getValue('extension') != null) {
target.setValueSafely('reference.value', properties.get('REFERENCEURL') + fhirResource +source.getValue('extension'));
}

if (source.getValue('root') != null) {
target.setValueSafely('reference.value', properties.get('REFERENCEURL') + fhirResource +source.getValue('root'));
}
}



}
}

0 comments on commit ec3a660

Please sign in to comment.