OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 87 | Rev 140 | Go to most recent revision | Details | Compare with Previous | 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
 
87 ilm 6
import org.openconcerto.erp.modules.AbstractModule;
7
import org.openconcerto.erp.modules.ModuleElement;
30 ilm 8
import org.openconcerto.sql.element.GlobalMapper;
9
import org.openconcerto.sql.element.SQLComponent;
10
import org.openconcerto.ui.group.Group;
125 ilm 11
import org.openconcerto.utils.ListMap;
30 ilm 12
 
87 ilm 13
public class LeadSQLElement extends ModuleElement {
30 ilm 14
    public static final String ELEMENT_CODE = "customerrelationship.lead";
15
 
87 ilm 16
    public LeadSQLElement(final AbstractModule module) {
17
        super(module, Module.TABLE_LEAD);
30 ilm 18
    }
19
 
20
    @Override
21
    protected String createCode() {
22
        return ELEMENT_CODE;
23
    }
24
 
25
    @Override
26
    protected List<String> getListFields() {
27
        final List<String> l = new ArrayList<String>();
28
        l.add("COMPANY");
29
        l.add("FIRSTNAME");
30
        l.add("NAME");
31
        return l;
32
    }
33
 
34
    @Override
35
    protected List<String> getComboFields() {
36
        final List<String> l = new ArrayList<String>();
37
        l.add("COMPANY");
38
        l.add("FIRSTNAME");
39
        l.add("NAME");
40
        return l;
41
    }
42
 
43
    @Override
44
    protected List<String> getPrivateFields() {
45
        final List<String> l = new ArrayList<String>();
46
        l.add("ID_ADRESSE");
47
        return l;
48
    }
49
 
50
    @Override
125 ilm 51
    public ListMap<String, String> getShowAs() {
52
        return ListMap.singleton(null, getComboFields());
30 ilm 53
    }
54
 
55
    @Override
56
    public SQLComponent createComponent() {
57
        final String groupId = this.getCode() + ".default";
58
        final Group group = GlobalMapper.getInstance().getGroup(groupId);
59
        if (group == null) {
60
            throw new IllegalStateException("No group found for id " + groupId);
61
        }
87 ilm 62
        return createComponent(group);
63
    }
64
 
65
    protected SQLComponent createComponent(final Group group) {
30 ilm 66
        return new LeadSQLComponent(this, group);
67
    }
68
}