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
package com.megatim.fdxconsultation.model.enums;
 
import com.fasterxml.jackson.annotation.JsonValue;
import com.megatim.fdxcommons.model.search.EnumValue;
 
/**
 *
 * @author ASUS
 */
public enum FonctionAggregationOperateur {
    EQUALS("="), NOT_EQUALS("<>"),
    GREATER_THAN(">"), GREATER_OR_EQUALS_THAN(">="),
    LOWER_THAN("<"), LOWER_OR_EQUALS_THAN("<="),
    IN("IN"), NOT_IN("NOT IN"),
    BETWEEN("BETWEEN"), NOT_BETWEEN("NOT BETWEEN");
 
    private final String value;
 
    private FonctionAggregationOperateur(String value) {
        this.value = value;
    }
 
    @JsonValue
    public String getValue() {
        return value;
    }
 
    @EnumValue
    public static FonctionAggregationOperateur fromValeur(String value) {
        String cleanValue = value.trim().toUpperCase();
        cleanValue = cleanValue.replaceAll("\\s+", " ");//remplacer plusieurs chaines vides par une seule chaine vide
 
        switch (cleanValue) {
 
            case "=":
                return FonctionAggregationOperateur.EQUALS;
 
            case "<>":
                return FonctionAggregationOperateur.NOT_EQUALS;
 
            case ">":
                return FonctionAggregationOperateur.GREATER_THAN;
 
            case ">=":
                return FonctionAggregationOperateur.GREATER_OR_EQUALS_THAN;
 
            case "<":
                return FonctionAggregationOperateur.LOWER_THAN;
 
            case "<=":
                return FonctionAggregationOperateur.LOWER_OR_EQUALS_THAN;
 
            case "IN":
                return FonctionAggregationOperateur.IN;
 
            case "NOT IN":
                return FonctionAggregationOperateur.NOT_IN;
 
            case "BETWEEN":
                return FonctionAggregationOperateur.BETWEEN;
 
            case "NOT BETWEEN":
                return FonctionAggregationOperateur.NOT_BETWEEN;
 
            default:
                return null;
        }
    }
}