Skip to content
Snippets Groups Projects
Commit 3359b10d authored by Brendan Le Ny's avatar Brendan Le Ny
Browse files

Permet d'utiliser @Value avec Jackson

parent d20ad0b7
No related branches found
No related tags found
No related merge requests found
Pipeline #24321 passed
# Permet à jackson de désérialiser des objets rendus immuables (pas de contructeur
# vide, pas de setter) par lombok
lombok.anyConstructor.addConstructorProperties = true
# ajout de l'annotation @Generated dans les sources générées par lombok, pour que jacoco les ignore
lombok.addLombokGeneratedAnnotation = true
package fr.inra.oresing;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.Value;
@Getter
@Setter
@ToString
@Value
public class JwtCookieValue {
private OreSiUserRequestClient requestClient;
OreSiUserRequestClient requestClient;
}
package fr.inra.oresing;
import fr.inra.oresing.persistence.roles.OreSiUserRole;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.Value;
import java.util.UUID;
@Getter
@Setter
@ToString
@Value
public class OreSiUserRequestClient implements OreSiRequestClient {
private UUID id;
UUID id;
private OreSiUserRole role;
OreSiUserRole role;
public static OreSiUserRequestClient of(UUID userId, OreSiUserRole userRole) {
OreSiUserRequestClient newRequestClient = new OreSiUserRequestClient();
newRequestClient.setId(userId);
newRequestClient.setRole(userRole);
OreSiUserRequestClient newRequestClient = new OreSiUserRequestClient(userId, userRole);
return newRequestClient;
}
}
package fr.inra.oresing.model;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.Value;
@Getter
@Setter
@EqualsAndHashCode
@ToString
@Value
public class VariableComponentReference {
private String variable;
private String component;
String variable;
String component;
}
......@@ -77,8 +77,7 @@ public class AuthHelper {
private Cookie newCookie(OreSiUserRequestClient requestClient) {
String json;
try {
JwtCookieValue jwtCookieValue = new JwtCookieValue();
jwtCookieValue.setRequestClient(requestClient);
JwtCookieValue jwtCookieValue = new JwtCookieValue(requestClient);
json = objectMapper.writeValueAsString(jwtCookieValue);
} catch (JsonProcessingException e) {
throw new OreSiTechnicalException("impossible de sérialiser " + requestClient + " avec " + objectMapper, e);
......
......@@ -268,9 +268,7 @@ public class OreSiService {
Configuration.ColumnDescription variableDescription = variableEntry.getValue();
for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : variableDescription.getComponents().entrySet()) {
String component = componentEntry.getKey();
VariableComponentReference variableComponentReference = new VariableComponentReference();
variableComponentReference.setVariable(variable);
variableComponentReference.setComponent(component);
VariableComponentReference variableComponentReference = new VariableComponentReference(variable, component);
checkers.put(variableComponentReference, checkerFactory.getChecker(variableDescription, app, component));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment