diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge-main.yml index b6c8bbe..03ddca7 100644 --- a/.github/workflows/merge-main.yml +++ b/.github/workflows/merge-main.yml @@ -111,15 +111,7 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Setup JDK 17 - uses: actions/setup-java@v3 - with: - java-version: "17" - distribution: "temurin" - cache: "maven" - server-id: "github" - - - uses: bcgov-nr/action-test-and-analyse-java@v0.1.0 + - uses: bcgov-nr/action-test-and-analyse-java@v0.2.0 name: Core Coverage with: commands: | @@ -134,11 +126,13 @@ jobs: sonar_project_token: ${{ secrets.SONAR_TOKEN_COMMONS }} - name: Publish Core - working-directory: ./core - run: | - mvn versions:set -DnewVersion='${{ needs.release.outputs.version }}' -DskipTests -Dtests.skip=true --file pom.xml - mvn versions:commit - mvn -B source:jar deploy --file pom.xml + uses: paulushcgcj/action-java-publish@v0.1.1 + with: + dir: core + app-version: ${{ needs.release.outputs.version }} + extra-params: -DskipTests -Dtests.skip=true + add-sources: true + add-javadoc: true env: GITHUB_TOKEN: ${{ github.token }} @@ -153,19 +147,11 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Setup JDK 17 - uses: actions/setup-java@v3 - with: - java-version: "17" - distribution: "temurin" - cache: "maven" - server-id: "github" - - - uses: bcgov-nr/action-test-and-analyse-java@v0.1.0 + - uses: bcgov-nr/action-test-and-analyse-java@v0.2.0 name: Spring Coverage with: commands: | - mvn versions:use-dep-version -DdepVersion=${{ needs.release.outputs.version }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml + mvn versions:use-dep-version -DdepVersion='${{ needs.release.outputs.version }}' -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml mvn -B verify -P all-tests checkstyle:checkstyle -Dcheckstyle.skip=false --file pom.xml dir: spring java-cache: maven @@ -177,11 +163,13 @@ jobs: sonar_project_token: ${{ secrets.SONAR_TOKEN_COMMONS }} - name: Publish Spring - working-directory: ./spring - run: | - mvn versions:use-dep-version -DdepVersion=${{ needs.release.outputs.version }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml - mvn versions:set -DnewVersion='${{ needs.release.outputs.version }}' -DskipTests -Dtests.skip=true --file pom.xml - mvn versions:commit --file pom.xml - mvn -B source:jar deploy --file pom.xml + uses: paulushcgcj/action-java-publish@v0.1.1 + with: + commands: mvn versions:use-dep-version -DdepVersion=${{ needs.release.outputs.version }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml + dir: spring + app-version: ${{ needs.release.outputs.version }} + extra-params: -DskipTests -Dtests.skip=true + add-sources: true + add-javadoc: true env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml index db3f2a3..d827ca3 100644 --- a/.github/workflows/pr-close.yml +++ b/.github/workflows/pr-close.yml @@ -18,8 +18,6 @@ jobs: steps: - name: Checkout branch uses: actions/checkout@v3 - with: - ref: refs/heads/${{ github.head_ref }} - name: Conventional Changelog Update continue-on-error: true @@ -31,12 +29,8 @@ jobs: skip-version-file: "true" skip-commit: "true" git-push: "false" - git-branch: refs/heads/${{ github.head_ref }} skip-on-empty: "false" - - name: Checkout pr - uses: actions/checkout@v3 - - name: Removing dev core uses: paulushcgcj/delete-github-package@1.0.0 continue-on-error: true diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index c5ed214..ae809ae 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -153,15 +153,7 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Setup JDK 17 - uses: actions/setup-java@v3 - with: - java-version: "17" - distribution: "temurin" - cache: "maven" - server-id: "github" - - - uses: bcgov-nr/action-test-and-analyse-java@v0.1.0 + - uses: bcgov-nr/action-test-and-analyse-java@v0.2.0 name: Core Coverage with: commands: | @@ -176,11 +168,13 @@ jobs: sonar_project_token: ${{ secrets.SONAR_TOKEN_COMMONS }} - name: Publish Core - working-directory: ./core - run: | - mvn versions:set -DnewVersion='${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }}' -DskipTests -Dtests.skip=true --file pom.xml - mvn versions:commit - mvn -B source:jar deploy --file pom.xml + uses: paulushcgcj/action-java-publish@v0.1.1 + with: + dir: core + app-version: ${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }} + extra-params: -DskipTests -Dtests.skip=true + add-sources: true + add-javadoc: true env: GITHUB_TOKEN: ${{ github.token }} @@ -196,15 +190,7 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Setup JDK 17 - uses: actions/setup-java@v3 - with: - java-version: "17" - distribution: "temurin" - cache: "maven" - server-id: "github" - - - uses: bcgov-nr/action-test-and-analyse-java@v0.1.0 + - uses: bcgov-nr/action-test-and-analyse-java@v0.2.0 name: Spring Coverage with: commands: | @@ -220,11 +206,13 @@ jobs: sonar_project_token: ${{ secrets.SONAR_TOKEN_COMMONS }} - name: Publish Spring - working-directory: ./spring - run: | - mvn versions:use-dep-version -DdepVersion=${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml - mvn versions:set -DnewVersion='${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }}' -DskipTests -Dtests.skip=true --file pom.xml - mvn versions:commit --file pom.xml - mvn -B source:jar deploy --file pom.xml + uses: paulushcgcj/action-java-publish@v0.1.1 + with: + commands: mvn versions:use-dep-version -DdepVersion=${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }} -Dincludes=ca.bc.gov.nrs-commons:forest-client-core -DforceVersion=true --file pom.xml + dir: spring + app-version: ${{ needs.pr-validation.outputs.version }}.PR${{ github.event.number }} + extra-params: -DskipTests -Dtests.skip=true + add-sources: true + add-javadoc: true env: GITHUB_TOKEN: ${{ github.token }} diff --git a/core/pom.xml b/core/pom.xml index dae1c08..fd4adde 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -84,6 +84,15 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + ${java.version} + ${java.version} + + org.apache.maven.plugins maven-surefire-plugin @@ -160,7 +169,7 @@ maven-javadoc-plugin 3.5.0 - 8 + ${java.version} Javadoc Documentation for ${project.name} ${project.version} ${project.name} ${project.version} diff --git a/core/src/main/java/ca/bc/gov/app/dto/ValidationError.java b/core/src/main/java/ca/bc/gov/app/dto/ValidationError.java index 11a7c8a..d4a23d7 100644 --- a/core/src/main/java/ca/bc/gov/app/dto/ValidationError.java +++ b/core/src/main/java/ca/bc/gov/app/dto/ValidationError.java @@ -1,16 +1,23 @@ package ca.bc.gov.app.dto; -import java.io.Serializable; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.With; -@Data +@Schema( + description = "Represents a validation error during submission", + title = "ValidationError", + example = """ + { + "fieldId": "person.name", + "errorMsg": "Name is required" + }""" +) @With -@NoArgsConstructor -@AllArgsConstructor -public class ValidationError implements Serializable { - private String fieldId; - private String errorMsg; +public record ValidationError( + @Schema(description = "The field id that failed validation", example = "person.name") + String fieldId, + @Schema(description = "The error message for that specific field", example = "Name is required") + String errorMsg +) { + } diff --git a/core/src/main/java/ca/bc/gov/app/dto/legacy/ForestClientDto.java b/core/src/main/java/ca/bc/gov/app/dto/legacy/ForestClientDto.java index c24306d..4eca569 100644 --- a/core/src/main/java/ca/bc/gov/app/dto/legacy/ForestClientDto.java +++ b/core/src/main/java/ca/bc/gov/app/dto/legacy/ForestClientDto.java @@ -2,28 +2,130 @@ import ca.bc.gov.app.dto.client.ClientStatusCodeEnum; import ca.bc.gov.app.dto.client.ClientTypeCodeEnum; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.lang3.StringUtils; +@Schema( + description = "Represents a client from the legacy forest database.", + title = "ForestClient", + example = """ + { + "clientNumber": "00000002", + "clientName": "BAXTER", + "legalFirstName": "", + "legalMiddleName": "", + "clientStatusCode": "ACT", + "clientTypeCode": "I", + "clientIdTypeCode": "C", + "clientIdentification": "00000002", + "registryCompanyTypeCode": "BC", + "corpRegnNmbr": "00000002", + "clientAcronym": "", + "wcbFirmNumber": "", + "ocgSupplierNmbr": "", + "clientComment": "" + }""" +) public record ForestClientDto( + @Schema( + description = "The client number.", + example = "00000002" + ) String clientNumber, + @Schema(description = """ + The client last name if it's an individual or + the company name if it's a company""", + example = "BAXTER" + ) String clientName, + @Schema(description = """ + The first name of the individual, + or null if it's a company""", + example = "JAMES") String legalFirstName, + @Schema(description = """ + The middle name of the individual, + or null if it's a company""", + example = "Canter") String legalMiddleName, + @Schema(description = """ + The status of the client, can be any of the following:
+ + ACT (Active)
+ DAC (Deactivated)
+ DEC (Deceased)
+ REC (Receivership)
+ SPN (Suspended)""", + example = "ACT") String clientStatusCode, + @Schema(description = """ + The type of client, can be any of the following:
+ + A (Association)
+ B (First Nation Band)
+ C (Corporation)
+ F (Ministry of Forests and Range)
+ G (Government)
+ I (Individual)
+ L (Limited Partnership)
+ P (General Partnership)
+ R (First Nation Group)
+ S (Society)
+ T (First Nation Tribal Council)
+ U (Unregistered Company)""", + example = "I") String clientTypeCode, + + @Schema(description = """ + The type of client, can be any of the following:
+ + A (Association)
+ B (First Nation Band)
+ C (Corporation)
+ F (Ministry of Forests and Range)
+ G (Government)
+ I (Individual)
+ L (Limited Partnership)
+ P (General Partnership)
+ R (First Nation Group)
+ S (Society)
+ T (First Nation Tribal Council)
+ U (Unregistered Company)""", + example = "C") String clientIdTypeCode, + @Schema(description = "An ID to identify companies",example = "Wull.") String clientIdentification, + @Schema(description = """ + The type of company, such as:
+ + BC (BC Registered Business)
+ FM (Sole Proprietorship)""", + example = "FM") String registryCompanyTypeCode, + @Schema(description = "Company registration number", + example = "00000002") String corpRegnNmbr, + @Schema(description = "An acronyms for this client", + example = "JAMES BAXTER") String clientAcronym, + @Schema(description = "WCB firm number", + example = "00000002") String wcbFirmNumber, + @Schema(description = "OCG supplier number", + example = "00000002") String ocgSupplierNmbr, + @Schema(description = "A comment for this client", + example = "This is a comment") String clientComment ) { + /** + * Returns the legal name of the client already formatted + * @return A string with the legal name + */ public String legalName() { if (StringUtils.defaultString(clientTypeCode).equalsIgnoreCase("I")) { return @@ -38,6 +140,10 @@ public String legalName() { return StringUtils.defaultString(clientName); } + /** + * Returns a map with the client information + * @return A map with the client information + */ public Map description() { return Map.of( @@ -47,7 +153,7 @@ public Map description() { "type", ClientTypeCodeEnum.valueOf(clientTypeCode), "identifier", StringUtils.defaultString(registryCompanyTypeCode) + - StringUtils.defaultString(corpRegnNmbr) + StringUtils.defaultString(corpRegnNmbr) ); } } \ No newline at end of file diff --git a/core/src/main/java/ca/bc/gov/app/util/LogUtil.java b/core/src/main/java/ca/bc/gov/app/util/LogUtil.java index 9dcc8d9..6f090d7 100644 --- a/core/src/main/java/ca/bc/gov/app/util/LogUtil.java +++ b/core/src/main/java/ca/bc/gov/app/util/LogUtil.java @@ -6,8 +6,13 @@ import org.slf4j.Logger; import org.slf4j.event.Level; +/** + *

Log Util

+ *

Utility class for logging.

+ */ @NoArgsConstructor(access = AccessLevel.PRIVATE) public class LogUtil { + /** *

Log Content

* Log the content of the future at the specified level. diff --git a/spring/pom.xml b/spring/pom.xml index b6e165b..ff759e7 100644 --- a/spring/pom.xml +++ b/spring/pom.xml @@ -331,7 +331,7 @@ maven-javadoc-plugin 3.5.0 - 8 + ${java.version} Javadoc Documentation for ${project.name} ${project.version} ${project.name} ${project.version}