-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ce500e
commit 0106f2f
Showing
14 changed files
with
362 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: Create new build | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
uses: onecx/ci-common/.github/workflows/create-new-build.yml@v1 | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
FROM registry.access.redhat.com/ubi9/openjdk-17:1.14 | ||
FROM registry.access.redhat.com/ubi9/openjdk-17:1.15 | ||
|
||
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' | ||
ENV LANGUAGE='en_US:en' | ||
|
||
# We make four distinct layers so if there are application changes the library layers can be re-used | ||
COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/ | ||
COPY --chown=1001 target/quarkus-app/*.jar /deployments/ | ||
COPY --chown=1001 target/quarkus-app/app/ /deployments/app/ | ||
COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/ | ||
COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ | ||
COPY --chown=185 target/quarkus-app/*.jar /deployments/ | ||
COPY --chown=185 target/quarkus-app/app/ /deployments/app/ | ||
COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ | ||
|
||
EXPOSE 8080 | ||
USER 1001 | ||
USER 185 | ||
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" | ||
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" | ||
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.2 | ||
WORKDIR /work/ | ||
RUN chown 1001 /work \ | ||
&& chmod "g+rwX" /work \ | ||
&& chown 1001:root /work | ||
COPY --chown=1001:root target/*-runner /work/application | ||
|
||
EXPOSE 8080 | ||
USER 1001 | ||
|
||
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
app: | ||
image: | ||
repository: "1000kit/${project.artifactId}" | ||
tag: 999-SNAPSHOT | ||
repository: "onecx/ping-quarkus" | ||
db: | ||
enabled: false | ||
livenessProbe: | ||
url: /health | ||
readinessProbe: | ||
url: /health | ||
enabled: true | ||
|
88 changes: 88 additions & 0 deletions
88
src/main/java/org/tkit/quarkus/hello/domain/daos/ThemeDAO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package org.tkit.quarkus.hello.domain.daos; | ||
|
||
import java.util.Set; | ||
import java.util.stream.Stream; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.persistence.NoResultException; | ||
import jakarta.transaction.Transactional; | ||
|
||
import org.tkit.quarkus.hello.domain.models.Theme; | ||
import org.tkit.quarkus.hello.domain.models.Theme_; | ||
import org.tkit.quarkus.jpa.daos.AbstractDAO; | ||
import org.tkit.quarkus.jpa.daos.Page; | ||
import org.tkit.quarkus.jpa.daos.PageResult; | ||
import org.tkit.quarkus.jpa.exceptions.DAOException; | ||
import org.tkit.quarkus.jpa.models.TraceableEntity_; | ||
|
||
@ApplicationScoped | ||
public class ThemeDAO extends AbstractDAO<Theme> { | ||
|
||
// https://hibernate.atlassian.net/browse/HHH-16830#icft=HHH-16830 | ||
@Override | ||
public Theme findById(Object id) throws DAOException { | ||
try { | ||
var cb = this.getEntityManager().getCriteriaBuilder(); | ||
var cq = cb.createQuery(Theme.class); | ||
var root = cq.from(Theme.class); | ||
cq.where(cb.equal(root.get(TraceableEntity_.ID), id)); | ||
return this.getEntityManager().createQuery(cq).getSingleResult(); | ||
} catch (NoResultException nre) { | ||
return null; | ||
} catch (Exception e) { | ||
throw new DAOException(ErrorKeys.FIND_ENTITY_BY_ID_FAILED, e, entityName, id); | ||
} | ||
} | ||
|
||
@Transactional(Transactional.TxType.SUPPORTS) | ||
public Stream<Theme> findThemeByNames(Set<String> themeNames) { | ||
try { | ||
var cb = this.getEntityManager().getCriteriaBuilder(); | ||
var cq = cb.createQuery(Theme.class); | ||
var root = cq.from(Theme.class); | ||
|
||
if (themeNames != null && !themeNames.isEmpty()) { | ||
cq.where(root.get(Theme_.name).in(themeNames)); | ||
} | ||
return this.getEntityManager().createQuery(cq).getResultStream(); | ||
|
||
} catch (Exception ex) { | ||
throw new DAOException(ErrorKeys.ERROR_FIND_THEME_BY_NAMES, ex); | ||
} | ||
} | ||
|
||
public PageResult<Theme> findAll(Integer pageNumber, Integer pageSize) { | ||
try { | ||
var cb = this.getEntityManager().getCriteriaBuilder(); | ||
var cq = cb.createQuery(Theme.class); | ||
cq.from(Theme.class); | ||
return createPageQuery(cq, Page.of(pageNumber, pageSize)).getPageResult(); | ||
} catch (Exception ex) { | ||
throw new DAOException(ErrorKeys.ERROR_FIND_ALL_THEME_PAGE, ex); | ||
} | ||
} | ||
|
||
public Theme findThemeByName(String themeName) { | ||
try { | ||
var cb = this.getEntityManager().getCriteriaBuilder(); | ||
var cq = cb.createQuery(Theme.class); | ||
var root = cq.from(Theme.class); | ||
cq.where(cb.equal(root.get(Theme_.name), themeName)); | ||
|
||
return this.getEntityManager().createQuery(cq).getSingleResult(); | ||
|
||
} catch (NoResultException nre) { | ||
return null; | ||
} catch (Exception ex) { | ||
throw new DAOException(ErrorKeys.ERROR_FIND_THEME_BY_NAME, ex); | ||
} | ||
} | ||
|
||
public enum ErrorKeys { | ||
|
||
FIND_ENTITY_BY_ID_FAILED, | ||
ERROR_FIND_ALL_THEME_PAGE, | ||
ERROR_FIND_THEME_BY_NAMES, | ||
ERROR_FIND_THEME_BY_NAME, | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/org/tkit/quarkus/hello/domain/models/Theme.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.tkit.quarkus.hello.domain.models; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import jakarta.persistence.*; | ||
|
||
import org.hibernate.annotations.TenantId; | ||
import org.tkit.quarkus.jpa.models.TraceableEntity; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@Entity | ||
@Table(name = "THEME", uniqueConstraints = { | ||
@UniqueConstraint(name = "THEME_NAME", columnNames = { "NAME", "TENANT_ID" }) | ||
}) | ||
@SuppressWarnings("java:S2160") | ||
public class Theme extends TraceableEntity { | ||
|
||
@Column(name = "NAME") | ||
private String name; | ||
|
||
@TenantId | ||
@Column(name = "TENANT_ID") | ||
private String tenantId; | ||
|
||
@Column(name = "CSS_FILE") | ||
private String cssFile; | ||
|
||
@Column(name = "DESCRIPTION") | ||
private String description; | ||
|
||
@Column(name = "ASSETS_URL") | ||
private String assetsUrl; | ||
|
||
@Column(name = "LOGO_URL") | ||
private String logoUrl; | ||
|
||
@Column(name = "FAVICON_URL") | ||
private String faviconUrl; | ||
|
||
@Column(name = "PREVIEW_IMAGE_URL") | ||
private String previewImageUrl; | ||
|
||
@Column(name = "ASSETS_UPDATE_DATE") | ||
private LocalDateTime assetsUpdateDate; | ||
|
||
@Column(name = "PROPERTIES", columnDefinition = "TEXT") | ||
private String properties; | ||
} |
12 changes: 6 additions & 6 deletions
12
src/main/java/org/tkit/quarkus/hello/rs/HelloRestController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
# container image for local dev | ||
quarkus.container-image.group=localhost | ||
|
||
tkit.dataimport.enabled=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> | ||
|
||
<include relativeToChangelogFile="true" file="v1/2023-11-09-create-tables.xml"/> | ||
<include relativeToChangelogFile="true" file="v1/2023-11-09-data-import-log.xml"/> | ||
|
||
</databaseChangeLog> |
Oops, something went wrong.