OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 181 Rev 183
Line 16... Line 16...
16
 
16
 
17
    private final SQLField field;
17
    private final SQLField field;
18
    private final SQLRowAccessor foreignLinkRow;
18
    private final SQLRowAccessor foreignLinkRow;
19
    private final SQLFieldTranslator translator;
19
    private final SQLFieldTranslator translator;
20
    private final SQLElement elementLink;
20
    private final SQLElement elementLink;
-
 
21
    private final SQLElementDirectory dir;
21
 
22
 
22
    public BatchField(SQLElementDirectory dir, SQLField field, SQLRowAccessor foreignLinkRow) {
23
    public BatchField(SQLElementDirectory dir, SQLField field, SQLRowAccessor foreignLinkRow) {
23
        this.field = field;
24
        this.field = field;
-
 
25
        this.dir = dir;
24
        this.foreignLinkRow = foreignLinkRow;
26
        this.foreignLinkRow = foreignLinkRow;
25
 
27
 
26
        this.translator = dir.getTranslator();
28
        this.translator = dir.getTranslator();
27
        if (foreignLinkRow == null) {
29
        if (foreignLinkRow == null) {
28
            this.elementLink = null;
30
            this.elementLink = null;
29
        } else {
31
        } else {
30
            this.elementLink = dir.getElement(foreignLinkRow.getTable());
32
            this.elementLink = dir.getElement(foreignLinkRow.getTable());
31
        }
33
        }
32
    }
34
    }
33
 
35
 
-
 
36
    private SQLField fieldToMatch;
-
 
37
    private Object matchingValue;
-
 
38
 
-
 
39
    public void setDefaultMatchingValue(SQLField fieldToMatch, Object value) {
-
 
40
        this.fieldToMatch = fieldToMatch;
-
 
41
        this.matchingValue = value;
-
 
42
    }
-
 
43
 
34
    public SQLField getField() {
44
    public SQLField getField() {
35
        return field;
45
        return field;
36
    }
46
    }
37
 
47
 
38
    public SQLRowAccessor getForeignLinkRow() {
48
    public SQLRowAccessor getForeignLinkRow() {
39
        return foreignLinkRow;
49
        return foreignLinkRow;
40
    }
50
    }
41
 
51
    
-
 
52
    public SQLField getFieldToMatch() {
-
 
53
        return fieldToMatch;
-
 
54
    }
-
 
55
    
-
 
56
    public Object getMatchingValue() {
-
 
57
        return matchingValue;
-
 
58
    }
-
 
59
 
42
    public String getComboName() {
60
    public String getComboName() {
-
 
61
        if (this.fieldToMatch != null) {
-
 
62
            return this.dir.getElement(this.fieldToMatch.getTable()).getPluralName() + " " + this.translator.getLabelFor(this.field) + " " + this.matchingValue;
43
        if (this.foreignLinkRow == null) {
63
        } else if (this.foreignLinkRow == null) {
44
            return this.translator.getLabelFor(this.field);
64
            return this.translator.getLabelFor(this.field);
45
        } else {
65
        } else {
46
            return this.elementLink.getPluralName() + " " + this.foreignLinkRow.getString("NOM") + " " + this.translator.getLabelFor(this.field);
66
            return this.elementLink.getPluralName() + " " + this.foreignLinkRow.getString("NOM") + " " + this.translator.getLabelFor(this.field);
47
        }
67
        }
48
    }
68
    }