Skip to content

Commit

Permalink
feat: remove v1, add new endpoint load (#39)
Browse files Browse the repository at this point in the history
* feat: remove v1, add new endpoint load

* fix: revert dev security

* fix: liquibase fix
  • Loading branch information
jsteenke authored Aug 22, 2024
1 parent d6d898c commit 6ee6f05
Show file tree
Hide file tree
Showing 21 changed files with 202 additions and 1,349 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,146 +11,146 @@ h| Version
| tkit-quarkus-jpa

| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-jpa.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa.adoc[Link]
| 2.28.0
| https://github.com/1000kit/tkit-quarkus/blob/2.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa.adoc[Link]
| 2.31.0

| tkit-quarkus-log-cdi

| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-cdi.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
| 2.28.0
| https://github.com/1000kit/tkit-quarkus/blob/2.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
| 2.31.0

| tkit-quarkus-log-rs

| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-rs.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
| 2.28.0
| https://github.com/1000kit/tkit-quarkus/blob/2.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
| 2.31.0

| tkit-quarkus-log-json

| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-log-json.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
| 2.28.0
| https://github.com/1000kit/tkit-quarkus/blob/2.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
| 2.31.0

| tkit-quarkus-rest

| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-rest.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
| 2.28.0
| https://github.com/1000kit/tkit-quarkus/blob/2.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
| 2.31.0

| onecx-tenant

| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-tenant.html[Link]
| https://github.com/onecx/onecx-quarkus/blob/0.24.0/docs/modules/onecx-quarkus/pages/includes/onecx-tenant.adoc[Link]
| 0.24.0
| https://github.com/onecx/onecx-quarkus/blob/0.26.0/docs/modules/onecx-quarkus/pages/includes/onecx-tenant.adoc[Link]
| 0.26.0

| tkit-quarkus-jpa-tenant

| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-jpa-tenant.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa-tenant.adoc[Link]
| 2.28.0
| https://github.com/1000kit/tkit-quarkus/blob/2.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa-tenant.adoc[Link]
| 2.31.0

| tkit-quarkus-rest-context

| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-rest-context.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
| 2.28.0
| https://github.com/1000kit/tkit-quarkus/blob/2.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
| 2.31.0

| quarkus-liquibase

| https://quarkus.io/guides/liquibase[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-liquibase.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-smallrye-health
| https://quarkus.io/guides/smallrye-health[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-smallrye-health.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-micrometer-registry-prometheus
| https://quarkus.io/guides/telemetry-micrometer[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-micrometer-registry-prometheus.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-hibernate-orm
| https://quarkus.io/guides/hibernate-orm[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-hibernate-orm.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-resteasy-reactive
| https://quarkus.io/guides/resteasy-reactive[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-resteasy-reactive.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-resteasy-reactive-jackson
| https://quarkus.io/guides/rest-json[Link]
|
| 3.12.2
| 3.13.2
| quarkus-hibernate-validator
| https://quarkus.io/guides/validation[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-hibernate-validator.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-jdbc-postgresql
| https://quarkus.io/guides/datasource[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-jdbc-postgresql.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-smallrye-openapi
| https://quarkus.io/guides/openapi-swaggerui[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-smallrye-openapi.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-smallrye-jwt
| https://quarkus.io/guides/security-jwt-build[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-smallrye-jwt.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-oidc
| https://quarkus.io/guides/security-oidc-bearer-token-authentication-tutorial[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-oidc.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-opentelemetry
| https://quarkus.io/guides/opentelemetry[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-opentelemetry.adoc[Link]
| 3.12.2
| 3.13.2
| tkit-quarkus-security
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-security.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
| 2.28.0
| https://github.com/1000kit/tkit-quarkus/blob/2.31.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
| 2.31.0
| onecx-core
| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-core.html[Link]
|
| 0.24.0
| 0.26.0
| quarkus-arc
| https://quarkus.io/guides/cdi-reference[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-arc.adoc[Link]
| 3.12.2
| 3.13.2
| quarkus-container-image-docker
| https://quarkus.io/guides/container-image[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-container-image-docker.adoc[Link]
| 3.12.2
| 3.13.2
Expand Down
14 changes: 0 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,6 @@
<modelPackage>gen.org.tkit.onecx.search.config.rs.internal.model</modelPackage>
</configuration>
</execution>
<execution>
<id>v1</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>src/main/openapi/search-config-openapi-v1.yaml</inputSpec>
<apiPackage>gen.org.tkit.onecx.search.config.v1</apiPackage>
<modelPackage>gen.org.tkit.onecx.search.config.v1.model</modelPackage>
<apiNameSuffix>V1Api</apiNameSuffix>
<modelNameSuffix>DTOV1</modelNameSuffix>
<skipValidateSpec>true</skipValidateSpec>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@Setter
public class SearchConfigCriteria {

private String configId;
private String productName;
private String name;
private String appId;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.tkit.onecx.search.config.domain.criteria;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class SearchConfigLoadCriteria {

private String productName;
private String appId;
private String page;

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.persistence.NoResultException;
import jakarta.persistence.TypedQuery;
import jakarta.persistence.criteria.Predicate;

import org.tkit.onecx.search.config.domain.criteria.SearchConfigCriteria;
import org.tkit.onecx.search.config.domain.criteria.SearchConfigLoadCriteria;
import org.tkit.onecx.search.config.domain.models.SearchConfig;
import org.tkit.onecx.search.config.domain.models.SearchConfig_;
import org.tkit.quarkus.jpa.daos.AbstractDAO;
Expand Down Expand Up @@ -39,20 +41,6 @@ public SearchConfig findById(Object id) throws DAOException {
}
}

public SearchConfig findByConfigId(Object configId) throws DAOException {
try {
var cb = this.getEntityManager().getCriteriaBuilder();
var cq = cb.createQuery(SearchConfig.class);
var root = cq.from(SearchConfig.class);
cq.where(cb.equal(root.get(SearchConfig_.CONFIG_ID), configId));
return this.getEntityManager().createQuery(cq).getSingleResult();
} catch (NoResultException nre) {
return null;
} catch (Exception e) {
throw new DAOException(ErrorKeys.FIND_SEARCH_CONFIG_BY_CONFIG_ID_FAILED, e, entityName, configId);
}
}

public PageResult<SearchConfig> findBySearchCriteria(SearchConfigCriteria searchCriteria) {

try {
Expand All @@ -61,8 +49,6 @@ public PageResult<SearchConfig> findBySearchCriteria(SearchConfigCriteria search
var searchConfigRoot = criteriaQuery.from(SearchConfig.class);

List<Predicate> predicates = new ArrayList<>();
addSearchStringPredicate(predicates, criteriaBuilder, searchConfigRoot.get(SearchConfig_.CONFIG_ID),
searchCriteria.getConfigId());
addSearchStringPredicate(predicates, criteriaBuilder, searchConfigRoot.get(SearchConfig_.PRODUCT_NAME),
searchCriteria.getProductName());
addSearchStringPredicate(predicates, criteriaBuilder, searchConfigRoot.get(SearchConfig_.APP_ID),
Expand All @@ -83,10 +69,37 @@ public PageResult<SearchConfig> findBySearchCriteria(SearchConfigCriteria search
}
}

public List<SearchConfig> findByProductAppAndPage(SearchConfigLoadCriteria loadCriteria) {

try {
var criteriaBuilder = getEntityManager().getCriteriaBuilder();
var criteriaQuery = criteriaBuilder.createQuery(SearchConfig.class);
var searchConfigRoot = criteriaQuery.from(SearchConfig.class);

List<Predicate> predicates = new ArrayList<>();
addSearchStringPredicate(predicates, criteriaBuilder, searchConfigRoot.get(SearchConfig_.PRODUCT_NAME),
loadCriteria.getProductName());
addSearchStringPredicate(predicates, criteriaBuilder, searchConfigRoot.get(SearchConfig_.APP_ID),
loadCriteria.getAppId());
addSearchStringPredicate(predicates, criteriaBuilder, searchConfigRoot.get(SearchConfig_.PAGE),
loadCriteria.getPage());

if (!predicates.isEmpty()) {
criteriaQuery.where(predicates.toArray(new Predicate[] {}));
}

TypedQuery<SearchConfig> query = em.createQuery(criteriaQuery);
return query.getResultList();
} catch (Exception exception) {
throw new DAOException(ErrorKeys.FIND_SEARCH_CONFIGS_BY_PRODUCT_APP_PAGE_FAILED, exception);
}
}

public enum ErrorKeys {

FIND_SEARCH_CONFIG_BY_CONFIG_ID_FAILED,
FIND_SEARCH_CONFIGS_BY_CRITERIA_FAILED,
FIND_SEARCH_CONFIGS_BY_PRODUCT_APP_PAGE_FAILED,
FIND_SEARCH_CONFIG_BY_ID_FAILED
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.tkit.onecx.search.config.domain.models;

import java.util.UUID;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
Expand All @@ -16,15 +14,12 @@
@Setter
@Entity
@Table(name = "search_config", uniqueConstraints = {
@UniqueConstraint(name = "search_config_id", columnNames = { "config_id" }),
@UniqueConstraint(name = "ck_config", columnNames = { "name", "product_name", "page", "appId", "tenant_id" })
@UniqueConstraint(name = "uc_search_config_product_app_page_name", columnNames = { "product_name", "appId", "page",
"name", "tenant_id" })
})
@SuppressWarnings("java:S2160")
public class SearchConfig extends TraceableEntity {

@Column(name = "config_id")
private String configId = UUID.randomUUID().toString();

@Column(name = "product_name")
private String productName;
@Column
Expand All @@ -35,13 +30,13 @@ public class SearchConfig extends TraceableEntity {
private String appId;
@Column
private int fieldListVersion;
@Column
@Column(length = 1000)
private String values;
@Column(name = "read_only")
private boolean readOnly;
@Column(name = "advanced")
private boolean advanced;
@Column(name = "columns")
@Column(name = "columns", length = 1000)
private String columns;
@TenantId
@Column(name = "tenant_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public Response findBySearchCriteria(SearchConfigSearchRequestDTO searchConfigSe
return Response.ok().entity(mapper.map(results)).build();
}

@Override
public Response loadByProductAppAndPage(SearchConfigLoadRequestDTO searchConfigLoadRequestDTO) {
var results = dao.findByProductAppAndPage(mapper.map(searchConfigLoadRequestDTO));
return Response.ok().entity(mapper.mapToSearchConfigLoadResultList(results)).build();
}

@Override
public Response getConfigById(String id) {
var searchConfig = dao.findById(id);
Expand Down
Loading

0 comments on commit 6ee6f05

Please sign in to comment.