Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>eu.europa.ted.eforms</groupId>
<artifactId>eforms-core-java</artifactId>
<version>1.10.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>

<name>eForms Core Library</name>
<description>API and tools for eForms applications.</description>
Expand Down
15 changes: 3 additions & 12 deletions src/main/java/eu/europa/ted/eforms/sdk/entity/v2/SdkFieldV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@ public class SdkFieldV2 extends SdkFieldV1 {
*/
private static final String DISCLOSURE_CONTROL = "disclosureControl";

private final String alias;

public SdkFieldV2(String id, String type, String parentNodeId, String xpathAbsolute,
String xpathRelative, String rootCodelistId, boolean repeatable, String alias) {
String xpathRelative, String rootCodelistId, boolean repeatable) {
super(id, type, parentNodeId, xpathAbsolute, xpathRelative, rootCodelistId, repeatable);
this.alias = alias;
}

public SdkFieldV2(JsonNode fieldNode) {
super(fieldNode);
this.alias = fieldNode.has("alias") ? fieldNode.get("alias").asText(null) : null;
}

@JsonCreator
Expand All @@ -49,14 +45,9 @@ public SdkFieldV2(
@JsonProperty("xpathAbsolute") final String xpathAbsolute,
@JsonProperty("xpathRelative") final String xpathRelative,
@JsonProperty("codeList") final Map<String, Map<String, String>> codelist,
@JsonProperty("repeatable") final Map<String, Object> repeatable,
@JsonProperty("alias") final String alias) {
@JsonProperty("repeatable") final Map<String, Object> repeatable) {
this(id, type, parentNodeId, xpathAbsolute, xpathRelative, getCodelistId(codelist),
getRepeatable(repeatable), alias);
}

public String getAlias() {
return alias;
getRepeatable(repeatable));
}

/**
Expand Down
10 changes: 1 addition & 9 deletions src/main/java/eu/europa/ted/eforms/sdk/entity/v2/SdkNodeV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,18 @@
*/
@SdkComponent(versions = {"2"}, componentType = SdkComponentType.NODE)
public class SdkNodeV2 extends SdkNodeV1 {
private final String alias;

@JsonCreator
public SdkNodeV2(
@JsonProperty("id") String id,
@JsonProperty("parentId") String parentId,
@JsonProperty("xpathAbsolute") String xpathAbsolute,
@JsonProperty("xpathRelative") String xpathRelative,
@JsonProperty("repeatable") boolean repeatable,
@JsonProperty("alias") String alias) {
@JsonProperty("repeatable") boolean repeatable) {
super(id, parentId, xpathAbsolute, xpathRelative, repeatable);
this.alias = alias;
}

public SdkNodeV2(JsonNode node) {
super(node);
this.alias = node.has("alias") ? node.get("alias").asText(null) : null;
}

public String getAlias() {
return alias;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ void testEachSdkVersionGetsItsOwnFields() throws InstantiationException {

assertTrue(ofSdk1 instanceof SdkFieldV1, "SDK 1 gives " + ofSdk1.getClass());
assertTrue(ofSdk2 instanceof SdkFieldV2, "SDK 2 gives " + ofSdk2.getClass());
assertEquals("plain", ((SdkFieldV2) ofSdk2).getAlias(), "SDK 2 also reads the alias");
}

/** The constructor that takes a fields.json reads the file it is given. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ void testEachSdkVersionGetsItsOwnNodes() throws InstantiationException {

assertTrue(ofSdk1 instanceof SdkNodeV1, "SDK 1 gives " + ofSdk1.getClass());
assertTrue(ofSdk2 instanceof SdkNodeV2, "SDK 2 gives " + ofSdk2.getClass());
assertEquals("root", ((SdkNodeV2) ofSdk2).getAlias(), "SDK 2 also reads the alias");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"xpathAbsolute" : "/*/cac:ProcurementProjectLot/cbc:Plain",
"xpathRelative" : "cbc:Plain",
"type" : "text",
"repeatable" : true,
"alias" : "plain"
"repeatable" : true
},
{
"id" : "BT-NotRepeatable",
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/sdk-fixture/2.0/fields/fwd/fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"xpathAbsolute" : "/*/cac:ProcurementProjectLot/cbc:Plain",
"xpathRelative" : "cbc:Plain",
"type" : "text",
"repeatable" : true,
"alias" : "plain"
"repeatable" : true
}, {
"id" : "BT-NotRepeatable",
"parentNodeId" : "ND-Lot",
Expand Down
6 changes: 2 additions & 4 deletions src/test/resources/sdk-fixture/2.0/fields/fwd/nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"id" : "ND-Root",
"xpathAbsolute" : "/*",
"xpathRelative" : "/*",
"repeatable" : false,
"alias" : "root"
"repeatable" : false
}, {
"id" : "ND-Fwd-Only",
"parentId" : "ND-Lot",
Expand All @@ -20,7 +19,6 @@
"parentId" : "ND-Root",
"xpathAbsolute" : "/*/cac:ProcurementProjectLot",
"xpathRelative" : "cac:ProcurementProjectLot",
"repeatable" : true,
"alias" : "lot"
"repeatable" : true
} ]
}
Loading