OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 149 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
144 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.erp.core.humanresources.payroll.report;
15
 
16
import org.openconcerto.utils.i18n.TranslationManager;
17
 
18
import java.util.Arrays;
19
import java.util.HashMap;
20
import java.util.List;
21
import java.util.Map;
22
 
23
public enum GroupePayeSimplifiee {
24
 
25
    SANTE("sante", true, Arrays.asList(LignePayeSimplifiee.SANTE_SECURITE, LignePayeSimplifiee.SANTE_COMPLEMENAIRE_DECES, LignePayeSimplifiee.SANTE_COMPLEMENAIRE_SANTE)), ACCIDENT_TRAVAIL("accident",
26
            false, Arrays.asList(LignePayeSimplifiee.ACCIDENTS_TRAVAIL)), RETRAITE_NON_CADRE("retraite.noncadre", true,
27
                    Arrays.asList(LignePayeSimplifiee.RETRAITE_SECURITE_PLAF, LignePayeSimplifiee.RETRAITE_SECURITE_NON_PLAF, LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T1,
156 ilm 28
                            LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T2, LignePayeSimplifiee.RETRAITE_SUPPLEMENTAIRE)), RETRAITE_CADRE(
29
                                    "retraite.cadre", true,
30
                                    Arrays.asList(LignePayeSimplifiee.RETRAITE_SECURITE_PLAF, LignePayeSimplifiee.RETRAITE_SECURITE_NON_PLAF, LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T1,
31
                                            LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T2, LignePayeSimplifiee.RETRAITE_SUPPLEMENTAIRE)), FAMILLE("famille", false,
32
                                                    Arrays.asList(LignePayeSimplifiee.FAMILLE_ALLOCATIONS)), CHOMAGE_NON_CADRE("chomage.noncadre", false,
33
                                                            Arrays.asList(LignePayeSimplifiee.ASSURANCE_CHOMAGE_CHOMAGE)), CHOMAGE_CADRE("chomage.cadre", true,
34
                                                                    Arrays.asList(LignePayeSimplifiee.ASSURANCE_CHOMAGE_CHOMAGE, LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC)), AUTRES_CONTRIBUTIONS(
35
                                                                            "autres", false, Arrays.asList(LignePayeSimplifiee.AUTRES_CONTRIBUTIONS)), COTISATIONS_CONVENTION("cotisations.convention",
36
                                                                                    false, Arrays.asList(LignePayeSimplifiee.COTISATIONS_STATUAIRES)), CSG_NON_IMP("csg.nonimp", false,
37
                                                                                            Arrays.asList(LignePayeSimplifiee.CSG_NON_IMP)), CSG_IMP("csg.imp", false,
38
                                                                                                    Arrays.asList(LignePayeSimplifiee.CSG_IMP)), ALLEGEMENT("allegement", false,
39
                                                                                                            Arrays.asList(LignePayeSimplifiee.ALLEGEMENT_COTISATIONS));
144 ilm 40
 
41
    public final String id;
42
    public final List<LignePayeSimplifiee> children;
43
    public final boolean showChildren;
44
 
45
    private GroupePayeSimplifiee(String id, boolean showChildren, List<LignePayeSimplifiee> children) {
46
        this.children = children;
47
        this.showChildren = showChildren;
48
        this.id = id;
49
    }
50
 
51
    public boolean isShowChildren() {
52
        return showChildren;
53
    }
54
 
55
    public List<LignePayeSimplifiee> getChildren() {
56
        return children;
57
    }
58
 
59
    public String getId() {
60
        return id;
61
    }
62
 
63
    public String getTranslation() {
64
        final String translationForItem = TranslationManager.getInstance().getTranslationForItem(getId());
65
 
66
        return (translationForItem == null || translationForItem.trim().length() == 0) ? getId() : translationForItem;
67
    }
68
 
69
    private static final Map<String, GroupePayeSimplifiee> idToEnum = new HashMap<String, GroupePayeSimplifiee>();
70
    static {
71
        for (GroupePayeSimplifiee e : values())
72
            idToEnum.put(e.getId(), e);
73
    }
74
 
75
    public static GroupePayeSimplifiee fromID(int id) {
76
        return idToEnum.get(id);
77
    }
78
 
79
    @Override
80
    public String toString() {
81
        return getTranslation();
82
    }
83
}