From 20be9fae94408ae9064a75b64e2e157d0ee69151 Mon Sep 17 00:00:00 2001 From: lazaki Date: Tue, 5 May 2020 16:53:46 +0200 Subject: [PATCH 1/5] [BABEL-1305] - change Cancellation entity to accept Identifier identifier of contractId --- .../corellia/api/entities/Cancellation.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java b/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java index 120c410..309bb2e 100644 --- a/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java +++ b/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyDescription; import java.io.Serializable; import java.time.LocalDate; +import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @@ -13,26 +14,20 @@ public class Cancellation implements Serializable { private static final long serialVersionUID = 10; @NotNull - @Size(max = CONTRACT_ID_MAX_SIZE) - @JsonPropertyDescription( - "Id given by SaaS provider. Identifies the contract which should be cancelled") - private String contractId; + @Valid + private Identifier identifier; @NotNull @JsonPropertyDescription("effecitve date of cancellation") private LocalDate effectiveDate; @NotNull - @JsonPropertyDescription("A code uniquely identifying the cancellation reason") + @JsonPropertyDescription("A code uniquely identifying the ccancellation reason") private Integer reasonCode; - public String getContractId() { - return contractId; - } + public Identifier getIdentifier() { return identifier; } - public void setContractId(String contractId) { - this.contractId = contractId; - } + public void setIdentifier(Identifier identifier) { this.identifier = identifier; } public LocalDate getEffectiveDate() { return effectiveDate; From bd988541f908c8dbfea5b384294aa0887fc551ea Mon Sep 17 00:00:00 2001 From: lazaki Date: Tue, 5 May 2020 16:02:44 +0000 Subject: [PATCH 2/5] [BABEL-1305] - generate swagger and openapi files --- docs/openapi.json | 11 ++++------- docs/swagger.json | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/docs/openapi.json b/docs/openapi.json index 7f267b2..da3cde9 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -976,14 +976,11 @@ } }, "Cancellation" : { - "required" : [ "contractId", "effectiveDate", "reasonCode" ], + "required" : [ "effectiveDate", "identifier", "reasonCode" ], "type" : "object", "properties" : { - "contractId" : { - "maxLength" : 20, - "minLength" : 0, - "type" : "string", - "description" : "Id given by SaaS provider. Identifies the contract which should be cancelled" + "identifier" : { + "$ref" : "#/components/schemas/Identifier" }, "effectiveDate" : { "type" : "string", @@ -992,7 +989,7 @@ }, "reasonCode" : { "type" : "integer", - "description" : "A code uniquely identifying the cancellation reason", + "description" : "A code uniquely identifying the ccancellation reason", "format" : "int32" } } diff --git a/docs/swagger.json b/docs/swagger.json index 51a84c8..ae2bb00 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -464,17 +464,14 @@ }, "Cancellation": { "properties": { - "contractId": { - "description": "Id given by SaaS provider. Identifies the contract which should be cancelled", - "maxLength": 20, - "minLength": 0, - "type": "string" - }, "effectiveDate": { "description": "effecitve date of cancellation", "format": "date", "type": "string" }, + "identifier": { + "$ref": "#/definitions/Identifier" + }, "reasonCode": { "description": "A code uniquely identifying the cancellation reason", "format": "int32", @@ -482,8 +479,8 @@ } }, "required": [ - "contractId", "effectiveDate", + "identifier", "reasonCode" ], "type": "object" From 138469643a831575fca8887b4a62289b79939a28 Mon Sep 17 00:00:00 2001 From: lazaki Date: Tue, 5 May 2020 16:55:53 +0000 Subject: [PATCH 3/5] [BABEL-1305] - fix typo in cancelation --- docs/swagger.json | 2 +- .../java/ch/baloise/corellia/api/entities/Cancellation.java | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/swagger.json b/docs/swagger.json index ae2bb00..b8b621d 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -473,7 +473,7 @@ "$ref": "#/definitions/Identifier" }, "reasonCode": { - "description": "A code uniquely identifying the cancellation reason", + "description": "A code uniquely identifying the ccancellation reason", "format": "int32", "type": "integer" } diff --git a/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java b/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java index 309bb2e..4b4b562 100644 --- a/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java +++ b/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java @@ -1,13 +1,10 @@ package ch.baloise.corellia.api.entities; -import static ch.baloise.corellia.api.constraints.SizeConstraint.CONTRACT_ID_MAX_SIZE; - import com.fasterxml.jackson.annotation.JsonPropertyDescription; import java.io.Serializable; import java.time.LocalDate; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; public class Cancellation implements Serializable { @@ -22,7 +19,7 @@ public class Cancellation implements Serializable { private LocalDate effectiveDate; @NotNull - @JsonPropertyDescription("A code uniquely identifying the ccancellation reason") + @JsonPropertyDescription("A code uniquely identifying the cancellation reason") private Integer reasonCode; public Identifier getIdentifier() { return identifier; } From 943ba1fa4894ab288f9a2580cbc969b762ac75a5 Mon Sep 17 00:00:00 2001 From: lazaki Date: Wed, 6 May 2020 06:06:20 +0000 Subject: [PATCH 4/5] [BABEL-1305] - change Cancellation entity to accept Action --- docs/openapi.json | 10 ++-- docs/swagger.json | 10 ++-- .../corellia/api/entities/Cancellation.java | 53 ++++++++++--------- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/docs/openapi.json b/docs/openapi.json index da3cde9..1162ef6 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -976,20 +976,18 @@ } }, "Cancellation" : { - "required" : [ "effectiveDate", "identifier", "reasonCode" ], + "required" : [ "action", "identifier", "reasonCode" ], "type" : "object", "properties" : { "identifier" : { "$ref" : "#/components/schemas/Identifier" }, - "effectiveDate" : { - "type" : "string", - "description" : "effecitve date of cancellation", - "format" : "date" + "action" : { + "$ref" : "#/components/schemas/Action" }, "reasonCode" : { "type" : "integer", - "description" : "A code uniquely identifying the ccancellation reason", + "description" : "A code uniquely identifying the cancellation reason", "format" : "int32" } } diff --git a/docs/swagger.json b/docs/swagger.json index b8b621d..c019249 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -464,22 +464,20 @@ }, "Cancellation": { "properties": { - "effectiveDate": { - "description": "effecitve date of cancellation", - "format": "date", - "type": "string" + "action": { + "$ref": "#/definitions/Action" }, "identifier": { "$ref": "#/definitions/Identifier" }, "reasonCode": { - "description": "A code uniquely identifying the ccancellation reason", + "description": "A code uniquely identifying the cancellation reason", "format": "int32", "type": "integer" } }, "required": [ - "effectiveDate", + "action", "identifier", "reasonCode" ], diff --git a/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java b/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java index 4b4b562..80f623b 100644 --- a/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java +++ b/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java @@ -2,43 +2,46 @@ import com.fasterxml.jackson.annotation.JsonPropertyDescription; import java.io.Serializable; -import java.time.LocalDate; import javax.validation.Valid; import javax.validation.constraints.NotNull; public class Cancellation implements Serializable { - private static final long serialVersionUID = 10; + private static final long serialVersionUID = 10; - @NotNull - @Valid - private Identifier identifier; + @NotNull + @Valid + private Identifier identifier; - @NotNull - @JsonPropertyDescription("effecitve date of cancellation") - private LocalDate effectiveDate; + @NotNull + @Valid + private Action action; - @NotNull - @JsonPropertyDescription("A code uniquely identifying the cancellation reason") - private Integer reasonCode; + @NotNull + @JsonPropertyDescription("A code uniquely identifying the cancellation reason") + private Integer reasonCode; - public Identifier getIdentifier() { return identifier; } + public Identifier getIdentifier() { + return identifier; + } - public void setIdentifier(Identifier identifier) { this.identifier = identifier; } + public void setIdentifier(Identifier identifier) { + this.identifier = identifier; + } - public LocalDate getEffectiveDate() { - return effectiveDate; - } + public Action getAction() { + return action; + } - public void setEffectiveDate(LocalDate effectiveDate) { - this.effectiveDate = effectiveDate; - } + public void setAction(Action action) { + this.action = action; + } - public Integer getReasonCode() { - return reasonCode; - } + public Integer getReasonCode() { + return reasonCode; + } - public void setReasonCode(Integer reasonCode) { - this.reasonCode = reasonCode; - } + public void setReasonCode(Integer reasonCode) { + this.reasonCode = reasonCode; + } } From ad84c364771ea92f10ffc4b0b77383f1b884f4f0 Mon Sep 17 00:00:00 2001 From: lazaki Date: Wed, 6 May 2020 06:39:43 +0000 Subject: [PATCH 5/5] [BABEL-1305] - remove reasonCode from entity --- docs/openapi.json | 7 +------ docs/swagger.json | 8 +------- .../baloise/corellia/api/entities/Cancellation.java | 12 ------------ 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/docs/openapi.json b/docs/openapi.json index 1162ef6..9a4876d 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -976,7 +976,7 @@ } }, "Cancellation" : { - "required" : [ "action", "identifier", "reasonCode" ], + "required" : [ "action", "identifier" ], "type" : "object", "properties" : { "identifier" : { @@ -984,11 +984,6 @@ }, "action" : { "$ref" : "#/components/schemas/Action" - }, - "reasonCode" : { - "type" : "integer", - "description" : "A code uniquely identifying the cancellation reason", - "format" : "int32" } } } diff --git a/docs/swagger.json b/docs/swagger.json index c019249..3d0aed1 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -469,17 +469,11 @@ }, "identifier": { "$ref": "#/definitions/Identifier" - }, - "reasonCode": { - "description": "A code uniquely identifying the cancellation reason", - "format": "int32", - "type": "integer" } }, "required": [ "action", - "identifier", - "reasonCode" + "identifier" ], "type": "object" }, diff --git a/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java b/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java index 80f623b..5988b48 100644 --- a/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java +++ b/src/main/java/ch/baloise/corellia/api/entities/Cancellation.java @@ -1,6 +1,5 @@ package ch.baloise.corellia.api.entities; -import com.fasterxml.jackson.annotation.JsonPropertyDescription; import java.io.Serializable; import javax.validation.Valid; import javax.validation.constraints.NotNull; @@ -17,10 +16,6 @@ public class Cancellation implements Serializable { @Valid private Action action; - @NotNull - @JsonPropertyDescription("A code uniquely identifying the cancellation reason") - private Integer reasonCode; - public Identifier getIdentifier() { return identifier; } @@ -37,11 +32,4 @@ public void setAction(Action action) { this.action = action; } - public Integer getReasonCode() { - return reasonCode; - } - - public void setReasonCode(Integer reasonCode) { - this.reasonCode = reasonCode; - } }