BrightSide Workbench Full Report + Source Code
DossierType.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2013 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.dossier.entity;
20 
21 import java.util.EnumMap;
22 import java.util.Map;
23 import org.turro.elephant.util.Images;
24 
29 public enum DossierType {
30 
31  TYPE_DOSSIER(false, false, false),
32  TYPE_PROPOSAL(false, true, false),
33  TYPE_SECRET_PROPOSAL(false, true, true),
34  TYPE_ELECTION(true, true, false),
35  TYPE_SECRET_ELECTION(true, true, true),
36  TYPE_PROJECT(false, false, false);
37 
38  private final boolean individuals, votes, secret;
39  private static final Map<DossierType, String> name;
40  static {
41  name = new EnumMap<DossierType, String>(DossierType.class);
42  name.put(TYPE_DOSSIER, "Dossier");
43  name.put(TYPE_PROPOSAL, "Proposal");
44  name.put(TYPE_SECRET_PROPOSAL, "Secret proposal");
45  name.put(TYPE_ELECTION, "Election");
46  name.put(TYPE_SECRET_ELECTION, "Secret election");
47  name.put(TYPE_PROJECT, "Project");
48  }
49  private static final Map<DossierType, String> participant;
50  static {
51  participant = new EnumMap<DossierType, String>(DossierType.class);
52  participant.put(TYPE_DOSSIER, "Participant");
53  participant.put(TYPE_PROPOSAL, "Participant");
54  participant.put(TYPE_SECRET_PROPOSAL, "Participant");
55  participant.put(TYPE_ELECTION, "Participant");
56  participant.put(TYPE_SECRET_ELECTION, "Participant");
57  participant.put(TYPE_PROJECT, "Participant");
58  }
59  private static final Map<DossierType, String> issue;
60  static {
61  issue = new EnumMap<DossierType, String>(DossierType.class);
62  issue.put(TYPE_DOSSIER, "Issue");
63  issue.put(TYPE_PROPOSAL, "lObjective");
64  issue.put(TYPE_SECRET_PROPOSAL, "lObjective");
65  issue.put(TYPE_ELECTION, "lOpposition");
66  issue.put(TYPE_SECRET_ELECTION, "lOpposition");
67  issue.put(TYPE_PROJECT, "lObjective");
68  }
69  private static final Map<DossierType, String> image;
70  static {
71  image = new EnumMap<DossierType, String>(DossierType.class);
72  image.put(TYPE_DOSSIER, "dossier");
73  image.put(TYPE_PROPOSAL, "dossier");
74  image.put(TYPE_SECRET_PROPOSAL, "dossier");
75  image.put(TYPE_ELECTION, "dossier");
76  image.put(TYPE_SECRET_ELECTION, "dossier");
77  image.put(TYPE_PROJECT, "dossier");
78  }
79 
80  private DossierType(boolean individuals, boolean votes, boolean secret) {
81  this.individuals = individuals;
82  this.votes = votes;
83  this.secret = secret;
84  }
85 
86  public String getName() {
87  return name.get(this);
88  }
89 
90  public String getParticipant() {
91  return participant.get(this);
92  }
93 
94  public String getIssue() {
95  return issue.get(this);
96  }
97 
98  public String getImage() {
99  return Images.getImage(image.get(this));
100  }
101 
102  public String get64Image() {
103  return Images.get64Image(image.get(this));
104  }
105 
106  // Each issue is an individual
107  public boolean isIndividuals() {
108  return individuals;
109  }
110 
111  // Accepts binding votes
112  public boolean isVotes() {
113  return votes;
114  }
115 
116  // Votes are secret
117  public boolean isSecret() {
118  return secret;
119  }
120 
121 }
static String get64Image(String image)
Definition: Images.java:44
static String getImage(String image)
Definition: Images.java:36