[DEV] update new archidata

This commit is contained in:
Edouard DUPIN 2024-01-17 20:21:02 +01:00
parent 0383be3ada
commit d2128fcac8
7 changed files with 18 additions and 14 deletions

View File

@ -20,7 +20,7 @@
<dependency> <dependency>
<groupId>kangaroo-and-rabbit</groupId> <groupId>kangaroo-and-rabbit</groupId>
<artifactId>archidata</artifactId> <artifactId>archidata</artifactId>
<version>0.5.0</version> <version>0.6.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>

View File

@ -1,8 +1,8 @@
package org.kar.karideo.api; package org.kar.karideo.api;
import org.kar.archidata.exception.FailException; import org.kar.archidata.exception.FailException;
import org.kar.archidata.util.ConfigBaseVariable; import org.kar.archidata.tools.ConfigBaseVariable;
import org.kar.archidata.util.JWTWrapper; import org.kar.archidata.tools.JWTWrapper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -17,10 +17,10 @@ import jakarta.ws.rs.core.Response;
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public class HealthCheck { public class HealthCheck {
static final Logger LOGGER = LoggerFactory.getLogger(HealthCheck.class); static final Logger LOGGER = LoggerFactory.getLogger(HealthCheck.class);
public record HealthResult( public record HealthResult(
String value) {}; String value) {};
@GET @GET
@PermitAll @PermitAll
public HealthResult getHealth() throws FailException { public HealthResult getHealth() throws FailException {

View File

@ -9,7 +9,8 @@ import org.kar.archidata.dataAccess.DataAccess;
import org.kar.archidata.dataAccess.QueryAnd; import org.kar.archidata.dataAccess.QueryAnd;
import org.kar.archidata.dataAccess.QueryCondition; import org.kar.archidata.dataAccess.QueryCondition;
import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; 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.kar.karideo.model.Season;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -99,7 +100,7 @@ public class SeasonResource {
public static Season getOrCreate(final String name, final Long seriesId) { public static Season getOrCreate(final String name, final Long seriesId) {
try { 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) { if (out == null) {
out = new Season(); out = new Season();
out.name = name; out.name = name;

View File

@ -9,7 +9,8 @@ import org.kar.archidata.dataAccess.DataAccess;
import org.kar.archidata.dataAccess.QueryAnd; import org.kar.archidata.dataAccess.QueryAnd;
import org.kar.archidata.dataAccess.QueryCondition; import org.kar.archidata.dataAccess.QueryCondition;
import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; 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.kar.karideo.model.Series;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -99,7 +100,7 @@ public class SeriesResource {
public static Series getOrCreate(final String name, final Long typeId) { public static Series getOrCreate(final String name, final Long typeId) {
try { 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) { if (out == null) {
out = new Series(); out = new Series();
out.name = name; out.name = name;

View File

@ -8,7 +8,8 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.DataAccess;
import org.kar.archidata.dataAccess.QueryCondition; import org.kar.archidata.dataAccess.QueryCondition;
import org.kar.archidata.dataAccess.addOn.AddOnManyToMany; 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.kar.karideo.model.Type;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -102,7 +103,7 @@ public class TypeResource {
public static Type getOrCreate(final String name) { public static Type getOrCreate(final String name) {
try { 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) { if (out == null) {
out = new Type(); out = new Type();
out.name = name; out.name = name;

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.kar.archidata.dataAccess.DataAccess; import org.kar.archidata.dataAccess.DataAccess;
import org.kar.archidata.dataAccess.QueryAnd; import org.kar.archidata.dataAccess.QueryAnd;
import org.kar.archidata.dataAccess.QueryCondition; import org.kar.archidata.dataAccess.QueryCondition;
import org.kar.archidata.dataAccess.options.Condition;
import org.kar.archidata.filter.GenericContext; import org.kar.archidata.filter.GenericContext;
import org.kar.karideo.model.UserMediaAdvancement; import org.kar.karideo.model.UserMediaAdvancement;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -33,14 +34,14 @@ public class UserMediaAdvancementResource {
@RolesAllowed("USER") @RolesAllowed("USER")
public UserMediaAdvancement getWithId(@Context final SecurityContext sc, @PathParam("id") final Long id) throws Exception { public UserMediaAdvancement getWithId(@Context final SecurityContext sc, @PathParam("id") final Long id) throws Exception {
final GenericContext gc = (GenericContext) sc.getUserPrincipal(); 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 @GET
@RolesAllowed("USER") @RolesAllowed("USER")
public List<UserMediaAdvancement> gets(@Context final SecurityContext sc) throws Exception { public List<UserMediaAdvancement> gets(@Context final SecurityContext sc) throws Exception {
final GenericContext gc = (GenericContext) sc.getUserPrincipal(); 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)));
} }
/* ============================================================================= /* =============================================================================

View File

@ -13,7 +13,7 @@ import org.kar.archidata.dataAccess.addOn.AddOnManyToMany;
import org.kar.archidata.exception.FailException; import org.kar.archidata.exception.FailException;
import org.kar.archidata.exception.InputException; import org.kar.archidata.exception.InputException;
import org.kar.archidata.model.Data; 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.Media;
import org.kar.karideo.model.Season; import org.kar.karideo.model.Season;
import org.kar.karideo.model.Series; import org.kar.karideo.model.Series;