diff --git a/arlas-persistence-core/src/main/java/io/arlas/persistence/server/app/ArlasPersistenceServerConfiguration.java b/arlas-persistence-core/src/main/java/io/arlas/persistence/server/app/ArlasPersistenceServerConfiguration.java index 9f0bb87..1fccf91 100644 --- a/arlas-persistence-core/src/main/java/io/arlas/persistence/server/app/ArlasPersistenceServerConfiguration.java +++ b/arlas-persistence-core/src/main/java/io/arlas/persistence/server/app/ArlasPersistenceServerConfiguration.java @@ -23,8 +23,8 @@ import io.arlas.commons.exceptions.ArlasConfigurationException; import io.arlas.commons.rest.utils.ServerConstants; import io.dropwizard.db.DataSourceFactory; - import jakarta.validation.Valid; + import java.util.Arrays; import java.util.List; diff --git a/arlas-persistence-core/src/main/java/io/arlas/persistence/server/impl/HibernatePersistenceServiceImpl.java b/arlas-persistence-core/src/main/java/io/arlas/persistence/server/impl/HibernatePersistenceServiceImpl.java index 7e8b2d8..0374f4d 100644 --- a/arlas-persistence-core/src/main/java/io/arlas/persistence/server/impl/HibernatePersistenceServiceImpl.java +++ b/arlas-persistence-core/src/main/java/io/arlas/persistence/server/impl/HibernatePersistenceServiceImpl.java @@ -32,6 +32,8 @@ import org.apache.commons.lang3.tuple.Pair; import org.hibernate.SessionFactory; import org.hibernate.query.Query; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.*; import java.util.stream.Collectors; @@ -39,6 +41,7 @@ import static io.arlas.filter.config.TechnicalRoles.GROUP_PUBLIC; public class HibernatePersistenceServiceImpl extends AbstractDAO implements PersistenceService { + protected static Logger LOGGER = LoggerFactory.getLogger(HibernatePersistenceServiceImpl.class); public HibernatePersistenceServiceImpl(SessionFactory factory) { super(factory); @@ -48,10 +51,10 @@ public HibernatePersistenceServiceImpl(SessionFactory factory) { public Pair> list(String zone, IdentityParam identityParam, Integer size, Integer page, SortOrder order) { String from = " from Data ud " + " where ud." + Data.zoneColumn + "=:zone" - + " and (ud." + Data.organizationColumn + " in :organization" + + " and ((ud." + Data.organizationColumn + " in :organization" + " and (ud." + Data.ownerColumn + "=:userId" + " or " + getGroupsRequest(identityParam.groups) + "))" - + " or (" + getGroupsRequest(List.of(GROUP_PUBLIC)) + ")"; + + " or (" + getGroupsRequest(List.of(GROUP_PUBLIC)) + "))"; Long totalCount = currentSession().createQuery("SELECT count(ud) " + from, Long.class) .setParameter("zone", zone) diff --git a/arlas-persistence-core/src/main/java/io/arlas/persistence/server/model/Data.java b/arlas-persistence-core/src/main/java/io/arlas/persistence/server/model/Data.java index 9c887b3..4549d21 100644 --- a/arlas-persistence-core/src/main/java/io/arlas/persistence/server/model/Data.java +++ b/arlas-persistence-core/src/main/java/io/arlas/persistence/server/model/Data.java @@ -21,13 +21,12 @@ import io.dropwizard.jackson.JsonSnakeCase; import io.hypersistence.utils.hibernate.type.json.JsonBinaryType; -import io.hypersistence.utils.hibernate.type.json.JsonType; +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.hibernate.annotations.Type; -import jakarta.persistence.*; -import jakarta.validation.constraints.NotNull; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/arlas-persistence-rest/src/main/java/io/arlas/persistence/rest/DataHALService.java b/arlas-persistence-rest/src/main/java/io/arlas/persistence/rest/DataHALService.java index 6097fa9..474c40d 100644 --- a/arlas-persistence-rest/src/main/java/io/arlas/persistence/rest/DataHALService.java +++ b/arlas-persistence-rest/src/main/java/io/arlas/persistence/rest/DataHALService.java @@ -25,9 +25,9 @@ import io.arlas.persistence.model.Link; import io.arlas.persistence.server.model.Data; import io.arlas.persistence.server.utils.SortOrder; +import jakarta.ws.rs.core.UriInfo; import org.apache.commons.lang3.tuple.Pair; -import jakarta.ws.rs.core.UriInfo; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/arlas-persistence-rest/src/main/java/io/arlas/persistence/rest/PersistenceRestService.java b/arlas-persistence-rest/src/main/java/io/arlas/persistence/rest/PersistenceRestService.java index 8c7f7c1..211e601 100644 --- a/arlas-persistence-rest/src/main/java/io/arlas/persistence/rest/PersistenceRestService.java +++ b/arlas-persistence-rest/src/main/java/io/arlas/persistence/rest/PersistenceRestService.java @@ -47,13 +47,13 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.servers.Server; import io.swagger.v3.oas.annotations.tags.Tag; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.*; import jakarta.ws.rs.core.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.*; @Path("/persist") diff --git a/docker/docker-files/docker-compose.yml b/docker/docker-files/docker-compose.yml index 930cb88..395ab74 100644 --- a/docker/docker-files/docker-compose.yml +++ b/docker/docker-files/docker-compose.yml @@ -1,6 +1,6 @@ services: db: - image: postgres + image: postgres:16.3 container_name: db restart: always environment: @@ -29,6 +29,8 @@ services: container_name: arlas-persistence-server restart: always environment: + - ARLAS_PERSISTENCE_LOGGING_LEVEL=${ARLAS_PERSISTENCE_LOGGING_LEVEL:-INFO} + - ARLAS_PERSISTENCE_LOGGING_CONSOLE_LEVEL=${ARLAS_PERSISTENCE_LOGGING_CONSOLE_LEVEL:-TRACE} - ARLAS_PERSISTENCE_HOST="${ARLAS_PERSISTENCE_HOST:-localhost}" - ARLAS_PERSISTENCE_PORT="${ARLAS_PERSISTENCE_PORT:-9997}" - ARLAS_PERSISTENCE_PREFIX="${ARLAS_PERSISTENCE_PREFIX:-/arlas_persistence_server}" @@ -48,7 +50,7 @@ services: - ARLAS_PERSISTENCE_HIBERNATE_PASSWORD="${ARLAS_PERSISTENCE_HIBERNATE_PASSWORD:-iAMs00perSecrEET}" - ARLAS_PERSISTENCE_HIBERNATE_DRIVER="${ARLAS_PERSISTENCE_HIBERNATE_DRIVER:-org.postgresql.Driver}" - ARLAS_PERSISTENCE_HIBERNATE_DIALECT="${ARLAS_PERSISTENCE_HIBERNATE_DIALECT:-org.hibernate.dialect.PostgreSQLDialect}" - - ARLAS_PERSISTENCE_HIBERNATE_HBM2DDL="${ARLAS_PERSISTENCE_HIBERNATE_HBM2DDL:-update}" + - ARLAS_PERSISTENCE_HIBERNATE_HBM2DDL="${ARLAS_PERSISTENCE_HIBERNATE_HBM2DDL:-create-only}" - GOOGLE_APPLICATION_CREDENTIALS=/opt/app/google-registry.json ports: - "19997:9997" # !EXPOSE!