| 25503 |
amit.gupta |
1 |
package com.spice.profitmandi.dao.entity.fofo;
|
|
|
2 |
|
| 25652 |
amit.gupta |
3 |
import java.util.AbstractMap;
|
|
|
4 |
import java.util.Arrays;
|
| 26930 |
amit.gupta |
5 |
import java.util.HashMap;
|
| 25652 |
amit.gupta |
6 |
import java.util.List;
|
|
|
7 |
import java.util.Map;
|
|
|
8 |
import java.util.stream.Collectors;
|
|
|
9 |
import java.util.stream.Stream;
|
| 25503 |
amit.gupta |
10 |
|
| 27797 |
tejbeer |
11 |
import org.apache.commons.collections.ArrayStack;
|
|
|
12 |
import org.apache.commons.collections4.list.UnmodifiableList;
|
|
|
13 |
|
|
|
14 |
import com.mysql.fabric.xmlrpc.base.Array;
|
|
|
15 |
|
| 25503 |
amit.gupta |
16 |
public enum PartnerType {
|
| 25652 |
amit.gupta |
17 |
ALL("All"), PLATINUM("Platinum"), DIAMOND("Diamond"), GOLD("Gold"), SILVER("Silver"), BRONZE("Bronze"),
|
| 25503 |
amit.gupta |
18 |
NEW("Rising Star");
|
| 26930 |
amit.gupta |
19 |
|
| 27797 |
tejbeer |
20 |
private static final List<PartnerType> partnerTypes = new UnmodifiableList<>(
|
|
|
21 |
Arrays.asList(BRONZE, SILVER, GOLD, DIAMOND, PLATINUM));
|
|
|
22 |
|
| 26930 |
amit.gupta |
23 |
public static final Map<PartnerType, Integer> PartnerTypeRankMap = new HashMap<>();
|
|
|
24 |
|
|
|
25 |
static {
|
|
|
26 |
PartnerTypeRankMap.put(PartnerType.BRONZE, 1);
|
|
|
27 |
PartnerTypeRankMap.put(PartnerType.SILVER, 2);
|
|
|
28 |
PartnerTypeRankMap.put(PartnerType.GOLD, 3);
|
|
|
29 |
PartnerTypeRankMap.put(PartnerType.DIAMOND, 4);
|
|
|
30 |
PartnerTypeRankMap.put(PartnerType.PLATINUM, 5);
|
|
|
31 |
PartnerTypeRankMap.put(PartnerType.NEW, 6);
|
|
|
32 |
|
|
|
33 |
}
|
| 25503 |
amit.gupta |
34 |
private String value;
|
| 25652 |
amit.gupta |
35 |
|
| 26930 |
amit.gupta |
36 |
public static final Map<PartnerType, String> imageMap = Stream
|
|
|
37 |
.of(new AbstractMap.SimpleEntry<>(PartnerType.GOLD, "resources/images/small_gold.png"),
|
|
|
38 |
new AbstractMap.SimpleEntry<>(PartnerType.SILVER, "resources/images/small_silver.png"),
|
|
|
39 |
new AbstractMap.SimpleEntry<>(PartnerType.NEW, "resources/images/small_risingstar.png"),
|
|
|
40 |
new AbstractMap.SimpleEntry<>(PartnerType.PLATINUM, "resources/images/small_platinum.png"),
|
|
|
41 |
new AbstractMap.SimpleEntry<>(PartnerType.BRONZE, "resources/images/small_bronze.png"),
|
|
|
42 |
new AbstractMap.SimpleEntry<>(PartnerType.DIAMOND, "resources/images/small_diamond.png"))
|
| 25652 |
amit.gupta |
43 |
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
|
44 |
|
| 25503 |
amit.gupta |
45 |
private PartnerType(String value) {
|
|
|
46 |
this.value = value;
|
|
|
47 |
}
|
| 25652 |
amit.gupta |
48 |
|
| 25503 |
amit.gupta |
49 |
public String getValue() {
|
|
|
50 |
return value;
|
|
|
51 |
}
|
| 25652 |
amit.gupta |
52 |
|
|
|
53 |
public PartnerType next() {
|
|
|
54 |
if (this.equals(PartnerType.NEW))
|
|
|
55 |
return PartnerType.GOLD;
|
|
|
56 |
int index = partnerTypes.indexOf(this);
|
|
|
57 |
if (index + 1 == partnerTypes.size()) {
|
|
|
58 |
return this;
|
|
|
59 |
} else {
|
|
|
60 |
return partnerTypes.get(index + 1);
|
|
|
61 |
}
|
|
|
62 |
}
|
| 27797 |
tejbeer |
63 |
|
|
|
64 |
public List<PartnerType> nextPartnerTypes() {
|
|
|
65 |
if (this.equals(PartnerType.NEW))
|
|
|
66 |
return Arrays.asList(this);
|
|
|
67 |
int index = partnerTypes.indexOf(this);
|
|
|
68 |
return partnerTypes.stream().skip(index + 1).collect(Collectors.toList());
|
|
|
69 |
|
|
|
70 |
}
|
| 25503 |
amit.gupta |
71 |
}
|