OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 151 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 151 Rev 174
Line 13... Line 13...
13
 
13
 
14
 package org.openconcerto.sql.users;
14
 package org.openconcerto.sql.users;
15
 
15
 
16
import org.openconcerto.sql.model.SQLRowAccessor;
16
import org.openconcerto.sql.model.SQLRowAccessor;
17
 
17
 
-
 
18
import java.awt.Color;
-
 
19
 
18
import net.jcip.annotations.Immutable;
20
import net.jcip.annotations.Immutable;
19
 
21
 
20
@Immutable
22
@Immutable
21
public final class User {
23
public final class User {
22
    private final int id;
24
    private final int id;
23
    private final String name, firstName, nickName;
25
    private final String name, firstName, nickName;
24
    private final Boolean active;
26
    private final Boolean active;
-
 
27
    private final Color color;
25
 
28
 
26
    public User(final SQLRowAccessor r) {
29
    public User(final SQLRowAccessor r) {
27
        this.id = r.getID();
30
        this.id = r.getID();
28
        this.name = r.getString("NOM").trim();
31
        this.name = r.getString("NOM").trim();
29
        this.firstName = r.getString("PRENOM").trim();
32
        this.firstName = r.getString("PRENOM").trim();
Line 31... Line 34...
31
        if (r.contains("DISABLED")) {
34
        if (r.contains("DISABLED")) {
32
            this.active = !r.getBoolean("DISABLED");
35
            this.active = !r.getBoolean("DISABLED");
33
        } else {
36
        } else {
34
            this.active = null;
37
            this.active = null;
35
        }
38
        }
-
 
39
        if (r.contains("COLOR")) {
-
 
40
            this.color = new Color(r.getInt("COLOR"));
-
 
41
        } else {
-
 
42
            this.color = null;
-
 
43
        }
36
    }
44
    }
37
 
45
 
38
    public String getName() {
46
    public String getName() {
39
        return this.name;
47
        return this.name;
40
    }
48
    }
Line 61... Line 69...
61
    }
69
    }
62
 
70
 
63
    public boolean isActive() {
71
    public boolean isActive() {
64
        return this.active;
72
        return this.active;
65
    }
73
    }
-
 
74
 
-
 
75
    public Color getColor() {
-
 
76
        return this.color;
-
 
77
    }
66
}
78
}