Kenmegne
7 days ago 23a46b4be35277e06ec89f48730eeb694e686be8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.megatim.fdxcommons.model.enumeration;
 
import com.fasterxml.jackson.annotation.JsonValue;
 
/**
 *
 * @author ASUS
 */
public enum Operateur {
 
    LIKE("LIKE"),
    EQUALS("="), NOT_EQUALS("<>"),
    GREATER_THAN(">"), GREATER_OR_EQUALS_THAN(">="),
    LOWER_THAN("<"), LOWER_OR_EQUALS_THAN("<="),
    IN("IN"), NOT_IN("NOT IN"),
    IS_NULL("IS NULL"), IS_NOT_NULL("IS NOT NULL"),
    BETWEEN("BETWEEN"), NOT_BETWEEN("NOT BETWEEN");
 
    private final String value;
 
    private Operateur(String value) {
        this.value = value;
    }
 
    public static Operateur fromValeur(String value) {
        String cleanValue = value.trim().toUpperCase();
        cleanValue = cleanValue.replaceAll("\\s+", " ");//remplacer plusieurs chaines vides par une seule chaine vide
 
        switch (cleanValue) {
 
            case "LIKE":
                return Operateur.LIKE;
 
            case "=":
                return Operateur.EQUALS;
 
            case "<>":
                return Operateur.NOT_EQUALS;
 
            case ">":
                return Operateur.GREATER_THAN;
 
            case ">=":
                return Operateur.GREATER_OR_EQUALS_THAN;
 
            case "<":
                return Operateur.LOWER_THAN;
 
            case "<=":
                return Operateur.LOWER_OR_EQUALS_THAN;
 
            case "IN":
                return Operateur.IN;
 
            case "NOT IN":
                return Operateur.NOT_IN;
 
            case "IS NULL":
                return Operateur.IS_NULL;
 
            case "IS NOT NULL":
                return Operateur.IS_NOT_NULL;
 
            case "BETWEEN":
                return Operateur.BETWEEN;
 
            case "NOT BETWEEN":
                return Operateur.NOT_BETWEEN;
 
            default:
                return null;
        }
    }
 
    @JsonValue
    public String getValue() {
        return value;
    }
}