Sync: code local unifié

Synchronisation du code source local (fait foi).

Signed-off-by: lions dev Team
This commit is contained in:
dahoud
2026-03-15 16:25:40 +00:00
parent e82dc356f3
commit 75a19988b0
730 changed files with 53599 additions and 13145 deletions

View File

@@ -1,5 +1,6 @@
package dev.lions.unionflow.server.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@@ -15,17 +16,15 @@ import lombok.NoArgsConstructor;
* Entité Role pour la gestion des rôles dans le système
*
* @author UnionFlow Team
* @version 3.0
* @version 3.1
* @since 2025-01-29
*/
@Entity
@Table(
name = "roles",
indexes = {
@Index(name = "idx_role_code", columnList = "code", unique = true),
@Index(name = "idx_role_actif", columnList = "actif"),
@Index(name = "idx_role_niveau", columnList = "niveau_hierarchique")
})
@Table(name = "roles", indexes = {
@Index(name = "idx_role_code", columnList = "code", unique = true),
@Index(name = "idx_role_actif", columnList = "actif"),
@Index(name = "idx_role_niveau", columnList = "niveau_hierarchique")
})
@Data
@NoArgsConstructor
@AllArgsConstructor
@@ -53,10 +52,9 @@ public class Role extends BaseEntity {
@Column(name = "niveau_hierarchique", nullable = false)
private Integer niveauHierarchique = 100;
/** Type de rôle */
@Enumerated(EnumType.STRING)
/** Type de rôle (SYSTEME, ORGANISATION, PERSONNALISE) */
@Column(name = "type_role", nullable = false, length = 50)
private TypeRole typeRole;
private String typeRole;
/** Organisation propriétaire (null pour rôles système) */
@ManyToOne(fetch = FetchType.LAZY)
@@ -64,30 +62,21 @@ public class Role extends BaseEntity {
private Organisation organisation;
/** Permissions associées */
@JsonIgnore
@OneToMany(mappedBy = "role", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@Builder.Default
private List<RolePermission> permissions = new ArrayList<>();
/** Énumération des types de rôle */
/** Énumération des constantes de types de rôle */
public enum TypeRole {
SYSTEME("Rôle Système"),
ORGANISATION("Rôle Organisation"),
PERSONNALISE("Rôle Personnalisé");
private final String libelle;
TypeRole(String libelle) {
this.libelle = libelle;
}
public String getLibelle() {
return libelle;
}
SYSTEME,
ORGANISATION,
PERSONNALISE;
}
/** Méthode métier pour vérifier si c'est un rôle système */
public boolean isRoleSysteme() {
return TypeRole.SYSTEME.equals(typeRole);
return TypeRole.SYSTEME.name().equals(typeRole);
}
/** Callback JPA avant la persistance */
@@ -95,11 +84,10 @@ public class Role extends BaseEntity {
protected void onCreate() {
super.onCreate();
if (typeRole == null) {
typeRole = TypeRole.PERSONNALISE;
typeRole = TypeRole.PERSONNALISE.name();
}
if (niveauHierarchique == null) {
niveauHierarchique = 100;
}
}
}