Skip to content

Commit

Permalink
feat: added new endpoint for remotecomponent
Browse files Browse the repository at this point in the history
  • Loading branch information
JordenReuter committed Sep 17, 2024
1 parent 3c62539 commit d2dec8b
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 51 deletions.
72 changes: 36 additions & 36 deletions docs/modules/onecx-help-svc/pages/onecx-help-svc-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,158 +12,158 @@ h| Version

| https://onecx.github.io/docs/onecx-quarkus/current/onecx-quarkus/onecx-core.html[Link]
|
| 0.24.0
| 0.30.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.30.0/docs/modules/onecx-quarkus/pages/includes/onecx-tenant.adoc[Link]
| 0.30.0

| 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.14.4
| 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.32.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest-context.adoc[Link]
| 2.32.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.32.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa-tenant.adoc[Link]
| 2.32.0
| tkit-quarkus-data-import
| https://1000kit.github.io/tkit-quarkus/current/tkit-quarkus/tkit-quarkus-data-import.html[Link]
| https://github.com/1000kit/tkit-quarkus/blob/2.28.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-data-import.adoc[Link]
| 2.28.0
| https://github.com/1000kit/tkit-quarkus/blob/2.32.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-data-import.adoc[Link]
| 2.32.0
| 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.32.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-jpa.adoc[Link]
| 2.32.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.32.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-cdi.adoc[Link]
| 2.32.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.32.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-rs.adoc[Link]
| 2.32.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.32.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-log-json.adoc[Link]
| 2.32.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.32.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-rest.adoc[Link]
| 2.32.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.14.4
| 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.14.4
| 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.14.4
| 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.14.4
| 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.14.4
| quarkus-rest
| https://quarkus.io/guides/rest[Link]
| https://github.com/quarkusio/quarkusio.github.io/blob/develop/_generated-doc/latest/config/quarkus-rest.adoc[Link]
| 3.12.2
| 3.14.4
| quarkus-rest-jackson
| https://quarkus.io/guides/rest-json[Link]
|
| 3.12.2
| 3.14.4
| 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.14.4
| 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.14.4
| 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.14.4
| 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.14.4
| 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.32.0/docs/modules/tkit-quarkus/pages/includes/tkit-quarkus-security.adoc[Link]
| 2.32.0
| 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.14.4
| onecx-security
|
|
| 0.24.0
| 0.30.0
| quarkus-smallrye-context-propagation
|
|
| 3.12.2
| 3.14.4
|===
32 changes: 17 additions & 15 deletions docs/modules/onecx-help-svc/pages/onecx-help-svc.adoc
Original file line number Diff line number Diff line change
@@ -1,63 +1,65 @@

:summaryTableId: onecx-help-svc
[.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"]
|===

h|[[onecx-help-svc_configuration]]link:#onecx-help-svc_configuration[Configuration property]

h|[.header-title]##Configuration property##
h|Type
h|Default

a| [[onecx-help-svc_onecx-help-default-enabled]]`link:#onecx-help-svc_onecx-help-default-enabled[onecx.help.default.enabled]`

a| [[onecx-help-svc_onecx-help-default-enabled]] [.property-path]##`onecx.help.default.enabled`##

[.description]
--
Enable or disable default help


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++ONECX_HELP_DEFAULT_ENABLED+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++ONECX_HELP_DEFAULT_ENABLED+++`
endif::add-copy-button-to-env-var[]
--|boolean
--
|boolean
|`false`


a| [[onecx-help-svc_onecx-help-default-url]]`link:#onecx-help-svc_onecx-help-default-url[onecx.help.default.url]`

a| [[onecx-help-svc_onecx-help-default-url]] [.property-path]##`onecx.help.default.url`##

[.description]
--
Default help URL


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++ONECX_HELP_DEFAULT_URL+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++ONECX_HELP_DEFAULT_URL+++`
endif::add-copy-button-to-env-var[]
--|string
--
|string
|`https://github.com/onecx`


a| [[onecx-help-svc_onecx-help-product-item-id]]`link:#onecx-help-svc_onecx-help-product-item-id[onecx.help.product-item-id]`

a| [[onecx-help-svc_onecx-help-product-item-id]] [.property-path]##`onecx.help.product-item-id`##

[.description]
--
Default help URL


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++ONECX_HELP_PRODUCT_ITEM_ID+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++ONECX_HELP_PRODUCT_ITEM_ID+++`
endif::add-copy-button-to-env-var[]
--|string
--
|string
|`PRODUCT_BASE_DOC_URL`

|===
|===


:!summaryTableId:
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.tkit.onecx.help.domain.criteria;

import io.quarkus.runtime.annotations.RegisterForReflection;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@RegisterForReflection
public class HelpCurrentSearchCriteria {

private String itemId;

private String productName;

}
30 changes: 30 additions & 0 deletions src/main/java/org/tkit/onecx/help/domain/daos/HelpDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import jakarta.persistence.criteria.Root;
import jakarta.transaction.Transactional;

import org.tkit.onecx.help.domain.criteria.HelpCurrentSearchCriteria;
import org.tkit.onecx.help.domain.criteria.HelpSearchCriteria;
import org.tkit.onecx.help.domain.models.Help;
import org.tkit.onecx.help.domain.models.Help_;
Expand Down Expand Up @@ -122,6 +123,35 @@ public Stream<Help> loadAll() {
}
}

public Help findCurrentHelpByCriteria(HelpCurrentSearchCriteria criteria) {
try {
var cb = this.getEntityManager().getCriteriaBuilder();
var cq = cb.createQuery(Help.class);
var root = cq.from(Help.class);

cq.where(cb.and(
cb.equal(root.get(Help_.productName), criteria.getProductName()),
cb.equal(root.get(Help_.itemId), criteria.getItemId())));
return this.getEntityManager().createQuery(cq).getSingleResult();
} catch (NoResultException ne) {
try {
var cb = this.getEntityManager().getCriteriaBuilder();
var cq = cb.createQuery(Help.class);
var root = cq.from(Help.class);

cq.where(cb.and(
cb.equal(root.get(Help_.productName), criteria.getProductName()),
cb.equal(root.get(Help_.itemId), "PRODUCT_BASE_DOC_URL")));
return this.getEntityManager().createQuery(cq).getSingleResult();

} catch (NoResultException noResultException) {
return null;
}
} catch (Exception ex) {
throw new DAOException(ErrorKeys.ERROR_GET_BY_PRODUCT_CRITERIA, ex);
}
}

public enum ErrorKeys {

ERROR_LOAD_ALL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ public Response getHelpByProductNameItemId(String productName, String helpItemId
return Response.status(Response.Status.NOT_FOUND).build();
}

@Override
public Response searchCurrentHelp(HelpCurrentSearchCriteriaDTO helpCurrentSearchCriteriaDTO) {
var criteria = mapper.map(helpCurrentSearchCriteriaDTO);
var result = dao.findCurrentHelpByCriteria(criteria);
if (result == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
return Response.ok(mapper.map(result)).build();
}

@ServerExceptionMapper
public RestResponse<ProblemDetailResponseDTO> exception(ConstraintException ex) {
return exceptionMapper.exception(ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.tkit.onecx.help.domain.criteria.HelpCurrentSearchCriteria;
import org.tkit.onecx.help.domain.criteria.HelpSearchCriteria;
import org.tkit.onecx.help.domain.models.Help;
import org.tkit.quarkus.jpa.daos.PageResult;
Expand Down Expand Up @@ -68,4 +69,5 @@ default HelpProductNamesDTO map(List<String> productNames) {
return productNamesDTO;
}

HelpCurrentSearchCriteria map(HelpCurrentSearchCriteriaDTO helpCurrentSearchCriteriaDTO);
}
Loading

0 comments on commit d2dec8b

Please sign in to comment.