-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FSADT1-751): updating dtos (#83)
* docs: updating documentation * feat: added retag to image * feat: skipping cert extract if using insecure port * chore: adding remove before publishing new version * chore: fixing legacy labels * feat(FSADT1-751): updating dtos on core * chore: updating sonar config * chore: removing unused props * chore: fixing some build issues related to doc * feat(FSADT1-751)!: adding processor dtos * feat(FSADT1-751)!: adding with to forest client * chore: adding missing methods * chore: removing @JsonValue from enums This is due to issues when exchanging data between the processor and the legacy app * chore: removing @JsonValue from enums This is due to issues when exchanging data between the processor and the legacy app * feat(FSADT1-751): adding legacy app dtos * Update Dockerfile --------- Co-authored-by: Maria Martinez <[email protected]>
- Loading branch information
1 parent
1869f39
commit 2c02eaf
Showing
95 changed files
with
2,417 additions
and
216 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
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
52 changes: 29 additions & 23 deletions
52
core/src/main/java/ca/bc/gov/app/dto/ValidationError.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,23 +1,29 @@ | ||
package ca.bc.gov.app.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.With; | ||
|
||
@Schema( | ||
description = "Represents a validation error during submission", | ||
title = "ValidationError", | ||
example = """ | ||
{ | ||
"fieldId": "person.name", | ||
"errorMsg": "Name is required" | ||
}""" | ||
) | ||
@With | ||
public record ValidationError( | ||
@Schema(description = "The field id that failed validation", example = "person.name") | ||
String fieldId, | ||
@Schema(description = "The error message for that specific field", example = "Name is required") | ||
String errorMsg | ||
) { | ||
|
||
} | ||
package ca.bc.gov.app.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.With; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
@Schema( | ||
description = "Represents a validation error during submission", | ||
title = "ValidationError", | ||
example = """ | ||
{ | ||
"fieldId": "person.name", | ||
"errorMsg": "Name is required" | ||
}""" | ||
) | ||
@With | ||
public record ValidationError( | ||
@Schema(description = "The field id that failed validation", example = "person.name") | ||
String fieldId, | ||
@Schema(description = "The error message for that specific field", example = "Name is required") | ||
String errorMsg | ||
) { | ||
|
||
@JsonIgnore | ||
public boolean isValid() { | ||
return !StringUtils.isAllBlank(fieldId, errorMsg); | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
core/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryAddressDto.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,76 @@ | ||
package ca.bc.gov.app.dto.bcregistry; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import java.util.Objects; | ||
import lombok.With; | ||
import org.apache.commons.lang3.builder.EqualsBuilder; | ||
import org.apache.commons.lang3.builder.HashCodeBuilder; | ||
|
||
/** | ||
* Data Transfer Object (DTO) representing an address in the BC Registry. | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@With | ||
public record BcRegistryAddressDto( | ||
String addressCity, | ||
String addressCountry, | ||
String addressRegion, | ||
String deliveryInstructions, | ||
String postalCode, | ||
String streetAddress, | ||
String streetAddressAdditional, | ||
String addressType | ||
) { | ||
|
||
/** | ||
* Checks if this object is equal to another object. | ||
* | ||
* @param o the object to compare with | ||
* @return true if the objects are equal, false otherwise | ||
*/ | ||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
|
||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
|
||
BcRegistryAddressDto that = (BcRegistryAddressDto) o; | ||
|
||
return new EqualsBuilder() | ||
.append(addressCity, that.addressCity) | ||
.append(addressCountry, that.addressCountry) | ||
.append(addressRegion, that.addressRegion) | ||
.append(postalCode, that.postalCode) | ||
.append(streetAddress, that.streetAddress) | ||
.isEquals(); | ||
} | ||
|
||
/** | ||
* Generates a hash code for this object. | ||
* | ||
* @return the hash code | ||
*/ | ||
@Override | ||
public int hashCode() { | ||
return new HashCodeBuilder(17, 37) | ||
.append(addressCity) | ||
.append(addressCountry) | ||
.append(addressRegion) | ||
.append(postalCode) | ||
.append(streetAddress) | ||
.toHashCode(); | ||
} | ||
|
||
/** | ||
* Validates the address. | ||
* | ||
* @return true if the street address and postal code are not null, false otherwise | ||
*/ | ||
public boolean isValid() { | ||
return !Objects.isNull(streetAddress) && !Objects.isNull(postalCode); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
core/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryAlternateNameDto.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,21 @@ | ||
package ca.bc.gov.app.dto.bcregistry; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import java.time.LocalDate; | ||
import java.time.ZonedDateTime; | ||
import lombok.With; | ||
|
||
/** | ||
* Data Transfer Object (DTO) representing an alternate name in the BC Registry. | ||
*/ | ||
@With | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record BcRegistryAlternateNameDto( | ||
String entityType, // The type of entity | ||
String identifier, // The identifier of the entity | ||
String name, // The alternate name of the entity | ||
ZonedDateTime registeredDate, // The date when the name was registered | ||
LocalDate startDate // The start date of the alternate name | ||
) { | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
core/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryBusinessAdressesDto.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,40 @@ | ||
package ca.bc.gov.app.dto.bcregistry; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
/** | ||
* Data Transfer Object (DTO) representing business addresses in the BC Registry. | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record BcRegistryBusinessAdressesDto( | ||
BcRegistryAddressDto mailingAddress, // The mailing address of the business | ||
BcRegistryAddressDto deliveryAddress // The delivery address of the business | ||
) { | ||
|
||
/** | ||
* Validates the business addresses. | ||
* | ||
* @return true if either the mailing address or the delivery address is not null, false otherwise | ||
*/ | ||
public boolean isValid() { | ||
return mailingAddress != null || deliveryAddress != null; | ||
} | ||
|
||
/** | ||
* Retrieves a set of business addresses with their types. | ||
* | ||
* @return a set of business addresses with their types | ||
*/ | ||
public Set<BcRegistryAddressDto> addresses() { | ||
Set<BcRegistryAddressDto> addressDtoSet = new HashSet<>(); | ||
if (mailingAddress != null) { | ||
addressDtoSet.add(mailingAddress.withAddressType("mailing")); | ||
} | ||
if (deliveryAddress != null) { | ||
addressDtoSet.add(deliveryAddress.withAddressType("delivery")); | ||
} | ||
return addressDtoSet; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
core/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryBusinessDto.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,48 @@ | ||
package ca.bc.gov.app.dto.bcregistry; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
import lombok.With; | ||
|
||
/** | ||
* Data Transfer Object (DTO) representing a business in the BC Registry. | ||
*/ | ||
@With | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record BcRegistryBusinessDto( | ||
List<BcRegistryAlternateNameDto> alternateNames, // List of alternate names for the business | ||
Boolean goodStanding, | ||
// Indicates if the business is in good standing | ||
Boolean hasCorrections, // Indicates if the business has corrections | ||
Boolean hasCourtOrders, // Indicates if the business has court orders | ||
Boolean hasRestrictions, // Indicates if the business has restrictions | ||
String identifier, // The identifier of the business | ||
String legalName, // The legal name of the business | ||
String legalType, // The legal type of the business | ||
String state // The state of the business | ||
) { | ||
|
||
/** | ||
* Resolves and returns the legal name of the business. If alternate names are available, it | ||
* returns the first registered alternate name. Otherwise, it returns the legal name. | ||
* | ||
* @return the resolved legal name of the business | ||
*/ | ||
public String getResolvedLegalName() { | ||
|
||
List<BcRegistryAlternateNameDto> names = | ||
(alternateNames == null || alternateNames.isEmpty()) | ||
? List.of() | ||
: alternateNames; | ||
|
||
return | ||
names | ||
.stream() | ||
.sorted(Comparator.comparing(BcRegistryAlternateNameDto::registeredDate)) | ||
.map(BcRegistryAlternateNameDto::name) | ||
.findFirst() | ||
.orElse(legalName); | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
core/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryDocumentAccessRequestDto.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,12 @@ | ||
package ca.bc.gov.app.dto.bcregistry; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import java.util.List; | ||
import lombok.With; | ||
|
||
@With | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record BcRegistryDocumentAccessRequestDto( | ||
List<BcRegistryDocumentAccessTypeDto> documents | ||
) { | ||
} |
13 changes: 13 additions & 0 deletions
13
core/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryDocumentAccessTypeDto.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 ca.bc.gov.app.dto.bcregistry; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.With; | ||
|
||
@With | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record BcRegistryDocumentAccessTypeDto( | ||
@JsonProperty("type") | ||
String documentType | ||
) { | ||
} |
31 changes: 31 additions & 0 deletions
31
core/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryDocumentDto.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,31 @@ | ||
package ca.bc.gov.app.dto.bcregistry; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import java.util.List; | ||
import lombok.With; | ||
|
||
@With | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record BcRegistryDocumentDto( | ||
BcRegistryBusinessDto business, | ||
BcRegistryOfficesDto offices, | ||
List<BcRegistryPartyDto> parties | ||
) { | ||
|
||
public boolean isOwnedByPerson() { | ||
List<BcRegistryPartyDto> localParties = parties == null ? List.of() : parties; | ||
return localParties.stream().anyMatch(BcRegistryPartyDto::isPerson); | ||
} | ||
|
||
public BcRegistryPartyDto getProprietor() { | ||
if (parties == null) { | ||
return null; | ||
} | ||
return parties | ||
.stream() | ||
.filter(BcRegistryPartyDto::isProprietor) | ||
.findFirst() | ||
.orElse(null); | ||
} | ||
|
||
} |
Oops, something went wrong.