generated from finos-labs/project-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4f6eb5
commit a189af3
Showing
14 changed files
with
313 additions
and
315 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,61 @@ | ||
package org.finos.calm.domain.adr; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; | ||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; | ||
import io.soabase.recordbuilder.core.RecordBuilder; | ||
|
||
/** | ||
* Represents an ADR and the associated namespace, id, and revision. | ||
* The ADR is represented as a String in JSON format. | ||
*/ | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
@RecordBuilder.Options(enableWither = false) | ||
@RecordBuilder | ||
public record Adr(String namespace, int id, int revision, AdrContent adrContent) { | ||
public record Adr( | ||
String title, | ||
Status status, | ||
@JsonDeserialize(using = LocalDateTimeDeserializer.class) | ||
@JsonSerialize(using = LocalDateTimeSerializer.class) | ||
LocalDateTime creationDateTime, | ||
@JsonDeserialize(using = LocalDateTimeDeserializer.class) | ||
@JsonSerialize(using = LocalDateTimeSerializer.class) | ||
LocalDateTime updateDateTime, | ||
String contextAndProblemStatement, | ||
List<String> decisionDrivers, | ||
List<Option> consideredOptions, | ||
Decision decisionOutcome, | ||
List<Link> links | ||
|
||
) { | ||
|
||
public static AdrBuilder builderFromNewAdr(NewAdrRequest newAdrRequest) { | ||
return AdrBuilder.builder() | ||
.title(newAdrRequest.title()) | ||
.contextAndProblemStatement(newAdrRequest.contextAndProblemStatement()) | ||
.decisionDrivers(newAdrRequest.decisionDrivers()) | ||
.consideredOptions(newAdrRequest.consideredOptions()) | ||
.decisionOutcome(newAdrRequest.decisionOutcome()) | ||
.links(newAdrRequest.links()); | ||
} | ||
|
||
// does not include datetimes in equals | ||
@Override | ||
public boolean equals(Object o) { | ||
if(this == o) return true; | ||
if(o == null || getClass() != o.getClass()) return false; | ||
Adr that = (Adr) o; | ||
return Objects.equals(title, that.title) && | ||
status == that.status && | ||
Objects.equals(contextAndProblemStatement, that.contextAndProblemStatement) && | ||
Objects.equals(decisionDrivers, that.decisionDrivers) && | ||
Objects.equals(consideredOptions, that.consideredOptions) && | ||
Objects.equals(decisionOutcome, that.decisionOutcome) && | ||
Objects.equals(links, that.links); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(title, status, contextAndProblemStatement, decisionDrivers, consideredOptions, decisionOutcome, links); | ||
} | ||
} |
61 changes: 0 additions & 61 deletions
61
calm-hub/src/main/java/org/finos/calm/domain/adr/AdrContent.java
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
calm-hub/src/main/java/org/finos/calm/domain/adr/AdrMeta.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,13 @@ | ||
package org.finos.calm.domain.adr; | ||
|
||
import io.soabase.recordbuilder.core.RecordBuilder; | ||
|
||
/** | ||
* Represents an ADR and the associated namespace, id, and revision. | ||
* The ADR is represented as a String in JSON format. | ||
*/ | ||
@RecordBuilder.Options(enableWither = false) | ||
@RecordBuilder | ||
public record AdrMeta(String namespace, int id, int revision, Adr adrContent) { | ||
|
||
} |
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
2 changes: 1 addition & 1 deletion
2
.../org/finos/calm/domain/adr/AdrStatus.java → ...ava/org/finos/calm/domain/adr/Status.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package org.finos.calm.domain.adr; | ||
|
||
public enum AdrStatus { | ||
public enum Status { | ||
draft, | ||
proposed, | ||
accepted, | ||
|
Oops, something went wrong.