generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
Constructor Invokes Overridable Function
Fortify finding (#1245)
* Refactored constructor and made class final * Converted immutable classes into records * Added missing tests fixes
- Loading branch information
1 parent
97d2245
commit 6be5312
Showing
4 changed files
with
10 additions
and
48 deletions.
There are no files selected for viewing
29 changes: 2 additions & 27 deletions
29
etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/orders/OrderResponse.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,34 +1,9 @@ | ||
package gov.hhs.cdc.trustedintermediary.etor.orders; | ||
|
||
/** Response for the v1/etor/orders endpoint. */ | ||
public class OrderResponse { | ||
|
||
private String fhirResourceId; | ||
private String patientId; | ||
|
||
OrderResponse(String fhirResourceId, String patientId) { | ||
setFhirResourceId(fhirResourceId); | ||
setPatientId(patientId); | ||
} | ||
public record OrderResponse(String fhirResourceId, String patientId) { | ||
|
||
public OrderResponse(Order<?> orders) { | ||
setFhirResourceId(orders.getFhirResourceId()); | ||
setPatientId(orders.getPatientId()); | ||
} | ||
|
||
public String getFhirResourceId() { | ||
return fhirResourceId; | ||
} | ||
|
||
public void setFhirResourceId(String fhirResourceId) { | ||
this.fhirResourceId = fhirResourceId; | ||
} | ||
|
||
public String getPatientId() { | ||
return patientId; | ||
} | ||
|
||
public void setPatientId(String patientId) { | ||
this.patientId = patientId; | ||
this(orders.getFhirResourceId(), orders.getPatientId()); | ||
} | ||
} |
17 changes: 2 additions & 15 deletions
17
etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/results/ResultResponse.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,21 +1,8 @@ | ||
package gov.hhs.cdc.trustedintermediary.etor.results; | ||
|
||
public class ResultResponse { | ||
private String fhirResourceId; | ||
|
||
public ResultResponse(String fhirResourceId) { | ||
this.fhirResourceId = fhirResourceId; | ||
} | ||
public record ResultResponse(String fhirResourceId) { | ||
|
||
public ResultResponse(Result<?> result) { | ||
this.fhirResourceId = result.getFhirResourceId(); | ||
} | ||
|
||
public String getFhirResourceId() { | ||
return fhirResourceId; | ||
} | ||
|
||
public void setFhirResourceId(final String fhirResourceId) { | ||
this.fhirResourceId = fhirResourceId; | ||
this(result.getFhirResourceId()); | ||
} | ||
} |
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