From d2128fcac86c2ae95989954b14a89ab35cf4d734 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 17 Jan 2024 20:21:02 +0100 Subject: [PATCH] [DEV] update new archidata --- back/pom.xml | 2 +- back/src/org/kar/karideo/api/HealthCheck.java | 8 ++++---- back/src/org/kar/karideo/api/SeasonResource.java | 5 +++-- back/src/org/kar/karideo/api/SeriesResource.java | 5 +++-- back/src/org/kar/karideo/api/TypeResource.java | 5 +++-- .../org/kar/karideo/api/UserMediaAdvancementResource.java | 5 +++-- back/src/org/kar/karideo/api/VideoResource.java | 2 +- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/back/pom.xml b/back/pom.xml index d7bf9a9..406076d 100644 --- a/back/pom.xml +++ b/back/pom.xml @@ -20,7 +20,7 @@ kangaroo-and-rabbit archidata - 0.5.0 + 0.6.0 org.slf4j diff --git a/back/src/org/kar/karideo/api/HealthCheck.java b/back/src/org/kar/karideo/api/HealthCheck.java index 44fbb6c..08ae844 100644 --- a/back/src/org/kar/karideo/api/HealthCheck.java +++ b/back/src/org/kar/karideo/api/HealthCheck.java @@ -1,8 +1,8 @@ package org.kar.karideo.api; import org.kar.archidata.exception.FailException; -import org.kar.archidata.util.ConfigBaseVariable; -import org.kar.archidata.util.JWTWrapper; +import org.kar.archidata.tools.ConfigBaseVariable; +import org.kar.archidata.tools.JWTWrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,10 +17,10 @@ import jakarta.ws.rs.core.Response; @Produces(MediaType.APPLICATION_JSON) public class HealthCheck { static final Logger LOGGER = LoggerFactory.getLogger(HealthCheck.class); - + public record HealthResult( String value) {}; - + @GET @PermitAll public HealthResult getHealth() throws FailException { diff --git a/back/src/org/kar/karideo/api/SeasonResource.java b/back/src/org/kar/karideo/api/SeasonResource.java index 15d5c5f..2bea035 100644 --- a/back/src/org/kar/karideo/api/SeasonResource.java +++ b/back/src/org/kar/karideo/api/SeasonResource.java @@ -9,7 +9,8 @@ import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.QueryAnd; import org.kar.archidata.dataAccess.QueryCondition; import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; -import org.kar.archidata.util.DataTools; +import org.kar.archidata.dataAccess.options.Condition; +import org.kar.archidata.tools.DataTools; import org.kar.karideo.model.Season; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -99,7 +100,7 @@ public class SeasonResource { public static Season getOrCreate(final String name, final Long seriesId) { try { - Season out = DataAccess.getWhere(Season.class, new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", seriesId))); + Season out = DataAccess.getWhere(Season.class, new Condition(new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", seriesId)))); if (out == null) { out = new Season(); out.name = name; diff --git a/back/src/org/kar/karideo/api/SeriesResource.java b/back/src/org/kar/karideo/api/SeriesResource.java index 52b7d27..3497759 100644 --- a/back/src/org/kar/karideo/api/SeriesResource.java +++ b/back/src/org/kar/karideo/api/SeriesResource.java @@ -9,7 +9,8 @@ import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.QueryAnd; import org.kar.archidata.dataAccess.QueryCondition; import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; -import org.kar.archidata.util.DataTools; +import org.kar.archidata.dataAccess.options.Condition; +import org.kar.archidata.tools.DataTools; import org.kar.karideo.model.Series; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -99,7 +100,7 @@ public class SeriesResource { public static Series getOrCreate(final String name, final Long typeId) { try { - Series out = DataAccess.getWhere(Series.class, new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", typeId))); + Series out = DataAccess.getWhere(Series.class, new Condition(new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", typeId)))); if (out == null) { out = new Series(); out.name = name; diff --git a/back/src/org/kar/karideo/api/TypeResource.java b/back/src/org/kar/karideo/api/TypeResource.java index 66f2806..aeeaa22 100644 --- a/back/src/org/kar/karideo/api/TypeResource.java +++ b/back/src/org/kar/karideo/api/TypeResource.java @@ -8,7 +8,8 @@ import org.glassfish.jersey.media.multipart.FormDataParam; import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.QueryCondition; import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; -import org.kar.archidata.util.DataTools; +import org.kar.archidata.dataAccess.options.Condition; +import org.kar.archidata.tools.DataTools; import org.kar.karideo.model.Type; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -102,7 +103,7 @@ public class TypeResource { public static Type getOrCreate(final String name) { try { - Type out = DataAccess.getWhere(Type.class, new QueryCondition("name", "=", name)); + Type out = DataAccess.getWhere(Type.class, new Condition(new QueryCondition("name", "=", name))); if (out == null) { out = new Type(); out.name = name; diff --git a/back/src/org/kar/karideo/api/UserMediaAdvancementResource.java b/back/src/org/kar/karideo/api/UserMediaAdvancementResource.java index e4ceef3..976599c 100644 --- a/back/src/org/kar/karideo/api/UserMediaAdvancementResource.java +++ b/back/src/org/kar/karideo/api/UserMediaAdvancementResource.java @@ -5,6 +5,7 @@ import java.util.List; import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.QueryAnd; import org.kar.archidata.dataAccess.QueryCondition; +import org.kar.archidata.dataAccess.options.Condition; import org.kar.archidata.filter.GenericContext; import org.kar.karideo.model.UserMediaAdvancement; import org.slf4j.Logger; @@ -33,14 +34,14 @@ public class UserMediaAdvancementResource { @RolesAllowed("USER") public UserMediaAdvancement getWithId(@Context final SecurityContext sc, @PathParam("id") final Long id) throws Exception { final GenericContext gc = (GenericContext) sc.getUserPrincipal(); - return DataAccess.getWhere(UserMediaAdvancement.class, new QueryAnd(new QueryCondition("mediaId", "=", id), new QueryCondition("userId", "=", gc.userByToken.id))); + return DataAccess.getWhere(UserMediaAdvancement.class, new Condition(new QueryAnd(new QueryCondition("mediaId", "=", id), new QueryCondition("userId", "=", gc.userByToken.id)))); } @GET @RolesAllowed("USER") public List gets(@Context final SecurityContext sc) throws Exception { final GenericContext gc = (GenericContext) sc.getUserPrincipal(); - return DataAccess.getsWhere(UserMediaAdvancement.class, new QueryCondition("userId", "=", gc.userByToken.id)); + return DataAccess.getsWhere(UserMediaAdvancement.class, new Condition(new QueryCondition("userId", "=", gc.userByToken.id))); } /* ============================================================================= diff --git a/back/src/org/kar/karideo/api/VideoResource.java b/back/src/org/kar/karideo/api/VideoResource.java index 2d3999c..3ae9154 100644 --- a/back/src/org/kar/karideo/api/VideoResource.java +++ b/back/src/org/kar/karideo/api/VideoResource.java @@ -13,7 +13,7 @@ import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; import org.kar.archidata.exception.FailException; import org.kar.archidata.exception.InputException; import org.kar.archidata.model.Data; -import org.kar.archidata.util.DataTools; +import org.kar.archidata.tools.DataTools; import org.kar.karideo.model.Media; import org.kar.karideo.model.Season; import org.kar.karideo.model.Series;