Skip to content

Commit

Permalink
update fw-commons
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangtien2k3 committed Aug 26, 2024
1 parent 44fc65f commit a9eb068
Show file tree
Hide file tree
Showing 22 changed files with 744 additions and 38 deletions.
137 changes: 137 additions & 0 deletions exception-handling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,146 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${central-publishing-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
<failOnError>false</failOnError>
</configuration>
<executions>
<execution>
<id>generate-javadocs</id>
<phase>prepare-package</phase>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
<configuration>
<java>
<eclipse>
</eclipse>
<indent>
<tabs>true</tabs>
<spacesPerTab>2</spacesPerTab>
</indent>
<indent>
<spaces>true</spaces>
<spacesPerTab>2</spacesPerTab>
</indent>
<removeUnusedImports/>
<palantirJavaFormat/>
</java>
</configuration>
<executions>
<execution>
<id>java-formatter</id>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>4.0.rc2</version>
<configuration>
<header>src/main/resources/license-header.txt</header>
<includes>
<include>**/*.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hoangtien2k3.exception.exception;
package io.hoangtien2k3.exception;

import io.hoangtien2k3.exception.Translator;
import java.util.Arrays;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.Arrays;

@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hoangtien2k3.exception.constants;
package io.hoangtien2k3.exception;

public class CommonErrorCode {
public static final String BAD_REQUEST = "bad_request";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hoangtien2k3.exception.response;
package io.hoangtien2k3.exception;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.hoangtien2k3.exception.Translator;
import io.hoangtien2k3.exception.constants.MessageConstant;

import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.http.HttpStatus;

import java.io.Serializable;

/**
* Represents a standardized response structure for API responses.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2024 the original author Hoàng Anh Tiến.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hoangtien2k3.exception;

import org.springframework.boot.SpringApplication;
Expand All @@ -6,8 +21,7 @@
@SpringBootApplication
public class ExceptionHandlingApplication {

public static void main(String[] args) {
SpringApplication.run(ExceptionHandlingApplication.class, args);
}

public static void main(String[] args) {
SpringApplication.run(ExceptionHandlingApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hoangtien2k3.exception.config.exception;
package io.hoangtien2k3.exception;

import io.hoangtien2k3.exception.Translator;
import io.hoangtien2k3.exception.constants.CommonErrorCode;
import io.hoangtien2k3.exception.exception.BusinessException;
import io.hoangtien2k3.exception.response.TraceErrorResponse;
import io.micrometer.tracing.Tracer;
import java.nio.file.AccessDeniedException;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.support.DefaultMessageSourceResolvable;
Expand All @@ -33,11 +33,6 @@
import org.springframework.web.server.ServerWebInputException;
import reactor.core.publisher.Mono;

import java.nio.file.AccessDeniedException;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* <h2>Exception Handlers:</h2>
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hoangtien2k3.exception.config;
package io.hoangtien2k3.exception;

import java.util.Locale;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.web.server.i18n.AcceptHeaderLocaleContextResolver;
import org.springframework.web.server.i18n.LocaleContextResolver;

import java.util.Locale;

/**
* Configuration class for locale and message source settings in the
* application.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hoangtien2k3.exception.constants;
package io.hoangtien2k3.exception;

public class MessageConstant {
public static final String SUCCESS = "success";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hoangtien2k3.exception.response;
package io.hoangtien2k3.exception;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hoangtien2k3.exception.config;
package io.hoangtien2k3.exception;

import brave.Tracing;
import io.micrometer.tracing.Tracer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package io.hoangtien2k3.exception;

import java.util.Locale;
import java.util.Objects;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
Expand All @@ -24,9 +26,6 @@
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;

import java.util.Locale;
import java.util.Objects;

/**
* Utility class for translating message codes to localized messages. Provides
* methods to translate message codes to messages in different locales. Supports
Expand Down

This file was deleted.

13 changes: 13 additions & 0 deletions exception-handling/src/main/resources/license-header.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2024 the original author Hoàng Anh Tiến.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2024 the original author Hoàng Anh Tiến.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hoangtien2k3.exception;

import org.junit.jupiter.api.Test;
Expand All @@ -6,8 +21,6 @@
@SpringBootTest
class ExceptionHandlingApplicationTests {

@Test
void contextLoads() {
}

@Test
void contextLoads() {}
}
Loading

0 comments on commit a9eb068

Please sign in to comment.