OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 87 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
30 ilm 1
package org.openconcerto.modules.customerrelationship.lead;
2
 
3
import java.util.ArrayList;
4
import java.util.List;
5
 
6
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
7
import org.openconcerto.sql.element.GlobalMapper;
8
import org.openconcerto.sql.element.SQLComponent;
9
import org.openconcerto.ui.group.Group;
10
import org.openconcerto.utils.CollectionMap;
11
 
12
public class LeadSQLElement extends ComptaSQLConfElement {
13
    public static final String ELEMENT_CODE = "customerrelationship.lead";
14
 
15
    public LeadSQLElement() {
16
        super(Module.TABLE_LEAD, "un prospect", "prospects");
17
    }
18
 
19
    @Override
20
    protected String createCode() {
21
        return ELEMENT_CODE;
22
    }
23
 
24
    @Override
25
    protected List<String> getListFields() {
26
        final List<String> l = new ArrayList<String>();
27
        l.add("COMPANY");
28
        l.add("FIRSTNAME");
29
        l.add("NAME");
30
        return l;
31
    }
32
 
33
    @Override
34
    protected List<String> getComboFields() {
35
        final List<String> l = new ArrayList<String>();
36
        l.add("COMPANY");
37
        l.add("FIRSTNAME");
38
        l.add("NAME");
39
        return l;
40
    }
41
 
42
    @Override
43
    protected List<String> getPrivateFields() {
44
        final List<String> l = new ArrayList<String>();
45
        l.add("ID_ADRESSE");
46
        return l;
47
    }
48
 
49
    @Override
50
    public CollectionMap<String, String> getShowAs() {
51
        return CollectionMap.singleton(null, getComboFields());
52
    }
53
 
54
    @Override
55
    public SQLComponent createComponent() {
56
        final String groupId = this.getCode() + ".default";
57
        final Group group = GlobalMapper.getInstance().getGroup(groupId);
58
        if (group == null) {
59
            throw new IllegalStateException("No group found for id " + groupId);
60
        }
61
        return new LeadSQLComponent(this, group);
62
    }
63
 
64
}