Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/Ajout des champ de nack dans RC-REF #34

Merged
merged 20 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0db141d
Add refused and infoDistributionID to RC-REF model and modify related…
saveliy-sviridov Feb 6, 2024
8735686
Change order of properties
saveliy-sviridov Feb 6, 2024
646a067
⚙️ Auto-génération des classes et des specs
saveliy-sviridov Feb 6, 2024
6acf6ab
Add refused and infoDistributionID to RC-REF model and modify related…
saveliy-sviridov Feb 6, 2024
bd612f0
⚙️ Auto-génération des classes et des specs
saveliy-sviridov Feb 6, 2024
d1d9ae8
Updated common.openapi.yaml with new reference properties
saveliy-sviridov Feb 6, 2024
23c2817
⚙️ Auto-génération des classes et des specs
saveliy-sviridov Feb 6, 2024
6408b9d
Fix erroneous Reference.refused getter call
saveliy-sviridov Feb 6, 2024
e7647f8
⚙️ Auto-génération des classes et des specs
saveliy-sviridov Feb 6, 2024
d4f775e
Fix referenceWrapper test
saveliy-sviridov Feb 6, 2024
3feb25f
Merge remote-tracking branch 'origin/feat/nack-and-info' into feat/na…
saveliy-sviridov Feb 6, 2024
33ef0ca
⚙️ Auto-génération des classes et des specs
saveliy-sviridov Feb 6, 2024
b4cad39
feat/builders: modify reference builder and swap property order in co…
saveliy-sviridov Feb 16, 2024
302500b
Merge remote-tracking branch 'origin/feat/nack-and-info' into feat/na…
saveliy-sviridov Feb 16, 2024
283946b
feat/schema: update order of properties in rc-ref schema
saveliy-sviridov Feb 23, 2024
6d7952a
fix/builder: adding this
romainfd Mar 1, 2024
59fc3c9
chore: merge develop
romainfd Mar 1, 2024
47bf49e
fix: fixing github action for XSD
romainfd Mar 1, 2024
61a6078
⚙️ Auto-génération des classes et des specs
romainfd Mar 1, 2024
e0e68f7
chore: removing old files
romainfd Mar 1, 2024
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
6 changes: 6 additions & 0 deletions .github/workflows/generate-model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ jobs:
- '**.csv'

- name: Install Graphviz
if: steps.filter.outputs.parsing_required == 'true'
uses: ts-graphviz/setup-graphviz@v1

- name: Install python requirements
working-directory: ./csv_parser
if: steps.filter.outputs.parsing_required == 'true'
run: pip install -r ./requirements.txt

- name: Run csv_parser and collect OpenAPI & JSON Schemas
Expand All @@ -44,21 +46,25 @@ jobs:

- name: Install JDK 11
uses: actions/setup-java@v4
if: steps.filter.outputs.parsing_required == 'true'
with:
java-version: '11'
distribution: 'temurin'

- name: Generate XSDs
working-directory: ./csv_parser/json_schema2xsd
if: steps.filter.outputs.parsing_required == 'true'
run: gradle run

- name: Move XSDs to src
working-directory: ./csv_parser/json_schema2xsd
if: steps.filter.outputs.parsing_required == 'true'
run: |
mv out/*.xsd ../../src/main/resources/xsd/

- name: Remove input JSON Schemas
working-directory: ./csv_parser/json_schema2xsd
if: steps.filter.outputs.parsing_required == 'true'
run: |
rm src/main/resources/*.json

Expand Down
4 changes: 4 additions & 0 deletions generator/input/common.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,9 @@ components:
properties:
distributionID:
type: string
refused:
type: boolean
infoDistributionID:
type: string
required:
- distributionID
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ public ReferenceWrapperBuilder(DistributionElement distributionElement, String r
this.reference = new Reference().distributionID(referencedDistributionId);
}

public ReferenceWrapperBuilder refused(boolean refused) {
this.reference.setRefused(refused);
return this;
}

public ReferenceWrapperBuilder infoDistributionID(String infoDistributionID) {
this.reference.setInfoDistributionID(infoDistributionID);
return this;
}
Comment on lines +37 to +40
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On aurait limite pu mettre refused = true dans ce cas là aussi par cohérence et ne pas mettre de builder sur refused vu que les 2 vont toujours ensemble


public ReferenceWrapper build() {
ReferenceWrapper referenceMessage = new ReferenceWrapper();
referenceMessage.setMessageId(distributionElement.getMessageId());
Expand All @@ -40,6 +50,12 @@ public ReferenceWrapper build() {
referenceMessage.setKind(distributionElement.getKind());
referenceMessage.setStatus(distributionElement.getStatus());
referenceMessage.setRecipient(distributionElement.getRecipient());
// Check if reference.refused is not null and set to true, if it is check if reference.infoDistributionID
// is set, otherwise throw an IllegalArgumentException
if (this.reference.getRefused() != null && this.reference.getRefused() && this.reference.getInfoDistributionID() == null) {
throw new IllegalArgumentException("ReferenceWrapper must have infoDistributionID set when refused is true");
}

referenceMessage.setReference(reference);
return referenceMessage;
}
Expand Down
67 changes: 64 additions & 3 deletions src/main/java/com/hubsante/model/common/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
/**
* Reference
*/
@JsonPropertyOrder({Reference.JSON_PROPERTY_DISTRIBUTION_I_D})
@JsonPropertyOrder({Reference.JSON_PROPERTY_DISTRIBUTION_I_D,
Reference.JSON_PROPERTY_REFUSED,
Reference.JSON_PROPERTY_INFO_DISTRIBUTION_I_D})
@JsonInclude(JsonInclude.Include.NON_EMPTY)

public class Reference {
Expand All @@ -50,6 +52,13 @@ public class Reference {
public static final String JSON_PROPERTY_DISTRIBUTION_I_D = "distributionID";
private String distributionID;

public static final String JSON_PROPERTY_REFUSED = "refused";
private Boolean refused;

public static final String JSON_PROPERTY_INFO_DISTRIBUTION_I_D =
"infoDistributionID";
private String infoDistributionID;

public Reference() {}

public Reference distributionID(String distributionID) {
Expand All @@ -75,6 +84,52 @@ public void setDistributionID(String distributionID) {
this.distributionID = distributionID;
}

public Reference refused(Boolean refused) {

this.refused = refused;
return this;
}

/**
* Get refused
* @return refused
**/
@JsonProperty(JSON_PROPERTY_REFUSED)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Boolean getRefused() {
return refused;
}

@JsonProperty(JSON_PROPERTY_REFUSED)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setRefused(Boolean refused) {
this.refused = refused;
}

public Reference infoDistributionID(String infoDistributionID) {

this.infoDistributionID = infoDistributionID;
return this;
}

/**
* Get infoDistributionID
* @return infoDistributionID
**/
@JsonProperty(JSON_PROPERTY_INFO_DISTRIBUTION_I_D)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getInfoDistributionID() {
return infoDistributionID;
}

@JsonProperty(JSON_PROPERTY_INFO_DISTRIBUTION_I_D)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setInfoDistributionID(String infoDistributionID) {
this.infoDistributionID = infoDistributionID;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -84,12 +139,14 @@ public boolean equals(Object o) {
return false;
}
Reference reference = (Reference)o;
return Objects.equals(this.distributionID, reference.distributionID);
return Objects.equals(this.distributionID, reference.distributionID) &&
Objects.equals(this.refused, reference.refused) &&
Objects.equals(this.infoDistributionID, reference.infoDistributionID);
}

@Override
public int hashCode() {
return Objects.hash(distributionID);
return Objects.hash(distributionID, refused, infoDistributionID);
}

@Override
Expand All @@ -99,6 +156,10 @@ public String toString() {
sb.append(" distributionID: ")
.append(toIndentedString(distributionID))
.append("\n");
sb.append(" refused: ").append(toIndentedString(refused)).append("\n");
sb.append(" infoDistributionID: ")
.append(toIndentedString(infoDistributionID))
.append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Loading