Skip to content

Commit

Permalink
Merge branch 'main' into feat/ci/legacydb
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj authored Aug 26, 2024
2 parents fb0d155 + a5b0a9e commit eccf6e4
Show file tree
Hide file tree
Showing 44 changed files with 2,304 additions and 735 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ca.bc.gov.app.dto.bcregistry;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.time.LocalDate;
import java.time.ZonedDateTime;
import lombok.With;

@With
@JsonIgnoreProperties(ignoreUnknown = true)
public record BcRegistryAlternateNameDto(
String entityType,
String identifier,
String name,
ZonedDateTime registeredDate,
LocalDate startDate
) {

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package ca.bc.gov.app.dto.bcregistry;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Comparator;
import java.util.List;
import lombok.With;
import org.springframework.util.CollectionUtils;

@With
@JsonIgnoreProperties(ignoreUnknown = true)
public record BcRegistryBusinessDto(
List<BcRegistryAlternateNameDto> alternateNames,
Boolean goodStanding,
Boolean hasCorrections,
Boolean hasCourtOrders,
Expand All @@ -15,4 +19,21 @@ public record BcRegistryBusinessDto(
String legalType,
String state
) {

public String getResolvedLegalName() {

List<BcRegistryAlternateNameDto> names =
CollectionUtils.isEmpty(alternateNames)
? List.of()
: alternateNames;

return
names
.stream()
.sorted(Comparator.comparing(BcRegistryAlternateNameDto::registeredDate))
.map(BcRegistryAlternateNameDto::name)
.findFirst()
.orElse(legalName);
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package ca.bc.gov.app.dto.bcregistry;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.With;

@With
Expand All @@ -16,41 +12,9 @@ public record BcRegistryDocumentDto(
List<BcRegistryPartyDto> parties
) {

/**
* Returns a mapping of addresses to sets of parties associated with those addresses. If the
* offices object is valid, adds all of its addresses to the mapping with an empty set of parties.
* For each valid party, adds it to the set of parties associated with its mailing or delivery
* address in the mapping.
*
* @return a mapping of addresses to sets of parties associated with those addresses
*/
public Map<BcRegistryAddressDto, Set<BcRegistryPartyDto>> matchOfficesParties() {

Map<BcRegistryAddressDto, Set<BcRegistryPartyDto>> results = new HashMap<>();

// If offices exist and are valid, add all their addresses to the results map
if (offices != null && offices.isValid()) {
offices.addresses().forEach(address -> results.put(address, new HashSet<>()));
}

// For each party, if it's valid and has a mailing or delivery address,
// add it to the set of parties associated with that address in the results map
for (BcRegistryPartyDto party : parties) {
if (!party.isValid()) {
continue;
}

BcRegistryAddressDto mailingAddress = party.mailingAddress();
if (mailingAddress != null) {
results.computeIfAbsent(mailingAddress, key -> new HashSet<>()).add(party);
}

BcRegistryAddressDto deliveryAddress = party.deliveryAddress();
if (deliveryAddress != null) {
results.computeIfAbsent(deliveryAddress, key -> new HashSet<>()).add(party);
}
}

return results;
public boolean isOwnedByPerson() {
List<BcRegistryPartyDto> localParties = parties == null ? List.of() : parties;
return localParties.stream().anyMatch(BcRegistryPartyDto::isPerson);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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 BcRegistryFacetPartyDto(
String partyName,
List<String> partyRoles,
String partyType
) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ca.bc.gov.app.dto.bcregistry;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.List;
import java.util.Map;
import lombok.With;

@With
@JsonIgnoreProperties(ignoreUnknown = true)
public record BcRegistryFacetRequestBodyDto(
BcRegistryFacetRequestQueryDto query,
Map<String, List<String>> categories,
int rows,
int start
) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ca.bc.gov.app.dto.bcregistry;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.With;

@With
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public record BcRegistryFacetRequestQueryDto(
String value,
String name,
String identifier
) {

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ca.bc.gov.app.dto.bcregistry;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.List;
import lombok.With;

@With
Expand All @@ -11,6 +12,8 @@ public record BcRegistryFacetSearchResultEntryDto(
String legalType,
String name,
String status,
Boolean goodStanding
Boolean goodStanding,
List<BcRegistryFacetPartyDto> parties
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public record ClientDetailsDto(
Boolean goodStanding,
String clientType,
List<ClientAddressDto> addresses,
List<ClientContactDto> contacts
List<ClientContactDto> contacts,
boolean isOwnedByPerson
) {

}
Loading

0 comments on commit eccf6e4

Please sign in to comment.