-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added support to xsd import tool for extensions of simple types and XSD attributes * Cleaned * Cleaned * Added xml config generator * Fixed null handling * Added rootType annotation
- Loading branch information
1 parent
05217f5
commit 68e322c
Showing
35 changed files
with
844 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,58 @@ | ||
<?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>com.regnosys.rosetta</groupId> | ||
<artifactId>com.regnosys.rosetta.parent</artifactId> | ||
<version>0.0.0.master</version> | ||
</parent> | ||
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>com.regnosys.rosetta</groupId> | ||
<artifactId>com.regnosys.rosetta.parent</artifactId> | ||
<version>0.0.0.master</version> | ||
</parent> | ||
|
||
<artifactId>com.regnosys.rosetta.lib</artifactId> | ||
<artifactId>com.regnosys.rosetta.lib</artifactId> | ||
|
||
<description> | ||
Responsibilities: defining the Java runtime necessary for running generated Java code. | ||
</description> | ||
<description> | ||
Responsibilities: defining the Java runtime necessary for running | ||
generated Java code. | ||
</description> | ||
|
||
<properties> | ||
<maven.compiler.release>8</maven.compiler.release> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<properties> | ||
<maven.compiler.release>8</maven.compiler.release> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.xtend</groupId> | ||
<artifactId>org.eclipse.xtend.lib</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
</dependency> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.xtend</groupId> | ||
<artifactId>org.eclipse.xtend.lib</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
|
||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.eclipse.xtend</groupId> | ||
<artifactId>xtend-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId> | ||
org.hamcrest</groupId> | ||
<artifactId>hamcrest-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.eclipse.xtend</groupId> | ||
<artifactId>xtend-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
rosetta-runtime/src/main/java/com/rosetta/util/serialisation/AttributeXMLConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.rosetta.util.serialisation; | ||
|
||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public class AttributeXMLConfiguration { | ||
private final Optional<String> xmlName; | ||
private final Optional<Map<String, String>> xmlAttributes; | ||
private final Optional<AttributeXMLRepresentation> xmlRepresentation; | ||
|
||
@JsonCreator | ||
public AttributeXMLConfiguration( | ||
@JsonProperty("xmlName") Optional<String> xmlName, | ||
@JsonProperty("xmlAttributes") Optional<Map<String, String>> xmlAttributes, | ||
@JsonProperty("xmlRepresentation") Optional<AttributeXMLRepresentation> xmlRepresentation) { | ||
this.xmlName = xmlName; | ||
this.xmlAttributes = xmlAttributes; | ||
this.xmlRepresentation = xmlRepresentation; | ||
} | ||
|
||
public Optional<String> getXmlName() { | ||
return xmlName; | ||
} | ||
|
||
public Optional<Map<String, String>> getXmlAttributes() { | ||
return xmlAttributes; | ||
} | ||
|
||
public Optional<AttributeXMLRepresentation> getXmlRepresentation() { | ||
return xmlRepresentation; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(xmlAttributes, xmlName, xmlRepresentation); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) | ||
return true; | ||
if (obj == null) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
AttributeXMLConfiguration other = (AttributeXMLConfiguration) obj; | ||
return Objects.equals(xmlAttributes, other.xmlAttributes) | ||
&& Objects.equals(xmlName, other.xmlName) && Objects.equals(xmlRepresentation, other.xmlRepresentation); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
rosetta-runtime/src/main/java/com/rosetta/util/serialisation/AttributeXMLRepresentation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.rosetta.util.serialisation; | ||
|
||
public enum AttributeXMLRepresentation { | ||
ELEMENT, | ||
ATTRIBUTE, | ||
VALUE; | ||
} |
50 changes: 50 additions & 0 deletions
50
rosetta-runtime/src/main/java/com/rosetta/util/serialisation/RosettaXMLConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.rosetta.util.serialisation; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.SortedMap; | ||
import java.util.TreeMap; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAnyGetter; | ||
import com.fasterxml.jackson.annotation.JsonAnySetter; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.rosetta.model.lib.ModelSymbolId; | ||
|
||
public class RosettaXMLConfiguration { | ||
@JsonAnyGetter | ||
private final SortedMap<ModelSymbolId, TypeXMLConfiguration> typeConfigMap; | ||
|
||
@JsonCreator | ||
private RosettaXMLConfiguration() { | ||
this(Collections.emptyMap()); | ||
} | ||
public RosettaXMLConfiguration(Map<ModelSymbolId, TypeXMLConfiguration> typeConfigMap) { | ||
this.typeConfigMap = new TreeMap<>(typeConfigMap); | ||
} | ||
|
||
public Optional<TypeXMLConfiguration> getConfigurationForType(ModelSymbolId symbolId) { | ||
return Optional.ofNullable(typeConfigMap.get(symbolId)); | ||
} | ||
|
||
@JsonAnySetter | ||
private void add(String symbolId, TypeXMLConfiguration config) { | ||
typeConfigMap.put(ModelSymbolId.splitOnDots(symbolId), config); | ||
} | ||
@Override | ||
public int hashCode() { | ||
return Objects.hash(typeConfigMap); | ||
} | ||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) | ||
return true; | ||
if (obj == null) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
RosettaXMLConfiguration other = (RosettaXMLConfiguration) obj; | ||
return Objects.equals(typeConfigMap, other.typeConfigMap); | ||
} | ||
} |
Oops, something went wrong.