diff --git a/bom/pom.xml b/bom/pom.xml index 3e7c73a3..99a67d86 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -55,11 +55,6 @@ tkit-quarkus-rest ${project.version} - - org.tkit.quarkus.lib - tkit-quarkus-rest-dto - ${project.version} - org.tkit.quarkus.lib tkit-quarkus-rest-context diff --git a/docs/modules/tkit-quarkus/pages/includes/attributes.adoc b/docs/modules/tkit-quarkus/pages/includes/attributes.adoc index b0c5e776..d81376d9 100644 --- a/docs/modules/tkit-quarkus/pages/includes/attributes.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/attributes.adoc @@ -1,4 +1,4 @@ :project-version: 2.36.0 -:quarkus-version: 3.15.1 +:quarkus-version: 3.16.2 :examples-dir: ./../examples/ \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-data-import.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-data-import.adoc index 02dd5e68..9247dcf9 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-data-import.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-data-import.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-data-import [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -163,5 +162,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa-tenant.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa-tenant.adoc index ac6410fc..e9651c41 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa-tenant.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa-tenant.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-jpa-tenant [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -27,5 +26,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi-build.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi-build.adoc index 7381de2d..be128e50 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi-build.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi-build.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-log-cdi-build [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -27,5 +26,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc index 113dc0a1..af33deb0 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-log-cdi [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -282,5 +281,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc index 14987873..e9c394ce 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-log-json [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -107,7 +106,7 @@ ifndef::add-copy-button-to-env-var[] Environment variable: `+++TKIT_LOG_JSON_EXCEPTION_OUTPUT_TYPE+++` endif::add-copy-button-to-env-var[] -- -a|ExceptionOutputType +a|`detailed`, `formatted`, `formatted-brief`, `detailed-and-formatted` |`formatted` a| [[tkit-quarkus-log-json_tkit-log-json-print-details]] [.property-path]##link:#tkit-quarkus-log-json_tkit-log-json-print-details[`tkit.log.json.print-details`]## @@ -250,5 +249,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc index d0d79ee0..ffbf969a 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-log-rs [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -809,5 +808,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context-build.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context-build.adoc index a2da75d2..a79e0d66 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context-build.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context-build.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-rest-context-build [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -27,5 +26,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc index d58683f1..f63ae4d1 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-rest-context [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -741,5 +740,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc index 8d05df5a..3b83444e 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-security [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -27,5 +26,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-test-db-import.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-test-db-import.adoc index 28e51461..5b7cd545 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-test-db-import.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-test-db-import.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-test-db-import [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -44,5 +43,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-test.adoc b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-test.adoc index a4cf5473..83691974 100644 --- a/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-test.adoc +++ b/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-test.adoc @@ -1,4 +1,3 @@ -:summaryTableId: tkit-quarkus-test [.configuration-legend] icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime [.configuration-reference.searchable, cols="80,.^10,.^10"] @@ -112,5 +111,3 @@ endif::add-copy-button-to-env-var[] |=== - -:!summaryTableId: \ No newline at end of file diff --git a/extensions/pom.xml b/extensions/pom.xml index 2db79719..b5dde4c6 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -20,7 +20,6 @@ jpa-tenant data-import rest - rest-dto rest-context test-db-import security diff --git a/extensions/rest-dto/README.md b/extensions/rest-dto/README.md deleted file mode 100644 index dd9fe816..00000000 --- a/extensions/rest-dto/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# tkit-quarkus-rest-dto - -> tkit-quarkus-rest-dto is deprecated. It will be removed in the next major release. - -Helper classes for JAX-RS - model mapping, exception handling, DTOs. diff --git a/extensions/rest-dto/pom.xml b/extensions/rest-dto/pom.xml deleted file mode 100644 index 6f025202..00000000 --- a/extensions/rest-dto/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - 4.0.0 - - - org.tkit.quarkus.lib - tkit-quarkus-extensions-parent - 999-SNAPSHOT - ../pom.xml - - - tkit-quarkus-rest-dto - jar - - - - io.quarkus - quarkus-jackson - provided - - - jakarta.ws.rs - jakarta.ws.rs-api - - - diff --git a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/exceptions/RestException.java b/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/exceptions/RestException.java deleted file mode 100644 index 24e8185c..00000000 --- a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/exceptions/RestException.java +++ /dev/null @@ -1,206 +0,0 @@ -package org.tkit.quarkus.rs.exceptions; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import jakarta.ws.rs.core.Response; - -/** - * The REST exception. The DTO for this class {@link org.tkit.quarkus.rs.models.RestExceptionDTO} - * THe exception mapper {@link org.tkit.quarkus.rs.mappers.DefaultExceptionMapper} - */ -@Deprecated -public class RestException extends RuntimeException { - - /** - * The response status. - */ - private Response.Status status; - - /** - * The error code. - */ - private Enum errorCode; - - /** - * The list of parameters. - */ - private List parameters = new ArrayList<>(); - - /** - * The map of named parameters. - */ - private Map namedParameters = new HashMap<>(); - - /** - * The default constructor. - * - * @param errorCode the error code. - */ - public RestException(Enum errorCode) { - this(errorCode, Response.Status.INTERNAL_SERVER_ERROR); - } - - /** - * The default constructor. - * - * @param errorCode the error code. - * @param status the response status. - */ - public RestException(Enum errorCode, Response.Status status) { - super(requireNonNull(errorCode)); - this.errorCode = errorCode; - this.status = status; - } - - /** - * The default constructor. - * - * @param errorCode the error code. - * @param status the response status. - * @param cause the cause. - */ - public RestException(Enum errorCode, Response.Status status, Throwable cause) { - super(requireNonNull(errorCode), cause); - this.errorCode = errorCode; - this.status = status; - } - - /** - * The default constructor. - * - * @param errorCode the error code. - * @param cause the cause. - */ - public RestException(Enum errorCode, Throwable cause) { - this(errorCode, Response.Status.INTERNAL_SERVER_ERROR, cause); - } - - /** - * The default constructor. - * - * @param errorCode the error code. - * @param status the response status. - * @param cause the cause. - * @param params the list of parameters - */ - public RestException(Enum errorCode, Response.Status status, Throwable cause, Object... params) { - this(errorCode, status, cause); - if (params != null) { - Collections.addAll(this.parameters, params); - } - } - - /** - * The default constructor. - * - * @param errorCode the error code. - * @param cause the cause. - * @param params the list of parameters - */ - public RestException(Enum errorCode, Throwable cause, Object... params) { - this(errorCode, Response.Status.INTERNAL_SERVER_ERROR, cause, params); - } - - /** - * The default constructor. - * - * @param errorCode the error code. - * @param status the response status. - * @param params the list of parameters - */ - public RestException(Enum errorCode, Response.Status status, Object... params) { - this(errorCode, status); - if (params != null) { - Collections.addAll(this.parameters, params); - } - } - - /** - * The default constructor. - * - * @param errorCode the error code. - * @param params the list of parameters - */ - public RestException(Enum errorCode, Object... params) { - this(errorCode, Response.Status.INTERNAL_SERVER_ERROR, params); - } - - /** - * Adds the parameter with name. - * - * @param name the name of the parameter. - * @param value the value of the parameter. - * @return this instance. - */ - public RestException addParam(String name, Object value) { - this.namedParameters.put(name, value); - return this; - } - - /** - * Add the parameter to the list of parameters. - * - * @param value the parameter value. - * @return this instance. - */ - public RestException addParam(Object value) { - this.parameters.add(value); - return this; - } - - /** - * Add the list of parameters to the exception. - * - * @param params the list of parameters. - * @return this instance. - */ - public RestException withParams(Object... params) { - Collections.addAll(this.parameters, params); - return this; - } - - /** - * Add the map of named parameters to the exception. - * - * @param namedParams the named parameters. - * @return this instance. - */ - public RestException withNamedParams(Map namedParams) { - this.namedParameters.putAll(namedParams); - return this; - } - - /** - * Check if enum is not null. - * - * @param errorCode the error enumeration. - * @return the name of the enumeration. - * @throws NullPointerException if the {@code errorCode} is null. - */ - private static String requireNonNull(Enum errorCode) { - if (errorCode == null) { - throw new NullPointerException("Error code is null!"); - } - return errorCode.name(); - } - - public Response.Status getStatus() { - return status; - } - - public Enum getErrorCode() { - return errorCode; - } - - public List getParameters() { - return parameters; - } - - public Map getNamedParameters() { - return namedParameters; - } -} diff --git a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/mappers/DefaultExceptionMapper.java b/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/mappers/DefaultExceptionMapper.java deleted file mode 100644 index e53d2324..00000000 --- a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/mappers/DefaultExceptionMapper.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.tkit.quarkus.rs.mappers; - -import java.util.List; -import java.util.Locale; -import java.util.Optional; - -import jakarta.annotation.Priority; -import jakarta.ws.rs.WebApplicationException; -import jakarta.ws.rs.core.Context; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.UriInfo; -import jakarta.ws.rs.ext.ExceptionMapper; -import jakarta.ws.rs.ext.Provider; - -import org.eclipse.microprofile.config.ConfigProvider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.tkit.quarkus.rs.exceptions.RestException; -import org.tkit.quarkus.rs.models.RestExceptionDTO; -import org.tkit.quarkus.rs.resources.ResourceManager; - -/** - * The default exception mapper with priority {@code PRIORITY}. - */ -@Deprecated -@Provider -@Priority(DefaultExceptionMapper.PRIORITY) -public class DefaultExceptionMapper implements ExceptionMapper { - - private static final Logger log = LoggerFactory.getLogger(DefaultExceptionMapper.class); - - /** - * The exception mapper priority - */ - public static final int PRIORITY = 10000; - - /** - * The request headers. - */ - @Context - private HttpHeaders headers; - - /** - * The request URI info. - */ - @Context - UriInfo uriInfo; - - /** - * {@inheritDoc} - */ - @Override - public Response toResponse(Exception e) { - Optional logException = ConfigProvider.getConfig().getOptionalValue("tkit.rs.mapper.log", Boolean.class); - if (logException.isEmpty() || logException.get()) { - log.error("REST exception URL:{},ERROR:{}", uriInfo.getRequestUri(), e.getMessage()); - } - if (e instanceof RestException) { - return createResponse((RestException) e); - } - if (e instanceof WebApplicationException) { - return createResponse((WebApplicationException) e); - } - return createResponse(e); - } - - /** - * Creates the response from the {@link RestException} - * - * @param e the {@link RestException} - * @return the corresponding response. - */ - private Response createResponse(RestException e) { - RestExceptionDTO dto = new RestExceptionDTO(); - String message = ResourceManager.getMessage(e.getErrorCode(), getLocale(), e.getParameters()); - dto.setMessage(message); - - dto.setErrorCode(e.getErrorCode().name()); - dto.setParameters(e.getParameters()); - dto.setNamedParameters(e.getNamedParameters()); - return Response.status(e.getStatus()).type(mediaType()).entity(dto).build(); - } - - /** - * Creates the response from the {@link WebApplicationException} - * - * @param e the {@link WebApplicationException} - * @return the corresponding response. - */ - protected Response createResponse(WebApplicationException e) { - RestExceptionDTO dto = new RestExceptionDTO(); - dto.setErrorCode(Error.WEB_APPLICATION_EXCEPTION.name()); - dto.setMessage(e.getMessage()); - return Response.fromResponse(e.getResponse()).entity(dto).type(mediaType()).build(); - } - - /** - * Creates the response from the {@link Exception} - * - * @param e the {@link Exception} - * @return the corresponding response. - */ - protected Response createResponse(Exception e) { - RestExceptionDTO dto = new RestExceptionDTO(); - dto.setErrorCode(Error.UNDEFINED_ERROR_CODE.name()); - dto.setMessage(e.getMessage()); - return Response.serverError().type(mediaType()).entity(dto).build(); - } - - /** - * Gets the media type for the response. - * - * @return the media type for the response. - */ - protected MediaType mediaType() { - return MediaType.APPLICATION_JSON_TYPE; - } - - /** - * Gets the response locale. - * - * @return the response locale. - */ - protected Locale getLocale() { - List locales = headers.getAcceptableLanguages(); - if (locales != null && !locales.isEmpty()) { - Locale tmp = locales.get(0); - if (tmp != null && !"*".equals(tmp.getLanguage())) { - return tmp; - } - } - return null; - } - - /** - * The exception mapper error codes. - */ - public enum Error { - - /** - * The error code for the web application exception {@link WebApplicationException} - */ - WEB_APPLICATION_EXCEPTION, - - /** - * The error code for undefined exception. - */ - UNDEFINED_ERROR_CODE; - } - -} diff --git a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/AbstractTraceableDTO.java b/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/AbstractTraceableDTO.java deleted file mode 100644 index 219b33bc..00000000 --- a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/AbstractTraceableDTO.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2020 tkit.org. - * - * 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 - * - * http://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 org.tkit.quarkus.rs.models; - -import java.io.Serializable; -import java.time.OffsetDateTime; - -import io.quarkus.runtime.annotations.RegisterForReflection; - -/** - * The persistent entity interface. - */ -@Deprecated -@RegisterForReflection -public abstract class AbstractTraceableDTO implements Serializable { - - /** - * The UID of this class. - */ - private static final long serialVersionUID = -8041083748062531412L; - - /** - * Optimistic lock version - */ - private Integer modificationCount; - - /** - * The creation date. - */ - private OffsetDateTime creationDate; - /** - * The creation user. - */ - private String creationUser; - /** - * The modification date. - */ - private OffsetDateTime modificationDate; - /** - * The modification user. - */ - private String modificationUser; - - /** - * Gets the GUID. - * - * @return the GUID. - */ - public abstract T getId(); - - /** - * Sets the GUID. - * - * @param guid the new GUID. - */ - public abstract void setId(T guid); - - /** - * Overwrite the {@code toString} method for the logger. - * - * @return the className:Id - */ - @Override - public String toString() { - return this.getClass().getSimpleName() + ":" + getId(); - } - - /** - * Gets the optimistic lock version/modification counter value. - * - * @return the optimistic lock version. - */ - public Integer getModificationCount() { - return this.modificationCount; - } - - /** - * Sets the opt lock version/modification counter. Should not be normally used by app programers. - * - * @param modificationCount actual Version - */ - public void setModificationCount(Integer modificationCount) { - this.modificationCount = modificationCount; - } - - public OffsetDateTime getCreationDate() { - return creationDate; - } - - public void setCreationDate(OffsetDateTime creationDate) { - this.creationDate = creationDate; - } - - public String getCreationUser() { - return creationUser; - } - - public void setCreationUser(String creationUser) { - this.creationUser = creationUser; - } - - public OffsetDateTime getModificationDate() { - return modificationDate; - } - - public void setModificationDate(OffsetDateTime modificationDate) { - this.modificationDate = modificationDate; - } - - public String getModificationUser() { - return modificationUser; - } - - public void setModificationUser(String modificationUser) { - this.modificationUser = modificationUser; - } -} diff --git a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/BusinessTraceableDTO.java b/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/BusinessTraceableDTO.java deleted file mode 100644 index 32ee7c49..00000000 --- a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/BusinessTraceableDTO.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2020 tkit.org. - * - * 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 - * - * http://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 org.tkit.quarkus.rs.models; - -import java.util.Objects; - -import io.quarkus.runtime.annotations.RegisterForReflection; - -@Deprecated -@RegisterForReflection -public class BusinessTraceableDTO extends AbstractTraceableDTO { - - /** - * The UID for this class. - */ - private static final long serialVersionUID = 2102461206948885441L; - - /** - * The ID. - */ - private Long id; - - /** - * {@inheritDoc } - */ - @Override - public Long getId() { - return id; - } - - /** - * {@inheritDoc } - */ - @Override - public void setId(Long id) { - this.id = id; - } - - /** - * {@inheritDoc } - * - * @see Object#equals(Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - BusinessTraceableDTO other = (BusinessTraceableDTO) obj; - Object guid = getId(); - Object otherGuid = other.getId(); - - if (guid == null) { - if (otherGuid != null) { - return false; - } else { - return super.equals(obj); - } - } else if (!guid.equals(otherGuid)) { - return false; - } - - return true; - } - - /** - * {@inheritDoc } - * - * @see Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + Objects.hashCode(getId()); - return result; - } - -} diff --git a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/PageResultDTO.java b/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/PageResultDTO.java deleted file mode 100644 index 7ac923c6..00000000 --- a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/PageResultDTO.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2020 tkit.org. - * - * 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 - * - * http://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 org.tkit.quarkus.rs.models; - -import java.util.List; - -import io.quarkus.runtime.annotations.RegisterForReflection; - -@Deprecated -@RegisterForReflection -public class PageResultDTO { - - /** - * The total elements in the database. - */ - private long totalElements; - - /** - * The page index. - */ - private int number; - - /** - * The page size. - */ - private int size; - - /** - * The number of pages. - */ - private long totalPages; - - /** - * The data stream. - */ - private List stream; - - public long getTotalElements() { - return totalElements; - } - - public void setTotalElements(long totalElements) { - this.totalElements = totalElements; - } - - public int getNumber() { - return number; - } - - public void setNumber(int number) { - this.number = number; - } - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - public long getTotalPages() { - return totalPages; - } - - public void setTotalPages(long totalPages) { - this.totalPages = totalPages; - } - - public List getStream() { - return stream; - } - - public void setStream(List stream) { - this.stream = stream; - } -} diff --git a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/RestExceptionDTO.java b/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/RestExceptionDTO.java deleted file mode 100644 index ace2728f..00000000 --- a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/RestExceptionDTO.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2020 tkit.org. - * - * 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 - * - * http://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 org.tkit.quarkus.rs.models; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import io.quarkus.runtime.annotations.RegisterForReflection; - -/** - * The rest exception DTO model. - */ -@Deprecated -@RegisterForReflection -public class RestExceptionDTO { - - /** - * The error code. - */ - private String errorCode; - - /** - * The message. - */ - private String message; - - /** - * The error parameters. - */ - private List parameters; - - /** - * The named parameters. - */ - private Map namedParameters = new HashMap<>(); - - public String getErrorCode() { - return errorCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public List getParameters() { - return parameters; - } - - public void setParameters(List parameters) { - this.parameters = parameters; - } - - public Map getNamedParameters() { - return namedParameters; - } - - public void setNamedParameters(Map namedParameters) { - this.namedParameters = namedParameters; - } -} diff --git a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/TraceableDTO.java b/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/TraceableDTO.java deleted file mode 100644 index 6fea9f98..00000000 --- a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/models/TraceableDTO.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2020 tkit.org. - * - * 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 - * - * http://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 org.tkit.quarkus.rs.models; - -import java.util.Objects; -import java.util.UUID; - -import io.quarkus.runtime.annotations.RegisterForReflection; - -/** - * The persistent entity with string GUID. - */ -@Deprecated -@RegisterForReflection -public class TraceableDTO extends AbstractTraceableDTO { - - /** - * The UID for this class. - */ - private static final long serialVersionUID = 3699279519938221976L; - - /** - * The ID. - */ - private String id = UUID.randomUUID().toString(); - - /** - * {@inheritDoc } - */ - @Override - public String getId() { - return id; - } - - /** - * {@inheritDoc } - */ - @Override - public void setId(String id) { - this.id = id; - } - - /** - * {@inheritDoc } - * - * @see Object#equals(Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - TraceableDTO other = (TraceableDTO) obj; - Object guid = getId(); - Object otherGuid = other.getId(); - - if (guid == null) { - if (otherGuid != null) { - return false; - } else { - return super.equals(obj); - } - } else if (!guid.equals(otherGuid)) { - return false; - } - - return true; - } - - /** - * {@inheritDoc } - * - * @see Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + Objects.hashCode(getId()); - return result; - } -} diff --git a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/resources/ResourceManager.java b/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/resources/ResourceManager.java deleted file mode 100644 index c8b042c2..00000000 --- a/extensions/rest-dto/src/main/java/org/tkit/quarkus/rs/resources/ResourceManager.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.tkit.quarkus.rs.resources; - -import java.text.MessageFormat; -import java.util.List; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.microprofile.config.ConfigProvider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.tkit.quarkus.rs.exceptions.RestException; - -/** - * The resource manager for messages. - */ -@Deprecated -public class ResourceManager { - - private static final Logger log = LoggerFactory.getLogger(ResourceManager.class); - - /** - * The quarkus config variable for default locale. - */ - private static final String QUARKUS_DEFAULT_LOCALE = "quarkus.default-locale"; - - /** - * The quarkus default locale. - */ - private static final Locale DEFAULT_LOCALE = new Locale( - ConfigProvider.getConfig() - .getOptionalValue(QUARKUS_DEFAULT_LOCALE, String.class) - .orElse(Locale.ENGLISH.getLanguage())); - - private ResourceManager() { - } - - /** - * Gets the message for the enum key and parameters - * - * @param key the {@link RestException} - * @param locale the locale - * @param params the list of parameters. - * @return the corresponding message. - */ - public static String getMessage(Enum key, Locale locale, List params) { - String resourceBundleName = key.getClass().getSimpleName(); - ClassLoader classLoader = key.getClass().getClassLoader(); - - ResourceBundle bundle = null; - if (locale != null) { - bundle = getBundle(resourceBundleName, locale, classLoader); - } - if (bundle == null) { - locale = DEFAULT_LOCALE; - bundle = getBundle(resourceBundleName, locale, classLoader); - } - if (bundle == null) { - return key.name() + params; - } - - String tr = bundle.getString(key.name()); - if (params == null || params.isEmpty()) { - return tr; - } - - MessageFormat msgFormat = new MessageFormat(tr, locale); - StringBuffer bf = msgFormat.format(params.toArray(), new StringBuffer(), null); - return bf.toString(); - } - - /** - * Gets the resource bundle for the bundle name and locale. - * - * @param bundleName the bundle name. - * @param locale the locale. - * @param loader the class-loader. - * @return corresponding resoruce bundle or {@code null}. - */ - private static ResourceBundle getBundle(final String bundleName, final Locale locale, final ClassLoader loader) { - try { - if (loader != null && locale != null) { - return ResourceBundle.getBundle(bundleName, locale, loader); - } else if (locale != null) { - return ResourceBundle.getBundle(bundleName, locale); - } else { - return ResourceBundle.getBundle(bundleName); - } - } catch (MissingResourceException e) { - log.debug("Error loading the bundle {} for the locale {}", bundleName, locale); - } - return null; - } - -} diff --git a/extensions/rest-dto/src/main/resources/META-INF/beans.xml b/extensions/rest-dto/src/main/resources/META-INF/beans.xml deleted file mode 100644 index e69de29b..00000000