diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge-main.yml index c56a5dcbc9..cad34b67a8 100644 --- a/.github/workflows/merge-main.yml +++ b/.github/workflows/merge-main.yml @@ -228,7 +228,7 @@ jobs: -p PROMOTE=${{ github.repository }}/backend:${{ env.ZONE }} -p CHES_TOKEN_URL='https://test.loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token' -p CHES_API_URL='https://ches-test.api.gov.bc.ca/api/v1' - -p BCREGISTRY_URI='https://bcregistry-sandbox.apigee.net' + -p BCREGISTRY_URI='https://bcregistry-prod.apigee.net' - name: Deplo Legacy uses: bcgov-nr/action-deployer-openshift@v1.0.2 @@ -243,7 +243,7 @@ jobs: parameters: -p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }} -p PROMOTE=${{ github.repository }}/legacy:${{ env.ZONE }} - -p FOREST_API_URL=https://${{ github.event.repository.name }}-${{ env.ZONE }}-backend.${{ env.DOMAIN }} + -p BCREGISTRY_URI='https://bcregistry-prod.apigee.net' - name: Deploy Frontend uses: bcgov-nr/action-deployer-openshift@v1.0.2 @@ -385,7 +385,7 @@ jobs: parameters: -p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }} -p PROMOTE=${{ github.repository }}/legacy:${{ env.PREV }} - -p FOREST_API_URL=https://${{ github.event.repository.name }}-${{ env.ZONE }}-backend.${{ env.DOMAIN }} + -p BCREGISTRY_URI='https://bcregistry-prod.apigee.net' - name: Deploy Frontend uses: bcgov-nr/action-deployer-openshift@v1.0.2 diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 417a2442bf..132bba5655 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -259,7 +259,7 @@ jobs: -p PROMOTE=${{ github.repository }}/backend:${{ github.event.number }} -p CHES_TOKEN_URL='https://dev.loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token' -p CHES_API_URL='https://ches-dev.api.gov.bc.ca/api/v1' - -p BCREGISTRY_URI='https://bcregistry-sandbox.apigee.net' + -p BCREGISTRY_URI='https://bcregistry-prod.apigee.net' deploy-legacy: name: Deploy Legacy @@ -286,7 +286,7 @@ jobs: parameters: -p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }} -p PROMOTE=${{ github.repository }}/legacy:${{ github.event.number }} - -p FOREST_API_URL=https://${{ github.event.repository.name }}-${{ github.event.number }}-backend.apps.silver.devops.gov.bc.ca + -p BCREGISTRY_URI='https://bcregistry-prod.apigee.net' deploy-frontend: name: Deploy Frontend diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index 067c160aaa..bf5aab32cc 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -43,6 +43,7 @@ management: include: principal,request-headers,response-headers,cookie-headers,time-taken,authorization-header,remote-address,session-id springdoc: + enable-native-support: true webjars: prefix: /v3 api-docs: @@ -65,7 +66,7 @@ ca: bcregistry: uri: ${BCREGISTRY_URI:https://bcregistry-sandbox.apigee.net} apiKey: ${BCREGISTRY_KEY:123456} - accountId: account ${BCREGISTRY_ACCOUNT:123456} + accountId: ${BCREGISTRY_ACCOUNT:123456} openmaps: uri: https://openmaps.gov.bc.ca/geo/pub/ows postgres: diff --git a/common/Dockerfile b/common/Dockerfile index ec8bde6ad6..dbce079a08 100644 --- a/common/Dockerfile +++ b/common/Dockerfile @@ -5,7 +5,6 @@ WORKDIR /app ENV LANG en_CA.UTF-8 ENV LANGUAGE en_CA.UTF-8 ENV LC_ALL en_CA.UTF-8 -ENV JAVA_OPS -Xms512m -Xmx512m COPY startup.sh . COPY InstallCert.java . @@ -14,10 +13,6 @@ RUN chmod g+w /app && \ chmod g+x startup.sh && \ chmod g+w ${JAVA_HOME}/lib/security/cacerts -EXPOSE 3001 - -HEALTHCHECK --interval=35s --timeout=4s CMD wget --spider -S http://127.0.0.1:3001/health || exit 1 - # Non-privileged user USER app diff --git a/legacy/.gitignore b/legacy/.gitignore index f306da9139..0eeba7bb47 100644 --- a/legacy/.gitignore +++ b/legacy/.gitignore @@ -225,3 +225,6 @@ buildNumber.properties # The below expression will prevent user specific configuration files from being added to the repository config/application-dev-*.yml .checkstyle + + +temp/ \ No newline at end of file diff --git a/legacy/docs/eclipse-code-style.png b/legacy/docs/eclipse-code-style.png new file mode 100644 index 0000000000..d1359b6ead Binary files /dev/null and b/legacy/docs/eclipse-code-style.png differ diff --git a/legacy/docs/eclipse-java-google-style.xml b/legacy/docs/eclipse-java-google-style.xml new file mode 100644 index 0000000000..7bb6804eb3 --- /dev/null +++ b/legacy/docs/eclipse-java-google-style.xml @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/legacy/docs/eclipse-lombok.png b/legacy/docs/eclipse-lombok.png new file mode 100644 index 0000000000..7b764aa8fd Binary files /dev/null and b/legacy/docs/eclipse-lombok.png differ diff --git a/legacy/docs/eclipse-run-config1.png b/legacy/docs/eclipse-run-config1.png new file mode 100644 index 0000000000..b4256fb183 Binary files /dev/null and b/legacy/docs/eclipse-run-config1.png differ diff --git a/legacy/docs/eclipse-run-config2.png b/legacy/docs/eclipse-run-config2.png new file mode 100644 index 0000000000..81eef96940 Binary files /dev/null and b/legacy/docs/eclipse-run-config2.png differ diff --git a/legacy/docs/google_checks.xml b/legacy/docs/google_checks.xml new file mode 100644 index 0000000000..642e443a0e --- /dev/null +++ b/legacy/docs/google_checks.xml @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/legacy/docs/intellij-code-style.png b/legacy/docs/intellij-code-style.png new file mode 100644 index 0000000000..1182839edd Binary files /dev/null and b/legacy/docs/intellij-code-style.png differ diff --git a/legacy/docs/intellij-java-google-style.xml b/legacy/docs/intellij-java-google-style.xml new file mode 100644 index 0000000000..f3a6743efa --- /dev/null +++ b/legacy/docs/intellij-java-google-style.xml @@ -0,0 +1,598 @@ + + + + + + diff --git a/legacy/docs/intellij-run-config.png b/legacy/docs/intellij-run-config.png new file mode 100644 index 0000000000..b9c70d20e3 Binary files /dev/null and b/legacy/docs/intellij-run-config.png differ diff --git a/legacy/openshift.deploy.yml b/legacy/openshift.deploy.yml index e42b69bdf7..1f8f0eecfa 100644 --- a/legacy/openshift.deploy.yml +++ b/legacy/openshift.deploy.yml @@ -24,9 +24,6 @@ parameters: - name: PROMOTE description: Image (namespace/name:tag) to promote/import value: bcgov/nr-old-growth:prod-backend - - name: FOREST_API_URL - description: Forest Client service api url - required: true - name: ORACLEDB_KEYSTORE description: Oracle database keystore file - name: CPU_REQUEST @@ -37,6 +34,9 @@ parameters: value: 75Mi - name: MEMORY_LIMIT value: 75Mi + - name: BCREGISTRY_URI + description: Bc Registry API address + required: true objects: - apiVersion: v1 kind: ImageStream @@ -85,6 +85,8 @@ objects: volumes: - name: certs emptyDir: { } + - name: reports + emptyDir: { } initContainers: - name: ${NAME}-init image: ${REGISTRY}/bcgov/${NAME}/common:${ZONE} @@ -104,15 +106,11 @@ objects: - image: ${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG} imagePullPolicy: Always name: ${NAME} - env: - - name: FRONTEND_URL - value: https://${NAME}-${ZONE}-frontend.${DOMAIN} + env: - name: BACKEND_URL value: https://${NAME}-${ZONE}-backend.${DOMAIN} - - name: LEGACY_URL - value: https://${NAME}-${ZONE}-legacy.${DOMAIN} - name: FOREST_API_URL - value: ${FOREST_API_URL} + value: https://${NAME}-${ZONE}-legacy.${DOMAIN} - name: ORACLEDB_USER valueFrom: secretKeyRef: @@ -147,6 +145,18 @@ objects: key: oracle-secret - name: ORACLEDB_KEYSTORE value: /cert/jssecacerts + - name: BCREGISTRY_URI + value: ${BCREGISTRY_URI} + - name: BCREGISTRY_KEY + valueFrom: + secretKeyRef: + name: ${NAME}-${ZONE} + key: bcregistry-key + - name: BCREGISTRY_ACCOUNT + valueFrom: + secretKeyRef: + name: ${NAME}-${ZONE} + key: bcregistry-account ports: - containerPort: 9000 protocol: TCP @@ -180,6 +190,8 @@ objects: volumeMounts: - mountPath: /cert name: certs + - mountPath: /workspace/temp + name: reports - apiVersion: v1 kind: Service metadata: diff --git a/legacy/pom.xml b/legacy/pom.xml index 6f76a11d67..546cb1dfa4 100644 --- a/legacy/pom.xml +++ b/legacy/pom.xml @@ -67,6 +67,7 @@ 2022.0.1 ${project.version} + 5.2.3 @@ -114,6 +115,12 @@ true + + org.dhatim + fastexcel + 0.15.3 + + org.springframework.boot spring-boot-starter-test @@ -211,7 +218,7 @@ gcr.io/paketo-buildpacks/image-labels - 19.0.2 + 17 https://github.com/bcgov/nr-forest-client ${project.version} ${project.description} @@ -272,7 +279,7 @@ org.jacoco jacoco-maven-plugin - 0.8.9 + 0.8.8 ${jacoco.skip} diff --git a/legacy/src/main/java/ca/bc/gov/app/LegacyApplication.java b/legacy/src/main/java/ca/bc/gov/app/LegacyApplication.java index 31e73eeb28..f77b71ea21 100644 --- a/legacy/src/main/java/ca/bc/gov/app/LegacyApplication.java +++ b/legacy/src/main/java/ca/bc/gov/app/LegacyApplication.java @@ -3,8 +3,10 @@ import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.servers.Server; +import org.slf4j.bridge.SLF4JBridgeHandler; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @OpenAPIDefinition(info = @Info( @@ -16,9 +18,12 @@ @Server(url = "/", description = "Default Server URL") } ) +@EnableScheduling public class LegacyApplication { public static void main(String[] args) { + SLF4JBridgeHandler.removeHandlersForRootLogger(); + SLF4JBridgeHandler.install(); SpringApplication.run(LegacyApplication.class, args); } diff --git a/legacy/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java b/legacy/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java index beab39167a..17ce1298b7 100644 --- a/legacy/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java +++ b/legacy/src/main/java/ca/bc/gov/app/configuration/GlobalServiceConfiguration.java @@ -1,15 +1,31 @@ package ca.bc.gov.app.configuration; +import ca.bc.gov.app.dto.OrgBookTopicDto; +import ca.bc.gov.app.dto.OrgBookTopicListResponse; +import org.springframework.aot.hint.annotation.RegisterReflectionForBinding; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.function.client.WebClient; @Configuration +@RegisterReflectionForBinding({OrgBookTopicDto.class, OrgBookTopicListResponse.class}) public class GlobalServiceConfiguration { + /** + * Creates and configures a WebClient instance for accessing OrgBook API based on the provided + * {@link LegacyConfiguration}. + * + * @param configuration The {@link LegacyConfiguration} containing the OrgBook API URI. + * @return A {@link WebClient} instance configured for accessing OrgBook API. + */ @Bean - public WebClient forestClientApi(ForestConfiguration configuration) { - return WebClient.builder().baseUrl(configuration.getUri()).build(); + public WebClient orgBookApi(LegacyConfiguration configuration) { + return WebClient.builder().baseUrl(configuration.getOrgbook()).build(); + } + + @Bean + public WebClient forestClientApi(LegacyConfiguration configuration) { + return WebClient.builder().baseUrl(configuration.getForest().getUri()).build(); } } diff --git a/legacy/src/main/java/ca/bc/gov/app/configuration/ForestConfiguration.java b/legacy/src/main/java/ca/bc/gov/app/configuration/LegacyConfiguration.java similarity index 54% rename from legacy/src/main/java/ca/bc/gov/app/configuration/ForestConfiguration.java rename to legacy/src/main/java/ca/bc/gov/app/configuration/LegacyConfiguration.java index c0f85ce886..49760e46bd 100644 --- a/legacy/src/main/java/ca/bc/gov/app/configuration/ForestConfiguration.java +++ b/legacy/src/main/java/ca/bc/gov/app/configuration/LegacyConfiguration.java @@ -12,7 +12,16 @@ @NoArgsConstructor @AllArgsConstructor @Component -@ConfigurationProperties("ca.bc.gov.nrs.forest") -public class ForestConfiguration { - private String uri; +@ConfigurationProperties("ca.bc.gov.nrs") +public class LegacyConfiguration { + private ForestClientConfiguration forest; + private String orgbook; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class ForestClientConfiguration { + private String uri; + } } diff --git a/legacy/src/main/java/ca/bc/gov/app/controller/ClientSearchController.java b/legacy/src/main/java/ca/bc/gov/app/controller/ClientSearchController.java index 36e91ed31d..a518a83f44 100644 --- a/legacy/src/main/java/ca/bc/gov/app/controller/ClientSearchController.java +++ b/legacy/src/main/java/ca/bc/gov/app/controller/ClientSearchController.java @@ -75,57 +75,5 @@ public Flux findByIncorporationOrName( .findByIncorporationOrName(incorporationNumber, companyName); } - @GetMapping("/nameAndBirth") - @Operation( - summary = "List forest client entries by first name, last name and date of birth", - responses = { - @ApiResponse( - responseCode = "200", - description = "Returns a client based on it's number", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - array = @ArraySchema( - schema = @Schema( - name = "ForestClient", - implementation = ForestClientDto.class - ) - ) - ) - ) - } - ) - public Flux findByNameAndBirth( - @Parameter( - description = "First name to lookup. For companies, you can pass an empty value", - example = "Jhon", - required = false - ) - @RequestParam(required = false,defaultValue = "") String firstName, - - @Parameter( - description = "Last name to lookup. For companies, this will be the company name", - example = "Doh", - required = false - ) - @RequestParam(required = false) String lastName, - - @Parameter( - description = """ - Date of birth to lookup in an ISO Local Date format, - such as YYYY-MM-dd.
- For companies, you can pass an empty value""", - example = "1955-05-09", - required = false - ) - @RequestParam(required = false,defaultValue = "") String birthdate - ) { - return service - .findByNameAndBirth( - Optional.ofNullable(firstName), - Optional.ofNullable(lastName), - Optional.ofNullable(birthdate) - ); - } - } diff --git a/legacy/src/main/java/ca/bc/gov/app/controller/ForestClientController.java b/legacy/src/main/java/ca/bc/gov/app/controller/ForestClientController.java deleted file mode 100644 index 0547917c97..0000000000 --- a/legacy/src/main/java/ca/bc/gov/app/controller/ForestClientController.java +++ /dev/null @@ -1,103 +0,0 @@ -package ca.bc.gov.app.controller; - -import ca.bc.gov.app.dto.ClientPublicViewDto; -import ca.bc.gov.app.dto.FirstNationBandVidationDto; -import ca.bc.gov.app.dto.ForestClientDto; -import ca.bc.gov.app.service.ForestClientService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.ArraySchema; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import reactor.core.publisher.Flux; - -@RestController -@Slf4j -@Tag( - name = "Forest Client", - description = "Aggregation and other reports for forest clients" -) -@RequestMapping(value = "/api/client", produces = MediaType.APPLICATION_JSON_VALUE) -@RequiredArgsConstructor -public class ForestClientController { - - private final ForestClientService service; - - @GetMapping("/bands") - @Operation( - summary = "List First nation band validation information", - responses = { - @ApiResponse( - responseCode = "200", - description = "Returns a client based on it's number", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - array = @ArraySchema( - schema = @Schema( - name = "FirstNationBand", - implementation = FirstNationBandVidationDto.class - ) - ) - ) - ) - } - ) - public Flux getFirstNationBandInfo() { - return service.getFirstNationBandInfo(); - } - - - @GetMapping("/business") - @Operation( - summary = "List all clients we are doing business with", - responses = { - @ApiResponse( - responseCode = "200", - description = "Returns a client based on it's number", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - array = @ArraySchema( - schema = @Schema( - name = "ClientInformation", - implementation = ClientPublicViewDto.class - ) - ) - ) - ) - } - ) - public Flux getClientDoingBusiness() { - return service.getClientDoingBusiness(); - } - - @GetMapping("/unregistered") - @Operation( - summary = "List all clients that are unregistered", - responses = { - @ApiResponse( - responseCode = "200", - description = "Returns a client based on it's number", - content = @Content( - mediaType = MediaType.APPLICATION_JSON_VALUE, - array = @ArraySchema( - schema = @Schema( - name = "ClientInformation", - implementation = ClientPublicViewDto.class - ) - ) - ) - ) - } - ) - public Flux getUnregisteredCompanies() { - return service.getUnregisteredCompanies(); - } -} diff --git a/legacy/src/main/java/ca/bc/gov/app/controller/ReportingClientController.java b/legacy/src/main/java/ca/bc/gov/app/controller/ReportingClientController.java new file mode 100644 index 0000000000..aeef408bf2 --- /dev/null +++ b/legacy/src/main/java/ca/bc/gov/app/controller/ReportingClientController.java @@ -0,0 +1,75 @@ +package ca.bc.gov.app.controller; + +import ca.bc.gov.app.service.ReportingClientService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import java.io.File; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ZeroCopyHttpOutputMessage; +import org.springframework.http.server.reactive.ServerHttpResponse; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; + +@RestController +@Slf4j +@Tag( + name = "Forest Client Reporting", + description = "Generate reports for the forest client" +) +@RequestMapping(value = "/api/reports", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) +@RequiredArgsConstructor +public class ReportingClientController { + + private final ReportingClientService service; + + @GetMapping("/all") + @Operation(summary = "Get an excel report file for all existing forest clients") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Excel file generated successfully"), + @ApiResponse(responseCode = "500", description = "Internal server error") + }) + public Mono getAllClientsReport(ServerHttpResponse response) { + return + getReport( + service.generateAllClientsReport(), + response, + "All Clients" + ); + } + + @GetMapping("/businessAs") + @Operation(summary = "Get a business as excel report file") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Excel file generated successfully"), + @ApiResponse(responseCode = "500", description = "Internal server error") + }) + public Mono getBusinessAsReport(ServerHttpResponse response) { + return + getReport( + service.generateDoingBusinessAsReport(), + response, + "Business As" + ); + } + + private Mono getReport(Mono request, ServerHttpResponse response, String fileName) { + ZeroCopyHttpOutputMessage zeroCopyResponse = (ZeroCopyHttpOutputMessage) response; + zeroCopyResponse.getHeaders() + .set(HttpHeaders.CONTENT_DISPOSITION, + "attachment; filename=FC Report " + fileName + ".xlsx"); + zeroCopyResponse.getHeaders().setContentType(MediaType.APPLICATION_OCTET_STREAM); + + return + request + .doOnNext(sheet -> zeroCopyResponse.getHeaders().setContentLength(sheet.length())) + .flatMap(sheet -> zeroCopyResponse.writeWith(sheet, 0, sheet.length())); + } + +} diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/ClientNameCodeDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/ClientNameCodeDto.java new file mode 100644 index 0000000000..2256d9a9c0 --- /dev/null +++ b/legacy/src/main/java/ca/bc/gov/app/dto/ClientNameCodeDto.java @@ -0,0 +1,4 @@ +package ca.bc.gov.app.dto; + +public record ClientNameCodeDto(String code, String name) { +} \ No newline at end of file diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicFilterObjectDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicFilterObjectDto.java deleted file mode 100644 index b7ea13d2b0..0000000000 --- a/legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicFilterObjectDto.java +++ /dev/null @@ -1,11 +0,0 @@ -package ca.bc.gov.app.dto; - -public record ClientPublicFilterObjectDto( - String clientName, - String clientFirstName, - String clientMiddleName, - String clientTypeCodesAsCsv, - int currentPage, - int itemsPerPage -) { -} diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicViewDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicViewDto.java index b7a043416f..d0d4dfc9d0 100644 --- a/legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicViewDto.java +++ b/legacy/src/main/java/ca/bc/gov/app/dto/ClientPublicViewDto.java @@ -1,22 +1,56 @@ package ca.bc.gov.app.dto; import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; public record ClientPublicViewDto( String clientNumber, - String incorporationNumber, String clientName, - String legalFirstName, - String legalMiddleName, - String clientStatusCode, - String clientTypeCode, - String clientNameInOrgBook + String incorporationNumber, + + String orgBookNumber, + + String orgBookName, + boolean status ) { @JsonProperty - public boolean sameName() { - return StringUtils.equalsIgnoreCase(clientNameInOrgBook, clientName); + public String sameName() { + return + BooleanUtils.toStringYesNo( + StringUtils.equalsIgnoreCase(orgBookName, clientName) + ); + } + + @JsonProperty + public String sameNumber() { + return + BooleanUtils.toStringYesNo( + StringUtils.equalsIgnoreCase(orgBookNumber, incorporationNumber) + ); } + + @JsonProperty + public String found() { + return + BooleanUtils.toString( + StringUtils.equalsIgnoreCase(orgBookName, clientName) + && StringUtils.equalsIgnoreCase(orgBookNumber, incorporationNumber), + "F", + BooleanUtils.toString( + StringUtils.equalsIgnoreCase(orgBookName, clientName) + || StringUtils.equalsIgnoreCase(orgBookNumber, incorporationNumber), + "PF", + "NF" + ) + ); + } + + @JsonProperty + public String active() { + return BooleanUtils.toStringYesNo(status); + } + } diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/ClientTypeCodes.java b/legacy/src/main/java/ca/bc/gov/app/dto/ClientTypeCodes.java deleted file mode 100644 index 06f96a9d46..0000000000 --- a/legacy/src/main/java/ca/bc/gov/app/dto/ClientTypeCodes.java +++ /dev/null @@ -1,34 +0,0 @@ -package ca.bc.gov.app.dto; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum ClientTypeCodes { - INDIVIDUAL("I"), - ASSOCIATION("A"), - CORPORATION("C"), - FIRST_NATION_BAND("B"), - UNREGISTERED_COMPANY("U"); - - private final String value; - - ClientTypeCodes(String value) { - this.value = value; - } - - @JsonValue - public String value() { - return this.value; - } - - @JsonCreator - public static ClientTypeCodes fromValue(String value) { - for (ClientTypeCodes c : values()) { - if (c.value().equalsIgnoreCase(value)) { - return c; - } - } - throw new IllegalArgumentException(value); - } - -} diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/FirstNationBandVidationDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/FirstNationBandVidationDto.java deleted file mode 100644 index 9eccba35b5..0000000000 --- a/legacy/src/main/java/ca/bc/gov/app/dto/FirstNationBandVidationDto.java +++ /dev/null @@ -1,55 +0,0 @@ -package ca.bc.gov.app.dto; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.commons.lang3.StringUtils; - -public record FirstNationBandVidationDto( - String clientNumber, - String corpRegnNmbr, - String clientName, - String sourceClientName, - String addressOne, - String sourceAddressOne, - String addressTwo, - String sourceAddressTwo, - String city, - String sourceCity, - String province, - String sourceProvince, - String postalCode, - String sourcePostalCode -) { - @JsonProperty - public boolean nameMatch() { - return StringUtils.equalsIgnoreCase(clientName, sourceClientName); - } - - @JsonProperty - public boolean addressMatch() { - - return - ( - ( - StringUtils.isNotBlank(addressOne) - && StringUtils.isNotBlank(sourceAddressOne) - && addressOne.equalsIgnoreCase( - sourceAddressOne.replace(".", "") - ) - ) - || ( - StringUtils.isNotBlank(addressTwo) - && StringUtils.isNotBlank(sourceAddressTwo) - && addressTwo.equalsIgnoreCase( - sourceAddressTwo.replace(".", "") - ) - ) - ) - && StringUtils.equalsIgnoreCase(city, sourceCity) - && ( - StringUtils.isNotBlank(postalCode) - && postalCode.equalsIgnoreCase( - sourcePostalCode.replaceAll("\\s", "") - ) - ); - } -} diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/ForestClientDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/ForestClientDto.java index dcc0fef2e4..f6f5b03ab0 100644 --- a/legacy/src/main/java/ca/bc/gov/app/dto/ForestClientDto.java +++ b/legacy/src/main/java/ca/bc/gov/app/dto/ForestClientDto.java @@ -9,7 +9,6 @@ public record ForestClientDto( String legalMiddleName, String clientStatusCode, String clientTypeCode, - LocalDate birthdate, String clientIdTypeCode, String clientIdentification, String registryCompanyTypeCode, diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookNameDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookNameDto.java index 56524d21ab..4006abd951 100644 --- a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookNameDto.java +++ b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookNameDto.java @@ -2,27 +2,17 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; +import java.util.List; -@Schema(name = "NamedResult") @JsonIgnoreProperties(ignoreUnknown = true) public record OrgBookNameDto( - @Schema( - name = "value", - title = "Name of the entity being searched", - example = "U3 POWER CORP", - requiredMode = Schema.RequiredMode.REQUIRED - ) - String value, - @Schema( - name = "topic_source_id", - title = "The incorporation ID", - example = "BC0772006", - requiredMode = Schema.RequiredMode.REQUIRED - ) + String value, + @JsonProperty("sub_type") + String subType, @JsonProperty("topic_source_id") - String topicSourceId + String topicSourceId, + List names ) { } diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicDto.java new file mode 100644 index 0000000000..eb2cc3736b --- /dev/null +++ b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicDto.java @@ -0,0 +1,27 @@ +package ca.bc.gov.app.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.CollectionUtils; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record OrgBookTopicDto( + Integer id, + @JsonProperty("source_id") String sourceId, + List names, + Boolean inactive +) { + public String name() { + if (CollectionUtils.isEmpty(names)) { + return StringUtils.EMPTY; + } + return names + .stream() + .filter(entry -> entry.topicNameType().equalsIgnoreCase("entity_name")) + .map(OrgBookTopicNameDto::text) + .findFirst() + .orElse(StringUtils.EMPTY); + } +} diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicListResponse.java b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicListResponse.java new file mode 100644 index 0000000000..389ac3239b --- /dev/null +++ b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicListResponse.java @@ -0,0 +1,15 @@ +package ca.bc.gov.app.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record OrgBookTopicListResponse( + int total, + Integer page, + @JsonProperty("page_size") + Integer pageSize, + List results +) { +} diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicNameDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicNameDto.java new file mode 100644 index 0000000000..8eb060528a --- /dev/null +++ b/legacy/src/main/java/ca/bc/gov/app/dto/OrgBookTopicNameDto.java @@ -0,0 +1,11 @@ +package ca.bc.gov.app.dto; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record OrgBookTopicNameDto( + String text, + @JsonProperty("type") String topicNameType +) { +} \ No newline at end of file diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/PropertyDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/PropertyDto.java deleted file mode 100644 index 17cd2ad96e..0000000000 --- a/legacy/src/main/java/ca/bc/gov/app/dto/PropertyDto.java +++ /dev/null @@ -1,14 +0,0 @@ -package ca.bc.gov.app.dto; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public record PropertyDto( - @JsonProperty("FIRST_NATION_FEDERAL_NAME") String firstNationFederalName, - @JsonProperty("FIRST_NATION_FEDERAL_ID") Integer firstNationFederalId, - @JsonProperty("ADDRESS_LINE1") String addressLine1, - @JsonProperty("ADDRESS_LINE2") String addressLine2, - @JsonProperty("OFFICE_CITY") String officeCity, - @JsonProperty("OFFICE_PROVINCE") String officeProvince, - @JsonProperty("OFFICE_POSTAL_CODE") String officePostalCode -) { -} \ No newline at end of file diff --git a/legacy/src/main/java/ca/bc/gov/app/entity/ClientLocationEntity.java b/legacy/src/main/java/ca/bc/gov/app/entity/ClientLocationEntity.java index 62efbefc06..15b4dd24c2 100644 --- a/legacy/src/main/java/ca/bc/gov/app/entity/ClientLocationEntity.java +++ b/legacy/src/main/java/ca/bc/gov/app/entity/ClientLocationEntity.java @@ -82,24 +82,4 @@ public class ClientLocationEntity { @Column("CLI_LOCN_COMMENT ") private String cliLocnComment; - @Column("UPDATE_TIMESTAMP") - private LocalDate updateTimestamp; - - @Column("UPDATE_USERID") - private String updateUserId; - - @Column("UPDATE_ORG_UNIT") - private Long updateOrgUnit; - - @Column("ADD_TIMESTAMP") - private LocalDate addTimestamp; - - @Column("ADD_USERID") - private String addUserId; - - @Column("ADD_ORG_UNIT") - private Long addOrgUnit; - - @Column("REVISION_COUNT") - private Long revisionCount; } diff --git a/legacy/src/main/java/ca/bc/gov/app/entity/ClientStatusCodeEntity.java b/legacy/src/main/java/ca/bc/gov/app/entity/ClientStatusCodeEntity.java index b151561476..dd7676da34 100644 --- a/legacy/src/main/java/ca/bc/gov/app/entity/ClientStatusCodeEntity.java +++ b/legacy/src/main/java/ca/bc/gov/app/entity/ClientStatusCodeEntity.java @@ -20,8 +20,6 @@ @Table(name = "CLIENT_STATUS_CODE", schema = ORACLE_ATTRIBUTE_SCHEMA) public class ClientStatusCodeEntity { - public static final String ACTIVE = "ACT"; //TODO: move to enum - @Id @Column("CLIENT_STATUS_CODE") private String clientStatusCode; @@ -35,16 +33,4 @@ public class ClientStatusCodeEntity { @Column("EXPIRY_DATE") private LocalDate expiryDate; - @Column("CREATE_TIMESTAMP") - private LocalDate createTimestamp; - - @Column("UPDATE_TIMESTAMP") - private LocalDate updateTimestamp; - - @Column("CREATE_USER") - private String createUser; - - @Column("UPDATE_USER") - private String updateUser; - } diff --git a/legacy/src/main/java/ca/bc/gov/app/entity/ForestClientEntity.java b/legacy/src/main/java/ca/bc/gov/app/entity/ForestClientEntity.java index 6246427754..2a10927378 100644 --- a/legacy/src/main/java/ca/bc/gov/app/entity/ForestClientEntity.java +++ b/legacy/src/main/java/ca/bc/gov/app/entity/ForestClientEntity.java @@ -41,9 +41,6 @@ public class ForestClientEntity { @Column("CLIENT_TYPE_CODE") private String clientTypeCode; - @Column("BIRTHDATE") - private LocalDate birthdate; - @Column("CLIENT_ID_TYPE_CODE") private String clientIdTypeCode; @@ -68,26 +65,4 @@ public class ForestClientEntity { @Column("CLIENT_COMMENT") private String clientComment; - @Column("ADD_TIMESTAMP") - private LocalDateTime addTimestamp; - - @Column("ADD_USERID") - private String addUserId; - - @Column("ADD_ORG_UNIT") - private Long addOrgUnit; - - @Column("UPDATE_TIMESTAMP") - private LocalDateTime updateTimestamp; - - @Column("UPDATE_USERID") - private String updateUserId; - - @Column("UPDATE_ORG_UNIT") - private Long updateOrgUnit; - - @Column("REVISION_COUNT") - private Long revisionCount; - - } diff --git a/legacy/src/main/java/ca/bc/gov/app/exception/CannotWriteReportException.java b/legacy/src/main/java/ca/bc/gov/app/exception/CannotWriteReportException.java new file mode 100644 index 0000000000..7debb59a3d --- /dev/null +++ b/legacy/src/main/java/ca/bc/gov/app/exception/CannotWriteReportException.java @@ -0,0 +1,12 @@ +package ca.bc.gov.app.exception; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.server.ResponseStatusException; + +@ResponseStatus(HttpStatus.UNPROCESSABLE_ENTITY) +public class CannotWriteReportException extends ResponseStatusException { + public CannotWriteReportException(String errorMessage) { + super(HttpStatus.UNPROCESSABLE_ENTITY,errorMessage); + } +} diff --git a/legacy/src/main/java/ca/bc/gov/app/repository/ClientDoingBusinessAsRepository.java b/legacy/src/main/java/ca/bc/gov/app/repository/ClientDoingBusinessAsRepository.java index 80e633843a..54d41136fa 100644 --- a/legacy/src/main/java/ca/bc/gov/app/repository/ClientDoingBusinessAsRepository.java +++ b/legacy/src/main/java/ca/bc/gov/app/repository/ClientDoingBusinessAsRepository.java @@ -1,12 +1,16 @@ package ca.bc.gov.app.repository; import ca.bc.gov.app.entity.ClientDoingBusinessAsEntity; +import org.springframework.data.domain.Pageable; import org.springframework.data.repository.reactive.ReactiveCrudRepository; import org.springframework.data.repository.reactive.ReactiveSortingRepository; import org.springframework.stereotype.Repository; +import reactor.core.publisher.Flux; @Repository public interface ClientDoingBusinessAsRepository extends ReactiveCrudRepository, ReactiveSortingRepository { + + Flux findBy(Pageable page); } diff --git a/legacy/src/main/java/ca/bc/gov/app/repository/ForestClientRepository.java b/legacy/src/main/java/ca/bc/gov/app/repository/ForestClientRepository.java index bc44f04fed..c524f8344d 100644 --- a/legacy/src/main/java/ca/bc/gov/app/repository/ForestClientRepository.java +++ b/legacy/src/main/java/ca/bc/gov/app/repository/ForestClientRepository.java @@ -1,6 +1,7 @@ package ca.bc.gov.app.repository; import ca.bc.gov.app.entity.ForestClientEntity; +import org.springframework.data.domain.Pageable; import org.springframework.data.r2dbc.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.ReactiveQueryByExampleExecutor; @@ -14,6 +15,8 @@ public interface ForestClientRepository extends ReactiveCrudRepository, ReactiveSortingRepository { + Flux findBy(Pageable page); + @Query(""" select * from FOREST_CLIENT x where x.CLIENT_TYPE_CODE = 'B' diff --git a/legacy/src/main/java/ca/bc/gov/app/service/ClientSearchService.java b/legacy/src/main/java/ca/bc/gov/app/service/ClientSearchService.java index e82ce3c5b6..b8ca141cfa 100644 --- a/legacy/src/main/java/ca/bc/gov/app/service/ClientSearchService.java +++ b/legacy/src/main/java/ca/bc/gov/app/service/ClientSearchService.java @@ -1,19 +1,12 @@ package ca.bc.gov.app.service; -import ca.bc.gov.app.ApplicationConstants; import ca.bc.gov.app.dto.ForestClientDto; -import ca.bc.gov.app.entity.ForestClientEntity; import ca.bc.gov.app.exception.MissingRequiredParameterException; import ca.bc.gov.app.repository.ForestClientRepository; import ca.bc.gov.app.util.MonoUtil; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; -import java.util.Optional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.springframework.data.domain.Example; -import org.springframework.data.domain.ExampleMatcher; import org.springframework.stereotype.Service; import reactor.core.publisher.Flux; @@ -45,7 +38,6 @@ public Flux findByIncorporationOrName( entity.getLegalMiddleName(), entity.getClientStatusCode(), entity.getClientTypeCode(), - entity.getBirthdate(), entity.getClientIdTypeCode(), entity.getClientIdentification(), entity.getRegistryCompanyTypeCode(), @@ -59,75 +51,4 @@ public Flux findByIncorporationOrName( .doOnNext(MonoUtil.logContent(log)); } - public Flux findByNameAndBirth( - Optional firstName, - Optional lastName, - Optional birthDate - ) { - - //First, we validate to see if it's empty or not, empty values cannot be passed on - //For requests, when someone is consuming our endpoint and want to send an empty value - //for example, when looking up for companies, not individuals, it has to provide the - //query param without any value, such as firstName=&birthdate=&lastName=My Company - if (lastName.isEmpty()) { - throw new MissingRequiredParameterException(ApplicationConstants.CLIENT_SEARCH_LAST_NAME); - } - - if (birthDate.isEmpty()) { - throw new MissingRequiredParameterException(ApplicationConstants.CLIENT_SEARCH_BIRTHDATE); - } - - if (firstName.isEmpty()) { - throw new MissingRequiredParameterException(ApplicationConstants.CLIENT_SEARCH_FIRST_NAME); - } - - //The search probe is just an example object with the fields populated with the values we - //are looking for. - ForestClientEntity searchProbe = new ForestClientEntity() - .withBirthdate( - birthDate - .filter(StringUtils::isNotBlank) - .map(date -> LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE)) - .orElse(null) - ) - .withLegalFirstName(firstName.filter(StringUtils::isNotBlank).orElse(null)) - .withClientName(lastName.filter(StringUtils::isNotBlank).orElse(null)); - - //The matcher defines how we will look up for the data provided - ExampleMatcher searchMatcher = ExampleMatcher - .matchingAll() - .withMatcher( - "clientName", - ExampleMatcher.GenericPropertyMatcher::ignoreCase - ) - .withMatcher( - "legalFirstName", - ExampleMatcher.GenericPropertyMatcher::ignoreCase - ) - .withIncludeNullValues(); - - return forestClientRepository - //Then we look up for all that matches the example - .findAll(Example.of(searchProbe, searchMatcher)) - .map(entity -> - new ForestClientDto( - entity.getClientNumber(), - entity.getClientName(), - entity.getLegalFirstName(), - entity.getLegalMiddleName(), - entity.getClientStatusCode(), - entity.getClientTypeCode(), - entity.getBirthdate(), - entity.getClientIdTypeCode(), - entity.getClientIdentification(), - entity.getRegistryCompanyTypeCode(), - entity.getCorpRegnNmbr(), - entity.getClientAcronym(), - entity.getWcbFirmNumber(), - entity.getOcgSupplierNmbr(), - entity.getClientComment() - ) - ); - } - } diff --git a/legacy/src/main/java/ca/bc/gov/app/service/ForestClientService.java b/legacy/src/main/java/ca/bc/gov/app/service/ForestClientService.java deleted file mode 100644 index df5f8ad588..0000000000 --- a/legacy/src/main/java/ca/bc/gov/app/service/ForestClientService.java +++ /dev/null @@ -1,206 +0,0 @@ -package ca.bc.gov.app.service; - -import static java.util.function.Predicate.not; - -import ca.bc.gov.app.dto.ClientPublicViewDto; -import ca.bc.gov.app.dto.FirstNationBandVidationDto; -import ca.bc.gov.app.dto.OrgBookResultListResponse; -import ca.bc.gov.app.dto.PropertyDto; -import ca.bc.gov.app.entity.ForestClientEntity; -import ca.bc.gov.app.repository.ClientDoingBusinessAsRepository; -import ca.bc.gov.app.repository.ClientLocationRepository; -import ca.bc.gov.app.repository.ForestClientRepository; -import java.util.List; -import java.util.function.Function; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.data.domain.Sort; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Service; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -@Service -@Slf4j -@RequiredArgsConstructor -public class ForestClientService { - - private final ForestClientRepository forestClientRepository; - private final ClientLocationRepository clientLocationRepository; - private final ClientDoingBusinessAsRepository clientDoingBusinessAsRepository; - - private final WebClient forestClientApi; - - public Flux getFirstNationBandInfo() { - return - forestClientRepository - .findAllFirstNationBandClients() - .flatMap(entity -> - Mono - .just(entity) - .doOnNext( - current -> log.info("Checking data for {} CorpRegnNmbr {}", - current.getClientName(), - current.getCorpRegnNmbr()) - ) - .filter(current -> StringUtils.isNotBlank(current.getCorpRegnNmbr())) - .flatMap(getBandInfoFromMap()) - .switchIfEmpty(getEmptyBandValidation(entity)) - ); - } - - public Flux getClientDoingBusiness() { - return - clientDoingBusinessAsRepository - .findAll(Sort.by("doingBusinessAsName")) - .flatMap(entity -> - findByClientName(entity.getDoingBusinessAsName()) - .filter(not(OrgBookResultListResponse::empty)) - .map(orgBookResponse -> - new ClientPublicViewDto( - entity.getClientNumber(), - null, - entity.getDoingBusinessAsName(), - null, - null, - null, - null, - orgBookResponse.results().get(0).value() - ) - ) - .switchIfEmpty( - Mono - .just( - new ClientPublicViewDto( - entity.getClientNumber(), - null, - entity.getDoingBusinessAsName(), - null, - null, - null, - null, - null - ) - ) - ) - ); - } - - public Flux getUnregisteredCompanies() { - return - forestClientRepository - .findAll(Sort.by("clientName")) - .flatMap(entity -> - findByClientName(entity.getClientName()) - .filter(not(OrgBookResultListResponse::empty)) - .map(orgBookResponse -> - new ClientPublicViewDto( - entity.getClientNumber(), - StringUtils - .equals( - orgBookResponse.results().get(0).value(), - entity.getClientName() - ) ? orgBookResponse.results().get(0).topicSourceId() : null, - entity.getClientName(), - null, - null, - null, - null, - orgBookResponse.results().get(0).value() - ) - ) - .switchIfEmpty(Mono.just( - new ClientPublicViewDto( - entity.getClientNumber(), - null, - entity.getClientName(), - null, - null, - null, - null, - null - ) - )) - ); - } - - private Mono findByClientName(String clientName) { - return - forestClientApi - .get() - .uri("/api/orgbook/name/{name}", clientName) - .exchangeToMono(response -> response.bodyToMono(OrgBookResultListResponse.class)); - } - - private static Mono getEmptyBandValidation( - ForestClientEntity entity - ) { - return Mono.just(new FirstNationBandVidationDto( - entity.getClientNumber(), - entity.getCorpRegnNmbr(), - entity.getClientName(), - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ) - ); - } - - private Function> getBandInfoFromMap() { - return currentEntity -> - forestClientApi - .get() - .uri("/api/maps/firstNation/{id}", currentEntity.getCorpRegnNmbr()) - .accept(MediaType.APPLICATION_JSON) - .exchangeToMono(response -> response.bodyToMono(PropertyDto.class)) - .doOnNext(response -> - log.info( - """ - Information about first nation band with id {} and client number {} found. - Looking up for location details from band {} - """, - currentEntity.getCorpRegnNmbr(), - currentEntity.getClientNumber(), - response - ) - ) - .flatMap(response -> - clientLocationRepository - .findAllById(List.of(currentEntity.getClientNumber())) - .map(clientLocation -> - new FirstNationBandVidationDto( - currentEntity.getClientNumber(), - currentEntity.getCorpRegnNmbr(), - currentEntity.getClientName(), - response.firstNationFederalName(), - clientLocation.getAddressOne(), - response.addressLine1(), - clientLocation.getAddressTwo(), - response.addressLine2(), - clientLocation.getCity(), - response.officeCity(), - clientLocation.getProvince(), - response.officeProvince(), - clientLocation.getPostalCode(), - response.officePostalCode() - ) - ) - .filter(FirstNationBandVidationDto::nameMatch) - .next() - ) - .doOnNext(bandValidation -> log.info("Band validation completed for {} {}",bandValidation.clientNumber(),bandValidation.clientName())) - .onErrorResume(t -> getEmptyBandValidation(currentEntity) - ); - } - -} diff --git a/legacy/src/main/java/ca/bc/gov/app/service/ReportingClientService.java b/legacy/src/main/java/ca/bc/gov/app/service/ReportingClientService.java new file mode 100644 index 0000000000..a52f005801 --- /dev/null +++ b/legacy/src/main/java/ca/bc/gov/app/service/ReportingClientService.java @@ -0,0 +1,227 @@ +package ca.bc.gov.app.service; + +import ca.bc.gov.app.dto.ClientPublicViewDto; +import ca.bc.gov.app.dto.OrgBookTopicDto; +import ca.bc.gov.app.dto.OrgBookTopicListResponse; +import ca.bc.gov.app.entity.ClientDoingBusinessAsEntity; +import ca.bc.gov.app.entity.ForestClientEntity; +import ca.bc.gov.app.repository.ClientDoingBusinessAsRepository; +import ca.bc.gov.app.repository.ForestClientRepository; +import ca.bc.gov.app.util.SheetWriter; +import java.io.File; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.attribute.BasicFileAttributes; +import java.time.Duration; +import java.time.Instant; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.MediaType; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@Service +@Slf4j +public class ReportingClientService { + + private final ForestClientRepository forestClientRepository; + private final ClientDoingBusinessAsRepository clientDoingBusinessAsRepository; + private final WebClient orgBookApi; + + public ReportingClientService(ForestClientRepository forestClientRepository, + ClientDoingBusinessAsRepository clientDoingBusinessAsRepository, + @Qualifier("orgBookApi") WebClient orgBookApi) { + this.forestClientRepository = forestClientRepository; + this.clientDoingBusinessAsRepository = clientDoingBusinessAsRepository; + this.orgBookApi = orgBookApi; + } + + public Mono generateDoingBusinessAsReport() { + + return + generateReport( + clientDoingBusinessAsRepository + //As we are streaming through the data with Flux, we will not have the entire + //dataset in memory at any given time + .findAll() + //for each entry, we will grab the data from orgbook + .flatMap(this::mapToPublicView) + ); + } + + public Mono generateAllClientsReport() { + return + generateReport( + forestClientRepository + //As we are streaming through the data with Flux, we will not have the entire + //dataset in memory at any given time + .findAll() + //for each entry, we will grab the data from orgbook + .flatMap(this::mapToPublicView) + ); + } + + @Scheduled(fixedDelay = 5, timeUnit = TimeUnit.MINUTES) + @SuppressWarnings({"java:S3864", "java:S4042"}) + public void cleanOldReports() { + + Path sheetFolder = Paths + .get("./temp/") + .normalize(); + + if (!sheetFolder.toFile().exists()) { + log.info( + "Temporary folder for reports {} does not exist, creating {}", + sheetFolder.toFile().getAbsolutePath(), + sheetFolder.toFile().mkdirs() + ); + } + + try (Stream paths = Files.list(sheetFolder)) { + paths + .peek(file -> log.info("Found report on folder with name {}", file.getFileName())) + .filter(file -> isFileOlderThan(file.toFile(), 5)) + .forEach(path -> path.toFile().delete()); + } catch (IOException exception) { + log.error("Error while cleaning temp folder", exception); + } + + + } + + private boolean isFileOlderThan(File file, int minutesDiff) { + return + Duration + .between( + Instant.ofEpochMilli(file.lastModified()), + Instant.now() + ) + .toMinutes() > minutesDiff; + } + + private Mono generateReport(Flux values) { + + File sheetFile = Paths + .get("./temp/", UUID.randomUUID().toString() + ".xlsx") + .normalize() + .toFile(); + + if (!sheetFile.getParentFile().exists()) { + log.info( + "Temporary folder for reports {} does not exist, creating {}", + sheetFile.getParentFile().getAbsolutePath(), + sheetFile.getParentFile().mkdirs() + ); + } + + SheetWriter writer = new SheetWriter(sheetFile); + + log.debug("Generating sheet file {}", sheetFile); + return values + //Persist it into the spreadsheet for each entry + .doOnNext(writer::write) + //Once all is done move ahead to complete and close the file + .doOnComplete(writer::complete) + //return the file + .then(Mono.just(sheetFile)); + } + + private Mono mapToPublicView(ForestClientEntity entity) { + return loadValueFromOrgbook( + entity.getClientName(), + entity.getClientNumber(), + String.format("%s%s", + StringUtils.defaultString(entity.getRegistryCompanyTypeCode()), + StringUtils.defaultString(entity.getCorpRegnNmbr()) + ) + ); + } + + private Mono mapToPublicView(ClientDoingBusinessAsEntity entity) { + return loadValueFromOrgbook( + entity.getDoingBusinessAsName(), + entity.getClientNumber(), + StringUtils.EMPTY + ); + } + + private Mono loadValueFromOrgbook( + String clientName, + String clientNumber, + String incorporationNumber + ) { + return + findOnTopic(clientName) + .next() + //if we find data, we build the data with it + .map(orgBook -> + new ClientPublicViewDto( + clientNumber, + clientName, + incorporationNumber, + orgBook.sourceId(), + orgBook.name(), + !orgBook.inactive() + ) + ) + //if not, we use just the entity data + .switchIfEmpty(Mono.just( + new ClientPublicViewDto( + clientNumber, + clientName, + incorporationNumber, + null, + null, + false + ) + ) + ); + } + + private Flux findOnTopic(String value) { + return + orgBookApi + .get() + .uri(uriBuilder -> uriBuilder + .path("/v4/search/topic") + .queryParam("format", "json") + .queryParam("inactive", "any") + .queryParam("ordering", "-score") + .queryParam("q", encodeUri(value)) + .build(Map.of()) + ) + .accept(MediaType.APPLICATION_JSON) + .exchangeToMono( + clientResponse -> clientResponse.bodyToMono(OrgBookTopicListResponse.class) + ) + .filter(response -> !CollectionUtils.isEmpty(response.results())) + .flatMapIterable(OrgBookTopicListResponse::results) + .doOnNext( + content -> log.info("OrgBook Topic Lookup {} -> {}", value, + content) + ); + + } + + private static String encodeUri(String clientName) { + try { + return URLEncoder.encode(clientName, "utf-8"); + } catch (UnsupportedEncodingException e) { + return clientName; + } + } + +} diff --git a/legacy/src/main/java/ca/bc/gov/app/util/MonoUtil.java b/legacy/src/main/java/ca/bc/gov/app/util/MonoUtil.java index 7e5fc006ca..f89792d377 100644 --- a/legacy/src/main/java/ca/bc/gov/app/util/MonoUtil.java +++ b/legacy/src/main/java/ca/bc/gov/app/util/MonoUtil.java @@ -18,41 +18,4 @@ public static Consumer logContent(Logger log) { return received -> log.info("{}", received); } - /** - *

Log Content

- * Log the content of the future and add a log message as well. - * - * @param logMessage A string message to be logged - * @param The type that will be passed through the future. - * @return the same content of the future - */ - public static Consumer logContent(Logger log, String logMessage) { - return received -> log.info(String.format("%s {}", logMessage), received); - } - - /** - *

Log Content

- * Log the content of the future and add a log message as well. - * - * @param logMessage A string message to be logged - * @param params the params array to be passed to SL4J - * @param The type that will be passed through the future. - * @return the same content of the future - */ - public static Consumer logContent(Logger log, String logMessage, Object... params) { - return received -> log.info(String.format("%s {}", logMessage), params, received); - } - - /** - *

Log Content

- * - * @param log The logger - * @param logMessage A string message to be logged - * @param params the params array to be passed to SL4J - * @param The type that will be passed through the future. - * @return the same content of the future - */ - public static Consumer logMessage(Logger log, String logMessage, Object... params) { - return received -> log.info(logMessage, params); - } } diff --git a/legacy/src/main/java/ca/bc/gov/app/util/SheetWriter.java b/legacy/src/main/java/ca/bc/gov/app/util/SheetWriter.java new file mode 100644 index 0000000000..a5bf7f5c16 --- /dev/null +++ b/legacy/src/main/java/ca/bc/gov/app/util/SheetWriter.java @@ -0,0 +1,303 @@ +package ca.bc.gov.app.util; + +import ca.bc.gov.app.dto.ClientPublicViewDto; +import ca.bc.gov.app.exception.CannotWriteReportException; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.concurrent.atomic.AtomicInteger; +import lombok.extern.slf4j.Slf4j; +import org.dhatim.fastexcel.Color; +import org.dhatim.fastexcel.Workbook; +import org.dhatim.fastexcel.Worksheet; + +@Slf4j +public class SheetWriter { + + public static final String BLACK_COLOR = "black"; + private final BufferedOutputStream fileOut; + // Create a new workbook + private final Workbook workbook; + //Create the main sheet + private final Worksheet sheet; + //This sets the initial line for the entries + private final AtomicInteger rowCounter = new AtomicInteger(18); + + public SheetWriter(File sheetFile) { + + try { + this.fileOut = new BufferedOutputStream(Files.newOutputStream(sheetFile.toPath())); + } catch (IOException e) { + throw new CannotWriteReportException( + "Cannot generate report file. Reason " + e.getMessage() + ); + } + + this.workbook = new Workbook(this.fileOut, "SampleName", "1.0"); + this.sheet = workbook.newWorksheet("C an A"); + + + } + + private void initializeDataHeader() { + sheet + .range(17, 1, rowCounter.get() - 1, 7) + .createTable( + "Client Number", + "Registration Number", + "Found?", + "Active in OrgBook?", + "Same name?", + "Name in Client", + "Name in OB" + ); + } + + public void write(ClientPublicViewDto client) { + + valueRow( + rowCounter.getAndIncrement(), + client.clientNumber(), + client.incorporationNumber(), + client.found(), + client.active(), + client.sameName(), + client.clientName(), + client.orgBookName() + ); + } + + public void complete() { + generateCountData(); + initializeDataHeader(); + sheet.freezePane(8,18); + close(); + } + + private void close() { + try { + sheet.finish(); + workbook.finish(); + fileOut.close(); + log.debug("Saving and closing file"); + } catch (Exception e) { + log.error("Error while closing spreadsheet", e); + } + } + + private void generateCountData() { + + totalClientInfo(); + totalFoundInfo(); + totalOrgBookActiveInfo(); + totalPartialInfo(); + + sheet + .range(1, 1, 1, 4) + .style() + .bold() + .borderColor(BLACK_COLOR) + .borderStyle("thin") + .set(); + + + sheet + .range(18, 1, rowCounter.get() - 1, 7) + .style() + .shadeAlternateRows(Color.GRAY2) + .borderColor(BLACK_COLOR) + .borderStyle("thin") + .set(); + + } + + private void totalFoundInfo() { + headerRow(3); + infoRow(4, + "Total Found (Registration Number AND Name)", + getCountIf("D", "F"), + getPercentage(5, 2) + ); + infoRow(5, + "Total Partially Found (Registration Number OR Name)", + getCountIf("D", "PF"), + getPercentage(6, 2) + ); + infoRow(6, + "Total Not Found", + getCountIf("D", "NF"), + getPercentage(7, 2) + ); + + } + + private void totalOrgBookActiveInfo() { + headerRow(8); + infoRow(9, + "Total of Active Found in OB", + getCountIfs("E", "Yes", "F"), + getPercentage(10, 5) + ); + infoRow(10, + "Total of Inactive Found Clients in OB", + getCountIfs("E", "No", "F"), + getPercentage(11, 5) + ); + + } + + private void totalPartialInfo() { + headerRow(12); + infoRow(13, + "Total of Partially Found by Name", + getCountIfs("F", "Yes", "PF"), + getPercentage(14, 6) + ); + infoRow(14, + "Total of Partially Found by Registration Number", + getCountIfs("F", "No", "PF"), + getPercentage(15, 6) + ); + } + + private void totalClientInfo() { + setMergedValue(1, 1, "Total Clients"); + setCellValue(1, 4, String.valueOf(rowCounter.get() - 18)); + right(1, 4); + setBold(1, 1); + setBold(1, 4); + setBorder(1, 1); + setBorder(1, 4); + } + + private void headerRow(int rowNumber) { + setCellValue(rowNumber, 4, "# of Records"); + setBold(rowNumber, 4); + center(rowNumber, 4); + setBorder(rowNumber, 4); + + setCellValue(rowNumber, 5, "Percentage"); + setBold(rowNumber, 5); + center(rowNumber, 5); + setBorder(rowNumber, 5); + } + + private void valueRow(int rowNumber, String... contents) { + for (int columnId = 1; columnId <= contents.length; columnId++) { + this.sheet.value(rowNumber, columnId, contents[columnId - 1]); + setBorder(rowNumber, columnId); + left(rowNumber, columnId); + } + } + + private void infoRow( + int rowNumber, + String contentTitle, + String contentRecords, + String contentPercentage + ) { + setMergedValue(rowNumber, 1, contentTitle); + + setCellFormula(rowNumber, 4, contentRecords); + + setCellFormula(rowNumber, 5, contentPercentage); + + sheet.style(rowNumber, 5).format("0.00%").set(); + + } + + private void setCellValue(int rowId, int cellId, String cellValue) { + setCell(rowId, cellId, cellValue, false); + } + + private void setCellFormula(int rowId, int cellId, String cellValue) { + setCell(rowId, cellId, cellValue, true); + right(rowId, cellId); + setBorder(rowId, cellId); + } + + private void setCell( + int rowId, + int cellId, + String cellValue, + boolean formula + ) { + if (formula) { + sheet.formula(rowId, cellId, cellValue); + } else { + sheet.value(rowId, cellId, cellValue); + } + } + + private void setMergedValue(int rowId, int cellId, String cellValue) { + setCellValue(rowId, cellId, cellValue); + sheet.range(rowId, cellId, rowId, cellId + 2).merge(); + left(rowId, 1); + setBold(rowId, 1); + setBorder(rowId, 1, 3); + } + + private String getPercentage(int columnValue, int columnTotal) { + return String.format("IF(E%d>0,(E%d/E%d),0)", columnTotal, columnValue, columnTotal); + } + + private String getCountIf(String column, String value) { + return String.format("COUNTIF(%S19:D%d,\"%s\")", column, rowCounter.get(), value); + } + + private String getCountIfs(String column, String value, String reference) { + return String.format("COUNTIFS(%s19:%s%d,\"%s\",D19:D%d,\"%s\")", column, column, + rowCounter.get(), value, rowCounter.get(), reference); + } + + private void setBorder(int rowId, int columnId) { + sheet + .style(rowId, columnId) + .borderColor(BLACK_COLOR) + .borderStyle("thin") + .set(); + } + + private void setBorder(int rowId, int columnId, int lastColumn) { + if (lastColumn == 0) { + setBorder(rowId, columnId); + } else { + sheet + .range(rowId, columnId, rowId, lastColumn) + .style() + .borderColor(BLACK_COLOR) + .borderStyle("thin") + .set(); + } + } + + private void setBold(int rowId, int columnId) { + sheet + .style(rowId, columnId) + .bold() + .set(); + } + + private void center(int rowId, int columnId) { + sheet + .style(rowId, columnId) + .horizontalAlignment("center") + .set(); + } + + private void left(int rowId, int columnId) { + sheet + .style(rowId, columnId) + .horizontalAlignment("left") + .set(); + } + + private void right(int rowId, int columnId) { + sheet + .style(rowId, columnId) + .horizontalAlignment("right") + .set(); + } + +} diff --git a/legacy/src/main/resources/application.yml b/legacy/src/main/resources/application.yml index e824229093..38b32bb0ce 100644 --- a/legacy/src/main/resources/application.yml +++ b/legacy/src/main/resources/application.yml @@ -34,6 +34,7 @@ management: include: health,metrics springdoc: + enable-native-support: true webjars: prefix: /v3 api-docs: @@ -47,6 +48,7 @@ ca: bc: gov: nrs: + orgbook: https://orgbook.gov.bc.ca/api forest: uri: ${FOREST_API_URL:http://127.0.0.1:3000} oracle: @@ -57,4 +59,8 @@ ca: username: ${ORACLEDB_USER:user} password: ${ORACLEDB_PASSWORD:passwd} keystore: ${ORACLEDB_KEYSTORE:jssecacerts.jks} - secret: ${ORACLEDB_SECRET:changeit} \ No newline at end of file + secret: ${ORACLEDB_SECRET:changeit} + bcregistry: + uri: ${BCREGISTRY_URI:https://bcregistry-prod.apigee.net} + apiKey: ${BCREGISTRY_KEY:thekeyisalie} + accountId: ${BCREGISTRY_ACCOUNT:12345} \ No newline at end of file diff --git a/legacy/src/test/java/ca/bc/gov/app/TestConstants.java b/legacy/src/test/java/ca/bc/gov/app/TestConstants.java new file mode 100644 index 0000000000..760f9c1c7b --- /dev/null +++ b/legacy/src/test/java/ca/bc/gov/app/TestConstants.java @@ -0,0 +1,27 @@ +package ca.bc.gov.app; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class TestConstants { + + public static final String ORGBOOK_TOPIC = """ + { + "total": 1, + "page": 1, + "results": [ + { + "id": 1461713, + "source_id": "FM0000000", + "names": [ + { + "text": "DUMMY", + "type": "entity_name" + } + ], + "inactive": false + } + ] + }"""; +} diff --git a/legacy/src/test/java/ca/bc/gov/app/endpoints/ClientSearchNameBirthHandlerIntegrationTest.java b/legacy/src/test/java/ca/bc/gov/app/endpoints/ClientSearchNameBirthHandlerIntegrationTest.java deleted file mode 100644 index 9002dc6f8e..0000000000 --- a/legacy/src/test/java/ca/bc/gov/app/endpoints/ClientSearchNameBirthHandlerIntegrationTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package ca.bc.gov.app.endpoints; - -import ca.bc.gov.app.ApplicationConstants; -import ca.bc.gov.app.extensions.AbstractTestContainerIntegrationTest; -import java.util.HashMap; -import java.util.Optional; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.test.web.reactive.server.WebTestClient; - -@Slf4j -@DisplayName("Integrated Test | Client Search Name and Birth Controller") -class ClientSearchNameBirthHandlerIntegrationTest extends - AbstractTestContainerIntegrationTest { - - @Autowired - protected WebTestClient client; - - - @Test - @DisplayName("Search someone by name and birth") - void shouldSearchSomeoneByNameAndBirth() { - client - .get() - .uri(uriBuilder -> - uriBuilder - .path("/api/search/nameAndBirth") - .queryParam(ApplicationConstants.CLIENT_SEARCH_FIRST_NAME, "JAMES") - .queryParam(ApplicationConstants.CLIENT_SEARCH_LAST_NAME, "BAXTER") - .queryParam(ApplicationConstants.CLIENT_SEARCH_BIRTHDATE, "1959-05-18") - .build(new HashMap<>()) - ) - .header("Content-Type", MediaType.APPLICATION_JSON_VALUE) - .exchange() - .expectStatus().isOk() - .expectBody() - .jsonPath("$[0].clientNumber").isNotEmpty() - .jsonPath("$[0].clientNumber").isEqualTo("00000001") - .jsonPath("$[0].clientName").isNotEmpty() - .jsonPath("$[0].clientName").isEqualTo("BAXTER") - .jsonPath("$[0].legalFirstName").isNotEmpty() - .jsonPath("$[0].legalFirstName").isEqualTo("JAMES") - .jsonPath("$[0].legalMiddleName").isEmpty() - .consumeWith(System.out::println); - } - - @Test - @DisplayName("Search company by name") - void shouldSearchCompanyByName() { - client - .get() - .uri(uriBuilder -> - uriBuilder - .path("/api/search/nameAndBirth") - .queryParam(ApplicationConstants.CLIENT_SEARCH_LAST_NAME, "BORIS AND BORIS INC.") - .queryParam(ApplicationConstants.CLIENT_SEARCH_FIRST_NAME, Optional.empty()) - .queryParam(ApplicationConstants.CLIENT_SEARCH_BIRTHDATE, Optional.empty()) - .build(new HashMap<>()) - ) - .header("Content-Type", MediaType.APPLICATION_JSON_VALUE) - .exchange() - .expectStatus().isOk() - .expectBody() - .jsonPath("$[0].clientNumber").isNotEmpty() - .jsonPath("$[0].clientNumber").isEqualTo("00000003") - .jsonPath("$[0].clientName").isNotEmpty() - .jsonPath("$[0].clientName").isEqualTo("BORIS AND BORIS INC.") - .jsonPath("$[0].legalFirstName").isEmpty() - .jsonPath("$[0].legalMiddleName").isEmpty() - .consumeWith(System.out::println); - } - - @Test - @DisplayName("Fail When parameter is missing") - void shouldFailWhenMissingParam() { - client - .get() - .uri(uriBuilder -> - uriBuilder - .path("/api/search/nameAndBirth") - .queryParam(ApplicationConstants.CLIENT_SEARCH_FIRST_NAME, "BORIS AND BORIS INC.") - .queryParam(ApplicationConstants.CLIENT_SEARCH_LAST_NAME, Optional.empty()) - .build(new HashMap<>()) - ) - .header("Content-Type", MediaType.APPLICATION_JSON_VALUE) - .exchange() - .expectStatus().isEqualTo(HttpStatus.EXPECTATION_FAILED.value()) - .expectBody() - .equals("Missing value for parameter "+ApplicationConstants.CLIENT_SEARCH_BIRTHDATE); - } - -} diff --git a/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientBandsHandlerIntegrationTest.java b/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientBandsHandlerIntegrationTest.java deleted file mode 100644 index 8e2a124821..0000000000 --- a/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientBandsHandlerIntegrationTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package ca.bc.gov.app.endpoints; - -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.okJson; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; - -import ca.bc.gov.app.extensions.AbstractTestContainerIntegrationTest; -import ca.bc.gov.app.extensions.WiremockLogNotifier; -import com.github.tomakehurst.wiremock.junit5.WireMockExtension; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.test.web.reactive.server.WebTestClient; - -@Slf4j -@DisplayName("Integrated Test | Forest Client Bands Controller") -class ForestClientBandsHandlerIntegrationTest extends AbstractTestContainerIntegrationTest { - - @Autowired - protected WebTestClient client; - - @RegisterExtension - static WireMockExtension wireMockExtension = WireMockExtension - .newInstance() - .options( - wireMockConfig() - .port(10000) - .notifier(new WiremockLogNotifier()) - .asynchronousResponseEnabled(true) - .stubRequestLoggingDisabled(false) - ) - .configureStaticDsl(true) - .build(); - - @BeforeAll - public static void setUp(){ - wireMockExtension.resetAll(); - } - - @Test - @DisplayName("List first nation band validation") - void shouldListBandValidation() { - wireMockExtension - .stubFor( - get(urlMatching("/api/maps/firstNation/.*")) - .willReturn(okJson(""" - { - "FIRST_NATION_FEDERAL_NAME": "Sample Indian Band Council", - "FIRST_NATION_FEDERAL_ID": 684, - "ADDRESS_LINE1": "916-1150 Mainland St", - "ADDRESS_LINE2": " ", - "OFFICE_CITY": "VANCOUVER", - "OFFICE_PROVINCE": "BC", - "OFFICE_POSTAL_CODE": "V6B 2T4" - } - """) - ) - ); - - - client - .get() - .uri("/api/client/bands") - .header("Content-Type", MediaType.APPLICATION_JSON_VALUE) - .exchange() - .expectStatus().isOk() - .expectBody() - .jsonPath("[0].clientNumber").isNotEmpty() - .jsonPath("[0].clientNumber").isEqualTo("00000004") - - .jsonPath("[0].nameMatch").isNotEmpty() - .jsonPath("[0].nameMatch").isBoolean() - .jsonPath("[0].nameMatch").isEqualTo(true) - - .jsonPath("[0].addressMatch").isNotEmpty() - .jsonPath("[0].addressMatch").isBoolean() - .jsonPath("[0].addressMatch").isEqualTo(false) - - .consumeWith(System.out::println); - - - } - -} diff --git a/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientDoingBusinessHandlerIntegrationTest.java b/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientDoingBusinessHandlerIntegrationTest.java deleted file mode 100644 index b693d9ab22..0000000000 --- a/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientDoingBusinessHandlerIntegrationTest.java +++ /dev/null @@ -1,164 +0,0 @@ -package ca.bc.gov.app.endpoints; - -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.okJson; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; - -import ca.bc.gov.app.extensions.AbstractTestContainerIntegrationTest; -import ca.bc.gov.app.extensions.WiremockLogNotifier; -import com.github.tomakehurst.wiremock.junit5.WireMockExtension; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.test.web.reactive.server.WebTestClient; - -@Slf4j -@DisplayName("Integrated Test | Forest Client Doing Business Controller") -class ForestClientDoingBusinessHandlerIntegrationTest extends - AbstractTestContainerIntegrationTest { - - @Autowired - protected WebTestClient client; - - @RegisterExtension - static WireMockExtension wireMockExtension = WireMockExtension - .newInstance() - .options( - wireMockConfig() - .port(10000) - .notifier(new WiremockLogNotifier()) - .asynchronousResponseEnabled(true) - .stubRequestLoggingDisabled(false) - ) - .configureStaticDsl(true) - .build(); - - @BeforeAll - public static void setUp(){ - wireMockExtension.resetAll(); - } - - @Test - @DisplayName("Those clients do business as") - void shouldListBandValidation() { - wireMockExtension - .stubFor( - get(urlMatching("/api/orgbook/name/.*")) - .willReturn(okJson(""" - { - "total": 1, - "page_size": 10, - "page": 1, - "results": [ - { - "id": 789282, - "source_id": "BC0772006", - "type": "registration.registries.ca", - "names": [ - { - "id": 1187440, - "text": "U3 POWER CORP.", \s - "type": "entity_name", - "credential_id": 1218748 - }, - { - "id": 3355176, - "text": "837723121", \s - "type": "business_number", - "credential_id": 3471039 - } - ], - "addresses": [], - "attributes": [ - { - "id": 8336043, - "type": "registration_date", - "format": "datetime", - "value": "2006-10-17T23:58:42+00:00", - "credential_id": 1218748, - "credential_type_id": 1 - }, - { - "id": 8336044, - "type": "entity_name_effective", - "format": "datetime", - "value": "2006-10-17T23:58:42+00:00", - "credential_id": 1218748, - "credential_type_id": 1 - }, - { - "id": 8336045, - "type": "entity_status", - "format": "category", - "value": "ACT", - "credential_id": 1218748, - "credential_type_id": 1 - }, - { - "id": 8336046, - "type": "entity_status_effective", - "format": "datetime", - "value": "2006-10-17T23:58:42+00:00", - "credential_id": 1218748, - "credential_type_id": 1 - }, - { - "id": 8336047, - "type": "entity_type", - "format": "category", - "value": "BC", - "credential_id": 1218748, - "credential_type_id": 1 - }, - { - "id": 8336048, - "type": "home_jurisdiction", - "format": "jurisdiction", - "value": "BC", - "credential_id": 1218748, - "credential_type_id": 1 - }, - { - "id": 8336049, - "type": "reason_description", - "format": "category", - "value": "Filing:ICORP", - "credential_id": 1218748, - "credential_type_id": 1 - } - ], - "credential_set": { - "id": 789295, - "create_timestamp": "2020-02-15T20:05:45.979364Z", - "update_timestamp": "2020-02-15T20:05:45.979402Z", - "latest_credential_id": 1218748, - "topic_id": 789282, - "first_effective_date": "2006-10-17T23:58:42Z", - "last_effective_date": null - } - } - ] - }""") - ) - ); - - - client - .get() - .uri("/api/client/business") - .header("Content-Type", MediaType.APPLICATION_JSON_VALUE) - .exchange() - .expectStatus().isOk() - .expectBody() - .jsonPath("$.length()").isNumber() - .jsonPath("$.length()").isEqualTo(3) - .consumeWith(System.out::println); - - - } -} diff --git a/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientReportingIntegrationTest.java b/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientReportingIntegrationTest.java new file mode 100644 index 0000000000..fc2b35a3ec --- /dev/null +++ b/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientReportingIntegrationTest.java @@ -0,0 +1,110 @@ +package ca.bc.gov.app.endpoints; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.matching; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; + +import ca.bc.gov.app.TestConstants; +import ca.bc.gov.app.extensions.AbstractTestContainerIntegrationTest; +import ca.bc.gov.app.extensions.WiremockLogNotifier; +import com.github.tomakehurst.wiremock.junit5.WireMockExtension; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.test.web.reactive.server.WebTestClient; + +@Slf4j +@DisplayName("Integrated Test | Forest Client Reporting Controller") +class ForestClientReportingIntegrationTest extends + AbstractTestContainerIntegrationTest { + + @Autowired + protected WebTestClient client; + + @RegisterExtension + static WireMockExtension wireMockExtension = WireMockExtension + .newInstance() + .options( + wireMockConfig() + .port(10001) + .notifier(new WiremockLogNotifier()) + .asynchronousResponseEnabled(true) + .stubRequestLoggingDisabled(false) + ) + .configureStaticDsl(true) + .build(); + + @BeforeAll + public static void setUp() { + wireMockExtension.resetAll(); + } + + + @Test + @DisplayName("Generate all spreadsheet") + void shouldGenerateAllSheet() { + wireMockExtension + .stubFor( + get(urlPathEqualTo("/v4/search/topic")) + .withQueryParam("format",equalTo("json")) + .withQueryParam("inactive",equalTo("any")) + .withQueryParam("ordering",equalTo("-score")) + .withQueryParam("q",matching("^(.*)$")) + .willReturn( + aResponse() + .withBody(TestConstants.ORGBOOK_TOPIC) + .withStatus(200) + .withHeader("Content-Type",MediaType.APPLICATION_JSON_VALUE) + .withTransformers("response-template") + ) + ); + + client + .get() + .uri("/api/reports/all") + .exchange() + .expectStatus().isOk() + .expectHeader() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .expectHeader().valueEquals(HttpHeaders.CONTENT_DISPOSITION,"attachment; filename=FC Report All Clients.xlsx"); + + } + + @Test + @DisplayName("Generate business as spreadsheet") + void shouldGenerateBusinessAsSheet() { + wireMockExtension + .stubFor( + get(urlPathEqualTo("/v4/search/topic")) + .withQueryParam("format",equalTo("json")) + .withQueryParam("inactive",equalTo("any")) + .withQueryParam("ordering",equalTo("-score")) + .withQueryParam("q",matching("^(.*)$")) + .willReturn( + aResponse() + .withBody(TestConstants.ORGBOOK_TOPIC) + .withStatus(200) + .withHeader("Content-Type",MediaType.APPLICATION_JSON_VALUE) + .withTransformers("response-template") + ) + ); + + client + .get() + .uri("/api/reports/businessAs") + .exchange() + .expectStatus().isOk() + .expectHeader() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .expectHeader().valueEquals(HttpHeaders.CONTENT_DISPOSITION,"attachment; filename=FC Report Business As.xlsx"); + + } +} diff --git a/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientUnregisteredHandlerIntegrationTest.java b/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientUnregisteredHandlerIntegrationTest.java deleted file mode 100644 index 2f418ee150..0000000000 --- a/legacy/src/test/java/ca/bc/gov/app/endpoints/ForestClientUnregisteredHandlerIntegrationTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package ca.bc.gov.app.endpoints; - -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.notFound; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; - -import ca.bc.gov.app.extensions.AbstractTestContainerIntegrationTest; -import ca.bc.gov.app.extensions.WiremockLogNotifier; -import com.github.tomakehurst.wiremock.junit5.WireMockExtension; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.test.web.reactive.server.WebTestClient; - -@Slf4j -@DisplayName("Integrated Test | Forest Client Unregistered Controller") -class ForestClientUnregisteredHandlerIntegrationTest extends - AbstractTestContainerIntegrationTest { - - - @Autowired - protected WebTestClient client; - - @RegisterExtension - static WireMockExtension wireMockExtension = WireMockExtension - .newInstance() - .options( - wireMockConfig() - .port(10000) - .notifier(new WiremockLogNotifier()) - .asynchronousResponseEnabled(true) - .stubRequestLoggingDisabled(false) - ) - .configureStaticDsl(true) - .build(); - - @BeforeAll - public static void setUp() { - wireMockExtension.resetAll(); - } - - - @Test - @DisplayName("I'm not registered") - void shouldListBandValidation() { - wireMockExtension - .stubFor(get(urlMatching("/api/orgbook/name/.*")).willReturn(notFound())); - - client - .get() - .uri("/api/client/unregistered") - .header("Content-Type", MediaType.APPLICATION_JSON_VALUE) - .exchange() - .expectStatus().isOk() - .expectBody() - - .jsonPath("$.length()").isNumber() - .jsonPath("$.length()").isEqualTo(4) - - .consumeWith(System.out::println); - - - } -} diff --git a/legacy/src/test/resources/application-default.yml b/legacy/src/test/resources/application-default.yml index f2a9fdf789..552e704326 100644 --- a/legacy/src/test/resources/application-default.yml +++ b/legacy/src/test/resources/application-default.yml @@ -18,6 +18,7 @@ ca: bc: gov: nrs: + orgbook: 'http://127.0.0.1:10001' forest: uri: 'http://127.0.0.1:10000' oracle: @@ -32,3 +33,4 @@ logging: org.springframework.r2dbc: DEBUG io.r2dbc.postgresql.QUERY: DEBUG io.r2dbc.postgresql.PARAM: DEBUG + ca.bc.gov.app: DEBUG diff --git a/legacy/src/test/resources/db/migration/V1__init.sql b/legacy/src/test/resources/db/migration/V1__init.sql index ab52081282..67bec0e4da 100644 --- a/legacy/src/test/resources/db/migration/V1__init.sql +++ b/legacy/src/test/resources/db/migration/V1__init.sql @@ -30,15 +30,6 @@ PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS"; -INSERT INTO THE.FOREST_CLIENT (CLIENT_NUMBER,CLIENT_NAME,LEGAL_FIRST_NAME,LEGAL_MIDDLE_NAME,CLIENT_STATUS_CODE,CLIENT_TYPE_CODE,BIRTHDATE,CLIENT_ID_TYPE_CODE,CLIENT_IDENTIFICATION,REGISTRY_COMPANY_TYPE_CODE,CORP_REGN_NMBR,CLIENT_ACRONYM,WCB_FIRM_NUMBER,OCG_SUPPLIER_NMBR,CLIENT_COMMENT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,REVISION_COUNT) VALUES -('00000001','BAXTER','JAMES',NULL,'ACT','I',TIMESTAMP'1959-05-18 00:00:00.0','BCDL',NULL,NULL,'00000001',NULL,NULL,NULL,'Il.',TIMESTAMP'1989-11-26 08:52:38.0','CONV',70,TIMESTAMP'1999-02-16 10:40:05.0','JDOH',70,1) ; -INSERT INTO THE.FOREST_CLIENT (CLIENT_NUMBER,CLIENT_NAME,LEGAL_FIRST_NAME,LEGAL_MIDDLE_NAME,CLIENT_STATUS_CODE,CLIENT_TYPE_CODE,BIRTHDATE,CLIENT_ID_TYPE_CODE,CLIENT_IDENTIFICATION,REGISTRY_COMPANY_TYPE_CODE,CORP_REGN_NMBR,CLIENT_ACRONYM,WCB_FIRM_NUMBER,OCG_SUPPLIER_NMBR,CLIENT_COMMENT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,REVISION_COUNT) VALUES -('00000002','FUNNY','THOMAS','Yansi','ACT','I',TIMESTAMP'1939-07-04 00:00:00.0','BCDL','Wull.',NULL,'00000002',NULL,NULL,NULL,'C v.',TIMESTAMP'1989-11-26 08:52:38.0','CONV',70,TIMESTAMP'2000-08-24 15:59:37.0','PLOUSY',70,1); -INSERT INTO THE.FOREST_CLIENT (CLIENT_NUMBER,CLIENT_NAME,LEGAL_FIRST_NAME,LEGAL_MIDDLE_NAME,CLIENT_STATUS_CODE,CLIENT_TYPE_CODE,BIRTHDATE,CLIENT_ID_TYPE_CODE,CLIENT_IDENTIFICATION,REGISTRY_COMPANY_TYPE_CODE,CORP_REGN_NMBR,CLIENT_ACRONYM,WCB_FIRM_NUMBER,OCG_SUPPLIER_NMBR,CLIENT_COMMENT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,REVISION_COUNT) VALUES -('00000003','BORIS AND BORIS INC.',NULL,NULL,'ACT','C',NULL,'BCDL',NULL,NULL,'00000003',NULL,NULL,NULL,NULL,TIMESTAMP'1989-11-26 08:52:38.0','CONV',70,TIMESTAMP'1989-11-26 08:52:38.0','CLIENT_REWRITE_CONV',70,1); -INSERT INTO THE.FOREST_CLIENT (CLIENT_NUMBER,CLIENT_NAME,LEGAL_FIRST_NAME,LEGAL_MIDDLE_NAME,CLIENT_STATUS_CODE,CLIENT_TYPE_CODE,BIRTHDATE,CLIENT_ID_TYPE_CODE,CLIENT_IDENTIFICATION,REGISTRY_COMPANY_TYPE_CODE,CORP_REGN_NMBR,CLIENT_ACRONYM,WCB_FIRM_NUMBER,OCG_SUPPLIER_NMBR,CLIENT_COMMENT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,REVISION_COUNT) VALUES -('00000004','SAMPLE INDIAN BAND COUNCIL',NULL,NULL,'ACT','B',NULL,NULL,NULL,'DINA','684','SAMPLIBC',236967,NULL,NULL,TIMESTAMP'1989-11-26 08:52:38.0','CONV',70,TIMESTAMP'1989-11-26 08:52:38.0','IDIR\ITISWATTLES',70,1); - CREATE TABLE "THE"."CLIENT_DOING_BUSINESS_AS"( "CLIENT_DBA_ID" NUMBER(12,0), "CLIENT_NUMBER" VARCHAR2(8), @@ -59,14 +50,6 @@ PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS"; -INSERT INTO THE.CLIENT_DOING_BUSINESS_AS (CLIENT_DBA_ID,CLIENT_NUMBER,DOING_BUSINESS_AS_NAME,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES -(1,'00000001','BAXTER''S FAMILY',TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,1); -INSERT INTO THE.CLIENT_DOING_BUSINESS_AS (CLIENT_DBA_ID,CLIENT_NUMBER,DOING_BUSINESS_AS_NAME,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES -(2,'00000002','DOUG FUNNY',TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,1); -INSERT INTO THE.CLIENT_DOING_BUSINESS_AS (CLIENT_DBA_ID,CLIENT_NUMBER,DOING_BUSINESS_AS_NAME,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES -(3,'00000003','BORIS AND BORIS INC.',TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,1); - - CREATE TABLE "THE"."CLIENT_STATUS_CODE"( "CLIENT_STATUS_CODE" VARCHAR2(3), "DESCRIPTION" VARCHAR2(120), @@ -93,7 +76,6 @@ INSERT INTO THE.CLIENT_STATUS_CODE (CLIENT_STATUS_CODE,DESCRIPTION,EFFECTIVE_DAT INSERT INTO THE.CLIENT_STATUS_CODE (CLIENT_STATUS_CODE,DESCRIPTION,EFFECTIVE_DATE,EXPIRY_DATE,UPDATE_TIMESTAMP) VALUES ('SPN','Suspended',TIMESTAMP'1905-01-01 00:00:00.0',TIMESTAMP'9999-12-31 00:00:00.0',TIMESTAMP'2007-03-14 14:42:21.0'); - CREATE TABLE "THE"."CLIENT_LOCATION"( "CLIENT_NUMBER" VARCHAR2(8), "CLIENT_LOCN_CODE" VARCHAR2(2), @@ -131,19 +113,6 @@ PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS"; -INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES -('00000001','00',NULL,'01382','2080 Labieux Rd',NULL,NULL,'NANAIMO','BC','V9T6J9','CANADA',NULL,'8006618773',NULL,NULL,NULL,'N',NULL,'N',NULL,TIMESTAMP'2002-03-22 15:52:03.0','JBAXTER',27,TIMESTAMP'1989-11-26 08:52:09.0','CONV',70,1); -INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES -('00000002','00',NULL,'01384','Government St','Floor 2',NULL,'VICTORIA','BC','V8V2L8','CANADA',NULL,NULL,NULL,NULL,NULL,'N',NULL,'N',NULL,TIMESTAMP'1991-11-20 13:15:01.0','JBAXTER',64,TIMESTAMP'1989-11-26 08:52:09.0','CONV',70,1); -INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES -('00000003','00',NULL,'01385','1950 Douglas St',NULL,NULL,'VICTORIA','BC','V8W1Z2','CANADA',NULL,NULL,NULL,NULL,NULL,'N',NULL,'N',NULL,TIMESTAMP'1999-05-04 09:30:11.0','JBAXTER',70,TIMESTAMP'1989-11-26 08:52:09.0','CONV',70,1); -INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES -('00000004','00',NULL,'26573','PO BOX 999',NULL,NULL,'VICTORIA','BC','V8W1M0','CANADA',NULL,'2502502550',NULL,'2502502550',NULL,'N',NULL,'N',NULL,TIMESTAMP'2002-03-05 10:01:05.0','JBAXTER',21,TIMESTAMP'1989-11-26 12:20:50.0','CONV',70,1); -INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES -('00000004','01','BAND OFFICE','D3475','INDIAN BAND','916-1150 MAINLAND ST',NULL,'VANCOUVER','BC','V6B2T4','CANADA','2505205200',NULL,NULL,'2505205200',NULL,'N',NULL,'N','THIS LOCATION IS ONLY FOR THE AGREEMENT SIGNAGE',TIMESTAMP'2006-04-03 15:01:44.0','itiswattles',70,TIMESTAMP'2001-01-25 14:08:42.0','ITISWATTLES',3,1); -INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES -('00000004','02','TRUST ACCOUNT -RSI','T1350','PO BOX 588',NULL,NULL,'CHASE','BC','V0E1M0','CANADA',NULL,'2502502550',NULL,'2502502550',NULL,'Y',NULL,'Y','TRUST ACCOUNT - RSI',TIMESTAMP'2005-10-06 15:02:02.0','NEGELY',1834,TIMESTAMP'9999-12-31 00:00:00.0','CONVSNT',70,1); - CREATE OR REPLACE VIEW THE.V_CLIENT_PUBLIC (CLIENT_NUMBER,CLIENT_NAME,LEGAL_FIRST_NAME,LEGAL_MIDDLE_NAME,CLIENT_STATUS_CODE,CLIENT_TYPE_CODE) @@ -154,4 +123,153 @@ SELECT client_number , legal_middle_name , client_status_code , client_type_code - FROM THE.forest_client; \ No newline at end of file + FROM THE.forest_client; + +CREATE TABLE "THE"."BUSINESS_CONTACT_CODE" ( + BUSINESS_CONTACT_CODE VARCHAR2(3) NOT NULL, + DESCRIPTION VARCHAR2(120) NOT NULL, + EFFECTIVE_DATE DATE NOT NULL, + EXPIRY_DATE DATE NOT NULL, + UPDATE_TIMESTAMP DATE NOT NULL, + CONSTRAINT BCC_PK PRIMARY KEY (BUSINESS_CONTACT_CODE), + CONSTRAINT SYS_C0012316 CHECK ("BUSINESS_CONTACT_CODE" IS NOT NULL), + CONSTRAINT SYS_C0012317 CHECK ("DESCRIPTION" IS NOT NULL), + CONSTRAINT SYS_C0012318 CHECK ("EFFECTIVE_DATE" IS NOT NULL), + CONSTRAINT SYS_C0012319 CHECK ("EXPIRY_DATE" IS NOT NULL), + CONSTRAINT SYS_C0012320 CHECK ("UPDATE_TIMESTAMP" IS NOT NULL) +); + +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('AP', 'Accounts Payable', TIMESTAMP '1905-01-01 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('AR', 'Accounts Receivable', TIMESTAMP '1905-01-01 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('BA', 'First Nations Administrator', TIMESTAMP '2007-10-11 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('BC', 'First Nations Council Member', TIMESTAMP '2007-10-11 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('BL', 'Billing', TIMESTAMP '1905-01-01 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('BM', 'First Nations Manager', TIMESTAMP '2007-10-11 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('BN', 'First Nations Treaty Negotiator', TIMESTAMP '2007-10-11 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('CH', 'Chief', TIMESTAMP '2007-10-11 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('CL', 'Collections', TIMESTAMP '1905-01-01 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('DI', 'Director', TIMESTAMP '2005-02-17 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('EX', 'Export', TIMESTAMP '1905-01-01 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('GP', 'General Partner', TIMESTAMP '2006-11-21 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('IL', 'Interior Log Cost Reporting', TIMESTAMP '2015-04-01 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('LB', 'Log Broker', TIMESTAMP '1905-01-01 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('LP', 'Limited Partner', TIMESTAMP '2006-11-21 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('RC', 'Recreation Agreement Holder', TIMESTAMP '2005-03-21 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('SI', 'Scale Site Contact', TIMESTAMP '2007-08-02 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('SP', 'SPAR System Contact', TIMESTAMP '1905-01-01 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('SR', 'Stumpage Rates', TIMESTAMP '1905-01-01 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('SS', 'Scaling Software Vendor Contact', TIMESTAMP '2001-09-12 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('TC', 'BCTS Contractor', TIMESTAMP '2003-04-16 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('TN', 'Tenure Administration', TIMESTAMP '1905-01-01 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); +INSERT INTO "THE"."BUSINESS_CONTACT_CODE" +(BUSINESS_CONTACT_CODE, DESCRIPTION, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES('TP', 'EDI Trading Partner', TIMESTAMP '2000-07-25 00:00:00.000000', TIMESTAMP '9999-12-31 00:00:00.000000', TIMESTAMP '2016-03-11 09:35:17.000000'); + +CREATE TABLE "THE"."ORG_UNIT" ( + ORG_UNIT_NO NUMBER(10,0) NOT NULL, + ORG_UNIT_CODE VARCHAR2(6) NOT NULL, + ORG_UNIT_NAME VARCHAR2(100) NOT NULL, + LOCATION_CODE VARCHAR2(3) NOT NULL, + AREA_CODE VARCHAR2(3) NOT NULL, + TELEPHONE_NO VARCHAR2(7) NOT NULL, + ORG_LEVEL_CODE VARCHAR2(1) NOT NULL, + OFFICE_NAME_CODE VARCHAR2(2) NOT NULL, + ROLLUP_REGION_NO NUMBER(10,0) NOT NULL, + ROLLUP_REGION_CODE VARCHAR2(6) NOT NULL, + ROLLUP_DIST_NO NUMBER(10,0) NOT NULL, + ROLLUP_DIST_CODE VARCHAR2(6) NOT NULL, + EFFECTIVE_DATE DATE NOT NULL, + EXPIRY_DATE DATE NOT NULL, + UPDATE_TIMESTAMP DATE NULL, + CONSTRAINT ORG_UNIT_PK PRIMARY KEY (ORG_UNIT_NO), + CONSTRAINT SYS_C008931 CHECK ("ORG_UNIT_NO" IS NOT NULL), + CONSTRAINT SYS_C008932 CHECK ("ORG_UNIT_CODE" IS NOT NULL), + CONSTRAINT SYS_C008933 CHECK ("ORG_UNIT_NAME" IS NOT NULL), + CONSTRAINT SYS_C008934 CHECK ("LOCATION_CODE" IS NOT NULL), + CONSTRAINT SYS_C008935 CHECK ("AREA_CODE" IS NOT NULL), + CONSTRAINT SYS_C008936 CHECK ("TELEPHONE_NO" IS NOT NULL), + CONSTRAINT SYS_C008938 CHECK ("ORG_LEVEL_CODE" IS NOT NULL), + CONSTRAINT SYS_C008939 CHECK ("OFFICE_NAME_CODE" IS NOT NULL), + CONSTRAINT SYS_C008941 CHECK ("ROLLUP_REGION_NO" IS NOT NULL), + CONSTRAINT SYS_C008942 CHECK ("ROLLUP_REGION_CODE" IS NOT NULL), + CONSTRAINT SYS_C008944 CHECK ("ROLLUP_DIST_NO" IS NOT NULL), + CONSTRAINT SYS_C008946 CHECK ("ROLLUP_DIST_CODE" IS NOT NULL), + CONSTRAINT SYS_C008947 CHECK ("EFFECTIVE_DATE" IS NOT NULL), + CONSTRAINT SYS_C008949 CHECK ("EXPIRY_DATE" IS NOT NULL) +); + +CREATE TABLE "THE"."CLIENT_CONTACT" ( + CLIENT_CONTACT_ID NUMBER(12,0) NOT NULL, + CLIENT_NUMBER VARCHAR2(8) NOT NULL, + CLIENT_LOCN_CODE VARCHAR2(2) NOT NULL, + BUS_CONTACT_CODE VARCHAR2(3) NOT NULL, + CONTACT_NAME VARCHAR2(120) NOT NULL, + BUSINESS_PHONE VARCHAR2(10) NULL, + CELL_PHONE VARCHAR2(10) NULL, + FAX_NUMBER VARCHAR2(10) NULL, + EMAIL_ADDRESS VARCHAR2(128) NULL, + UPDATE_TIMESTAMP DATE NOT NULL, + UPDATE_USERID VARCHAR2(30) NOT NULL, + UPDATE_ORG_UNIT NUMBER(10,0) NOT NULL, + ADD_TIMESTAMP DATE NOT NULL, + ADD_USERID VARCHAR2(30) NOT NULL, + ADD_ORG_UNIT NUMBER(10,0) NOT NULL, + REVISION_COUNT NUMBER(5,0) NOT NULL, + CONSTRAINT CLC_PK PRIMARY KEY (CLIENT_CONTACT_ID), + CONSTRAINT SYS_C0030038 CHECK ("CLIENT_CONTACT_ID" IS NOT NULL), + CONSTRAINT SYS_C0030040 CHECK ("CLIENT_NUMBER" IS NOT NULL), + CONSTRAINT SYS_C0030042 CHECK ("CLIENT_LOCN_CODE" IS NOT NULL), + CONSTRAINT SYS_C0030044 CHECK ("BUS_CONTACT_CODE" IS NOT NULL), + CONSTRAINT SYS_C0030046 CHECK ("CONTACT_NAME" IS NOT NULL), + CONSTRAINT SYS_C0030048 CHECK ("UPDATE_TIMESTAMP" IS NOT NULL), + CONSTRAINT SYS_C0030050 CHECK ("UPDATE_USERID" IS NOT NULL), + CONSTRAINT SYS_C0030051 CHECK ("UPDATE_ORG_UNIT" IS NOT NULL), + CONSTRAINT SYS_C0030052 CHECK ("ADD_TIMESTAMP" IS NOT NULL), + CONSTRAINT SYS_C0030053 CHECK ("ADD_USERID" IS NOT NULL), + CONSTRAINT SYS_C0030054 CHECK ("ADD_ORG_UNIT" IS NOT NULL), + CONSTRAINT SYS_C0030055 CHECK ("REVISION_COUNT" IS NOT NULL) +); diff --git a/legacy/src/test/resources/db/migration/V2__full_client.sql b/legacy/src/test/resources/db/migration/V2__full_client.sql new file mode 100644 index 0000000000..d85aea7c5a --- /dev/null +++ b/legacy/src/test/resources/db/migration/V2__full_client.sql @@ -0,0 +1,122 @@ +-- 00000001 James Baxter, Doing Business and Location + +INSERT INTO THE.FOREST_CLIENT (CLIENT_NUMBER,CLIENT_NAME,LEGAL_FIRST_NAME,LEGAL_MIDDLE_NAME,CLIENT_STATUS_CODE,CLIENT_TYPE_CODE,BIRTHDATE,CLIENT_ID_TYPE_CODE,CLIENT_IDENTIFICATION,REGISTRY_COMPANY_TYPE_CODE,CORP_REGN_NMBR,CLIENT_ACRONYM,WCB_FIRM_NUMBER,OCG_SUPPLIER_NMBR,CLIENT_COMMENT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,REVISION_COUNT) VALUES +('00000001','BAXTER','JAMES',NULL,'ACT','I',TIMESTAMP'1959-05-18 00:00:00.0','BCDL',NULL,NULL,'00000001',NULL,NULL,NULL,'Il.',TIMESTAMP'1989-11-26 08:52:38.0','CONV',70,TIMESTAMP'1999-02-16 10:40:05.0','JDOH',70,1) ; + +INSERT INTO THE.CLIENT_DOING_BUSINESS_AS (CLIENT_DBA_ID,CLIENT_NUMBER,DOING_BUSINESS_AS_NAME,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES +(1,'00000001','BAXTER''S FAMILY',TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,1); + +INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES +('00000001','00',NULL,'01382','2080 Labieux Rd',NULL,NULL,'NANAIMO','BC','V9T6J9','CANADA',NULL,'8006618773',NULL,NULL,NULL,'N',NULL,'N',NULL,TIMESTAMP'2002-03-22 15:52:03.0','JBAXTER',27,TIMESTAMP'1989-11-26 08:52:09.0','CONV',70,1); + +-- 00000002 Doug Funny, Doing Buseness and Location + +INSERT INTO THE.FOREST_CLIENT (CLIENT_NUMBER,CLIENT_NAME,LEGAL_FIRST_NAME,LEGAL_MIDDLE_NAME,CLIENT_STATUS_CODE,CLIENT_TYPE_CODE,BIRTHDATE,CLIENT_ID_TYPE_CODE,CLIENT_IDENTIFICATION,REGISTRY_COMPANY_TYPE_CODE,CORP_REGN_NMBR,CLIENT_ACRONYM,WCB_FIRM_NUMBER,OCG_SUPPLIER_NMBR,CLIENT_COMMENT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,REVISION_COUNT) VALUES +('00000002','FUNNY','THOMAS','Yansi','ACT','I',TIMESTAMP'1939-07-04 00:00:00.0','BCDL','Wull.',NULL,'00000002',NULL,NULL,NULL,'C v.',TIMESTAMP'1989-11-26 08:52:38.0','CONV',70,TIMESTAMP'2000-08-24 15:59:37.0','PLOUSY',70,1); + +INSERT INTO THE.CLIENT_DOING_BUSINESS_AS (CLIENT_DBA_ID,CLIENT_NUMBER,DOING_BUSINESS_AS_NAME,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES +(2,'00000002','DOUG FUNNY',TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,1); + +INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES +('00000002','00',NULL,'01384','Government St','Floor 2',NULL,'VICTORIA','BC','V8V2L8','CANADA',NULL,NULL,NULL,NULL,NULL,'N',NULL,'N',NULL,TIMESTAMP'1991-11-20 13:15:01.0','JBAXTER',64,TIMESTAMP'1989-11-26 08:52:09.0','CONV',70,1); + +-- 00000003 Boris and Boris, Doing Business and Location + +INSERT INTO THE.FOREST_CLIENT (CLIENT_NUMBER,CLIENT_NAME,LEGAL_FIRST_NAME,LEGAL_MIDDLE_NAME,CLIENT_STATUS_CODE,CLIENT_TYPE_CODE,BIRTHDATE,CLIENT_ID_TYPE_CODE,CLIENT_IDENTIFICATION,REGISTRY_COMPANY_TYPE_CODE,CORP_REGN_NMBR,CLIENT_ACRONYM,WCB_FIRM_NUMBER,OCG_SUPPLIER_NMBR,CLIENT_COMMENT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,REVISION_COUNT) VALUES +('00000003','BORIS AND BORIS INC.',NULL,NULL,'ACT','C',NULL,'BCDL',NULL,NULL,'00000003',NULL,NULL,NULL,NULL,TIMESTAMP'1989-11-26 08:52:38.0','CONV',70,TIMESTAMP'1989-11-26 08:52:38.0','CLIENT_REWRITE_CONV',70,1); + +INSERT INTO THE.CLIENT_DOING_BUSINESS_AS (CLIENT_DBA_ID,CLIENT_NUMBER,DOING_BUSINESS_AS_NAME,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES +(3,'00000003','BORIS AND BORIS INC.',TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,TIMESTAMP'2007-04-24 12:21:47.0','IDIR\ITISWATTLES',70,1); + +INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES +('00000003','00',NULL,'01385','1950 Douglas St',NULL,NULL,'VICTORIA','BC','V8W1Z2','CANADA',NULL,NULL,NULL,NULL,NULL,'N',NULL,'N',NULL,TIMESTAMP'1999-05-04 09:30:11.0','JBAXTER',70,TIMESTAMP'1989-11-26 08:52:09.0','CONV',70,1); + +-- 00000004 Indian Band, Multiple Locations + +INSERT INTO THE.FOREST_CLIENT (CLIENT_NUMBER,CLIENT_NAME,LEGAL_FIRST_NAME,LEGAL_MIDDLE_NAME,CLIENT_STATUS_CODE,CLIENT_TYPE_CODE,BIRTHDATE,CLIENT_ID_TYPE_CODE,CLIENT_IDENTIFICATION,REGISTRY_COMPANY_TYPE_CODE,CORP_REGN_NMBR,CLIENT_ACRONYM,WCB_FIRM_NUMBER,OCG_SUPPLIER_NMBR,CLIENT_COMMENT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,REVISION_COUNT) VALUES +('00000004','SAMPLE INDIAN BAND COUNCIL',NULL,NULL,'ACT','B',NULL,NULL,NULL,'DINA','684','SAMPLIBC',236967,NULL,NULL,TIMESTAMP'1989-11-26 08:52:38.0','CONV',70,TIMESTAMP'1989-11-26 08:52:38.0','IDIR\ITISWATTLES',70,1); + +INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES +('00000004','00',NULL,'26573','PO BOX 999',NULL,NULL,'VICTORIA','BC','V8W1M0','CANADA',NULL,'2502502550',NULL,'2502502550',NULL,'N',NULL,'N',NULL,TIMESTAMP'2002-03-05 10:01:05.0','JBAXTER',21,TIMESTAMP'1989-11-26 12:20:50.0','CONV',70,1); +INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES +('00000004','01','BAND OFFICE','D3475','INDIAN BAND','916-1150 MAINLAND ST',NULL,'VANCOUVER','BC','V6B2T4','CANADA','2505205200',NULL,NULL,'2505205200',NULL,'N',NULL,'N','THIS LOCATION IS ONLY FOR THE AGREEMENT SIGNAGE',TIMESTAMP'2006-04-03 15:01:44.0','itiswattles',70,TIMESTAMP'2001-01-25 14:08:42.0','ITISWATTLES',3,1); +INSERT INTO THE.CLIENT_LOCATION (CLIENT_NUMBER,CLIENT_LOCN_CODE,CLIENT_LOCN_NAME,HDBS_COMPANY_CODE,ADDRESS_1,ADDRESS_2,ADDRESS_3,CITY,PROVINCE,POSTAL_CODE,COUNTRY,BUSINESS_PHONE,HOME_PHONE,CELL_PHONE,FAX_NUMBER,EMAIL_ADDRESS,LOCN_EXPIRED_IND,RETURNED_MAIL_DATE,TRUST_LOCATION_IND,CLI_LOCN_COMMENT,UPDATE_TIMESTAMP,UPDATE_USERID,UPDATE_ORG_UNIT,ADD_TIMESTAMP,ADD_USERID,ADD_ORG_UNIT,REVISION_COUNT) VALUES +('00000004','02','TRUST ACCOUNT -RSI','T1350','PO BOX 588',NULL,NULL,'CHASE','BC','V0E1M0','CANADA',NULL,'2502502550',NULL,'2502502550',NULL,'Y',NULL,'Y','TRUST ACCOUNT - RSI',TIMESTAMP'2005-10-06 15:02:02.0','NEGELY',1834,TIMESTAMP'9999-12-31 00:00:00.0','CONVSNT',70,1); + +-- 00000005 Erna Krakowsky + +INSERT INTO THE.FOREST_CLIENT +(CLIENT_NUMBER, CLIENT_NAME, LEGAL_FIRST_NAME, LEGAL_MIDDLE_NAME, CLIENT_STATUS_CODE, CLIENT_TYPE_CODE, BIRTHDATE, CLIENT_ID_TYPE_CODE, CLIENT_IDENTIFICATION, REGISTRY_COMPANY_TYPE_CODE, CORP_REGN_NMBR, CLIENT_ACRONYM, WCB_FIRM_NUMBER, OCG_SUPPLIER_NMBR, CLIENT_COMMENT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, REVISION_COUNT) +VALUES('00000005', 'KRAKOWSKY', 'ERNA', NULL, 'ACT', 'I', NULL, NULL, NULL, 'DINA', '684', 'SAMPLIBC', '236967', NULL, NULL, TIMESTAMP '1989-11-26 08:52:38.000000', 'CONV', 70, TIMESTAMP '1989-11-26 08:52:38.000000', 'IDIR\ITISWATTLES', 70, 1); + +-- 00000006 Indian Canada, Doing Business, Multiple Locations, Org Unit, Contact + +INSERT INTO "THE"."FOREST_CLIENT" +(CLIENT_NUMBER, CLIENT_NAME, LEGAL_FIRST_NAME, LEGAL_MIDDLE_NAME, CLIENT_STATUS_CODE, CLIENT_TYPE_CODE, BIRTHDATE, CLIENT_ID_TYPE_CODE, CLIENT_IDENTIFICATION, REGISTRY_COMPANY_TYPE_CODE, CORP_REGN_NMBR, CLIENT_ACRONYM, WCB_FIRM_NUMBER, OCG_SUPPLIER_NMBR, CLIENT_COMMENT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, REVISION_COUNT) +VALUES('00000006', 'INDIAN CANADA', NULL, NULL, 'ACT', 'G', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TIMESTAMP '1989-11-26 08:54:15.000000', 'CONV', 70, TIMESTAMP '2001-09-28 11:04:30.000000', 'IDIR\ITISWATTLES', 70, 1); + +INSERT INTO "THE"."CLIENT_LOCATION" +(CLIENT_NUMBER, CLIENT_LOCN_CODE, CLIENT_LOCN_NAME, HDBS_COMPANY_CODE, ADDRESS_1, ADDRESS_2, ADDRESS_3, CITY, PROVINCE, POSTAL_CODE, COUNTRY, BUSINESS_PHONE, HOME_PHONE, CELL_PHONE, FAX_NUMBER, EMAIL_ADDRESS, LOCN_EXPIRED_IND, RETURNED_MAIL_DATE, TRUST_LOCATION_IND, CLI_LOCN_COMMENT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, REVISION_COUNT) +VALUES('00000006', '00', 'MAILING ADDRESS', '04106', '300 - 1550 ALBERNI STREET', NULL, NULL, 'VANCOUVER', 'BC', 'V6G3C5', 'CANADA', NULL, NULL, NULL, NULL, NULL, 'N', NULL, 'N', NULL, TIMESTAMP '1990-06-20 10:51:17.000000', 'IDIR\ITISWATTLES', 62, TIMESTAMP '1989-11-26 08:54:15.000000', 'IDIR\ITISWATTLES', 70, 1); +INSERT INTO "THE"."CLIENT_LOCATION" +(CLIENT_NUMBER, CLIENT_LOCN_CODE, CLIENT_LOCN_NAME, HDBS_COMPANY_CODE, ADDRESS_1, ADDRESS_2, ADDRESS_3, CITY, PROVINCE, POSTAL_CODE, COUNTRY, BUSINESS_PHONE, HOME_PHONE, CELL_PHONE, FAX_NUMBER, EMAIL_ADDRESS, LOCN_EXPIRED_IND, RETURNED_MAIL_DATE, TRUST_LOCATION_IND, CLI_LOCN_COMMENT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, REVISION_COUNT) +VALUES('00000006', '01', 'TERRACE/LAKALZAP BAND', '05050', '600 1138 MELVILLE ST', NULL, NULL, 'VANCOUVER', 'BC', 'V6E4S3', 'CANADA', '6046666755', NULL, NULL, NULL, NULL, 'N', NULL, 'N', NULL, TIMESTAMP '2001-04-25 13:47:53.000000', 'IDIR\ITISWATTLES', 70, TIMESTAMP '1990-08-27 13:25:25.000000', 'IDIR\ITISWATTLES', 62, 1); +INSERT INTO "THE"."CLIENT_LOCATION" +(CLIENT_NUMBER, CLIENT_LOCN_CODE, CLIENT_LOCN_NAME, HDBS_COMPANY_CODE, ADDRESS_1, ADDRESS_2, ADDRESS_3, CITY, PROVINCE, POSTAL_CODE, COUNTRY, BUSINESS_PHONE, HOME_PHONE, CELL_PHONE, FAX_NUMBER, EMAIL_ADDRESS, LOCN_EXPIRED_IND, RETURNED_MAIL_DATE, TRUST_LOCATION_IND, CLI_LOCN_COMMENT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, REVISION_COUNT) +VALUES('00000006', '02', NULL, '05893', '209 280 VICTORIA STREET', NULL, NULL, 'PRINCE GEORGE', 'BC', 'V2L4X3', 'CANADA', '2505615121', NULL, NULL, NULL, NULL, 'N', NULL, 'N', NULL, TIMESTAMP '1999-03-24 15:00:18.000000', 'IDIR\ITISWATTLES', 70, TIMESTAMP '1990-08-27 13:26:46.000000', 'IDIR\ITISWATTLES', 62, 1); +INSERT INTO "THE"."CLIENT_LOCATION" +(CLIENT_NUMBER, CLIENT_LOCN_CODE, CLIENT_LOCN_NAME, HDBS_COMPANY_CODE, ADDRESS_1, ADDRESS_2, ADDRESS_3, CITY, PROVINCE, POSTAL_CODE, COUNTRY, BUSINESS_PHONE, HOME_PHONE, CELL_PHONE, FAX_NUMBER, EMAIL_ADDRESS, LOCN_EXPIRED_IND, RETURNED_MAIL_DATE, TRUST_LOCATION_IND, CLI_LOCN_COMMENT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, REVISION_COUNT) +VALUES('00000006', '03', 'SHUSWAP BAND OFFICE', '06901', 'SHUSWAP BAND OFFICE', 'PO BOX 790', NULL, 'INVERMERE', 'BC', 'V0A1K0', 'CANADA', NULL, NULL, NULL, NULL, NULL, 'N', NULL, 'N', NULL, TIMESTAMP '1999-03-24 15:00:34.000000', 'IDIR\ITISWATTLES', 70, TIMESTAMP '1990-08-27 13:27:57.000000', 'IDIR\ITISWATTLES', 62, 1); + +INSERT INTO "THE"."ORG_UNIT" +(ORG_UNIT_NO, ORG_UNIT_CODE, ORG_UNIT_NAME, LOCATION_CODE, AREA_CODE, TELEPHONE_NO, ORG_LEVEL_CODE, OFFICE_NAME_CODE, ROLLUP_REGION_NO, ROLLUP_REGION_CODE, ROLLUP_DIST_NO, ROLLUP_DIST_CODE, EFFECTIVE_DATE, EXPIRY_DATE, UPDATE_TIMESTAMP) +VALUES(1, 'RVA', 'OBSOLETE - Vancouver Forest Region (RCO)', '043', '250', '7517001', 'R', 'VA', 1835, 'RCO', 1, 'RVA', TIMESTAMP '1905-01-01 00:00:00.000000', TIMESTAMP '2003-03-31 00:00:00.000000', TIMESTAMP '2003-05-27 15:58:49.000000'); + +INSERT INTO "THE"."CLIENT_CONTACT" +(CLIENT_CONTACT_ID, CLIENT_NUMBER, CLIENT_LOCN_CODE, BUS_CONTACT_CODE, CONTACT_NAME, BUSINESS_PHONE, CELL_PHONE, FAX_NUMBER, EMAIL_ADDRESS, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, REVISION_COUNT) +VALUES(1717, '00000006', '00', 'BL', 'JASON MOMOA', '6046666755', NULL, NULL, NULL, TIMESTAMP '1993-03-26 17:40:15.000000', 'IDIR\ITISWATTLES', 1, TIMESTAMP '1993-03-26 17:40:15.000000', 'IDIR\ITISWATTLES', 1, 1); +INSERT INTO "THE"."CLIENT_CONTACT" +(CLIENT_CONTACT_ID, CLIENT_NUMBER, CLIENT_LOCN_CODE, BUS_CONTACT_CODE, CONTACT_NAME, BUSINESS_PHONE, CELL_PHONE, FAX_NUMBER, EMAIL_ADDRESS, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, REVISION_COUNT) +VALUES(1718, '00000006', '00', 'TN', 'NEDAD KONTIC', '6046666755', NULL, NULL, NULL, TIMESTAMP '1993-03-26 17:37:29.000000', 'IDIR\ITISWATTLES', 1, TIMESTAMP '1993-03-26 17:37:29.000000', 'IDIR\ITISWATTLES', 1, 1); + +-- 00000007 James Bond + +INSERT INTO THE.FOREST_CLIENT +(CLIENT_NUMBER, CLIENT_NAME, LEGAL_FIRST_NAME, LEGAL_MIDDLE_NAME, CLIENT_STATUS_CODE, CLIENT_TYPE_CODE, BIRTHDATE, CLIENT_ID_TYPE_CODE, CLIENT_IDENTIFICATION, REGISTRY_COMPANY_TYPE_CODE, CORP_REGN_NMBR, CLIENT_ACRONYM, WCB_FIRM_NUMBER, OCG_SUPPLIER_NMBR, CLIENT_COMMENT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, REVISION_COUNT) +VALUES('00000007', 'bond', 'james', 'bond', 'ACT', 'I', TIMESTAMP '1939-07-04 00:00:00.000000', 'BCDL', 'Wull.', NULL, '00000002', NULL, NULL, NULL, 'C v.', TIMESTAMP '1989-11-26 08:52:38.000000', 'CONV', 70, TIMESTAMP '2000-08-24 15:59:37.000000', 'PLOUSY', 70, 1); + +-- 00000008 James Hunt HUnt + +INSERT INTO THE.FOREST_CLIENT +(CLIENT_NUMBER, CLIENT_NAME, LEGAL_FIRST_NAME, LEGAL_MIDDLE_NAME, CLIENT_STATUS_CODE, CLIENT_TYPE_CODE, BIRTHDATE, CLIENT_ID_TYPE_CODE, CLIENT_IDENTIFICATION, REGISTRY_COMPANY_TYPE_CODE, CORP_REGN_NMBR, CLIENT_ACRONYM, WCB_FIRM_NUMBER, OCG_SUPPLIER_NMBR, CLIENT_COMMENT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, REVISION_COUNT) +VALUES('00000008', 'hunt', 'james', 'hunt', 'ACT', 'I', NULL, NULL, NULL, 'DINA', '684', 'SAMPLIBC', '236967', NULL, NULL, TIMESTAMP '1989-11-26 08:52:38.000000', 'CONV', 70, TIMESTAMP '1989-11-26 08:52:38.000000', 'IDIR\ITISWATTLES', 70, 1); + +-- 00000009 James Hunt + +INSERT INTO THE.FOREST_CLIENT +(CLIENT_NUMBER, CLIENT_NAME, LEGAL_FIRST_NAME, LEGAL_MIDDLE_NAME, CLIENT_STATUS_CODE, CLIENT_TYPE_CODE, BIRTHDATE, CLIENT_ID_TYPE_CODE, CLIENT_IDENTIFICATION, REGISTRY_COMPANY_TYPE_CODE, CORP_REGN_NMBR, CLIENT_ACRONYM, WCB_FIRM_NUMBER, OCG_SUPPLIER_NMBR, CLIENT_COMMENT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, REVISION_COUNT) +VALUES('00000009', 'james', NULL, 'hunt', 'ACT', 'I', NULL, NULL, NULL, 'DINA', '684', 'SAMPLIBC', '236967', NULL, NULL, TIMESTAMP '1989-11-26 08:52:38.000000', 'CONV', 70, TIMESTAMP '1989-11-26 08:52:38.000000', 'IDIR\ITISWATTLES', 70, 1); + +-- 00000010 Jjamess Bbondd + +INSERT INTO THE.FOREST_CLIENT +(CLIENT_NUMBER, CLIENT_NAME, LEGAL_FIRST_NAME, LEGAL_MIDDLE_NAME, CLIENT_STATUS_CODE, CLIENT_TYPE_CODE, BIRTHDATE, CLIENT_ID_TYPE_CODE, CLIENT_IDENTIFICATION, REGISTRY_COMPANY_TYPE_CODE, CORP_REGN_NMBR, CLIENT_ACRONYM, WCB_FIRM_NUMBER, OCG_SUPPLIER_NMBR, CLIENT_COMMENT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, REVISION_COUNT) +VALUES('00000010', 'bbondd', 'jjamess', 'bbondd', 'ACT', 'A', NULL, NULL, NULL, 'DINA', '684', 'SAMPLIBC', '236967', NULL, NULL, TIMESTAMP '1989-11-26 08:52:38.000000', 'CONV', 70, TIMESTAMP '1989-11-26 08:52:38.000000', 'IDIR\ITISWATTLES', 70, 1); + +-- 00000011 CORP. OF THE CITY OF VICTORIA + +INSERT INTO THE.FOREST_CLIENT +(CLIENT_NUMBER, CLIENT_NAME, LEGAL_FIRST_NAME, LEGAL_MIDDLE_NAME, CLIENT_STATUS_CODE, CLIENT_TYPE_CODE, BIRTHDATE, CLIENT_ID_TYPE_CODE, CLIENT_IDENTIFICATION, REGISTRY_COMPANY_TYPE_CODE, CORP_REGN_NMBR, CLIENT_ACRONYM, WCB_FIRM_NUMBER, OCG_SUPPLIER_NMBR, CLIENT_COMMENT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, REVISION_COUNT) +VALUES('00000011', 'CORP. OF THE CITY OF VICTORIA', NULL, NULL, 'ACT', 'G', NULL, NULL, NULL, 'DINA', '684', 'SAMPLIBC', '236967', NULL, NULL, TIMESTAMP '1989-11-26 08:52:38.000000', 'CONV', 70, TIMESTAMP '1989-11-26 08:52:38.000000', 'IDIR\ITISWATTLES', 70, 1); + +-- 00000012 Sampler FOREST PRODUCTS INC + +INSERT INTO THE.FOREST_CLIENT +(CLIENT_NUMBER, CLIENT_NAME, LEGAL_FIRST_NAME, LEGAL_MIDDLE_NAME, CLIENT_STATUS_CODE, CLIENT_TYPE_CODE, BIRTHDATE, CLIENT_ID_TYPE_CODE, CLIENT_IDENTIFICATION, REGISTRY_COMPANY_TYPE_CODE, CORP_REGN_NMBR, CLIENT_ACRONYM, WCB_FIRM_NUMBER, OCG_SUPPLIER_NMBR, CLIENT_COMMENT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, REVISION_COUNT) +VALUES('00000012', 'SAMPLER FOREST PRODUCTS INC.', NULL, NULL, 'ACT', 'U', NULL, NULL, NULL, 'DINA', '684', 'SAMPLIBC', '236967', NULL, NULL, TIMESTAMP '1989-11-26 08:52:38.000000', 'CONV', 70, TIMESTAMP '1989-11-26 08:52:38.000000', 'IDIR\ITISWATTLES', 70, 1); + +-- 00000013 DOREEN FOREST PRODUCTS LTD + +INSERT INTO THE.FOREST_CLIENT +(CLIENT_NUMBER, CLIENT_NAME, LEGAL_FIRST_NAME, LEGAL_MIDDLE_NAME, CLIENT_STATUS_CODE, CLIENT_TYPE_CODE, BIRTHDATE, CLIENT_ID_TYPE_CODE, CLIENT_IDENTIFICATION, REGISTRY_COMPANY_TYPE_CODE, CORP_REGN_NMBR, CLIENT_ACRONYM, WCB_FIRM_NUMBER, OCG_SUPPLIER_NMBR, CLIENT_COMMENT, ADD_TIMESTAMP, ADD_USERID, ADD_ORG_UNIT, UPDATE_TIMESTAMP, UPDATE_USERID, UPDATE_ORG_UNIT, REVISION_COUNT) +VALUES('00000013', 'DOREEN FOREST PRODUCTS LTD.', NULL, NULL, 'ACT', 'C', NULL, NULL, NULL, 'DINA', '684', 'SAMPLIBC', '236967', NULL, NULL, TIMESTAMP '1989-11-26 08:52:38.000000', 'CONV', 70, TIMESTAMP '1989-11-26 08:52:38.000000', 'IDIR\ITISWATTLES', 70, 1);