Subversion Repositories SmartDukaan

Rev

Rev 25652 | Rev 27797 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
 
11
public enum PartnerType {
25652 amit.gupta 12
	ALL("All"), PLATINUM("Platinum"), DIAMOND("Diamond"), GOLD("Gold"), SILVER("Silver"), BRONZE("Bronze"),
25503 amit.gupta 13
	NEW("Rising Star");
25652 amit.gupta 14
	private static final List<PartnerType> partnerTypes = Arrays.asList(BRONZE, SILVER, GOLD, DIAMOND, PLATINUM);
26930 amit.gupta 15
 
16
	public static final Map<PartnerType, Integer> PartnerTypeRankMap = new HashMap<>();
17
 
18
	static {
19
		PartnerTypeRankMap.put(PartnerType.BRONZE, 1);
20
		PartnerTypeRankMap.put(PartnerType.SILVER, 2);
21
		PartnerTypeRankMap.put(PartnerType.GOLD, 3);
22
		PartnerTypeRankMap.put(PartnerType.DIAMOND, 4);
23
		PartnerTypeRankMap.put(PartnerType.PLATINUM, 5);
24
		PartnerTypeRankMap.put(PartnerType.NEW, 6);
25
 
26
	}
25503 amit.gupta 27
	private String value;
25652 amit.gupta 28
 
26930 amit.gupta 29
	public static final Map<PartnerType, String> imageMap = Stream
30
			.of(new AbstractMap.SimpleEntry<>(PartnerType.GOLD, "resources/images/small_gold.png"),
31
					new AbstractMap.SimpleEntry<>(PartnerType.SILVER, "resources/images/small_silver.png"),
32
					new AbstractMap.SimpleEntry<>(PartnerType.NEW, "resources/images/small_risingstar.png"),
33
					new AbstractMap.SimpleEntry<>(PartnerType.PLATINUM, "resources/images/small_platinum.png"),
34
					new AbstractMap.SimpleEntry<>(PartnerType.BRONZE, "resources/images/small_bronze.png"),
35
					new AbstractMap.SimpleEntry<>(PartnerType.DIAMOND, "resources/images/small_diamond.png"))
25652 amit.gupta 36
			.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
37
 
25503 amit.gupta 38
	private PartnerType(String value) {
39
		this.value = value;
40
	}
25652 amit.gupta 41
 
25503 amit.gupta 42
	public String getValue() {
43
		return value;
44
	}
25652 amit.gupta 45
 
46
	public PartnerType next() {
47
		if (this.equals(PartnerType.NEW))
48
			return PartnerType.GOLD;
49
		int index = partnerTypes.indexOf(this);
50
		if (index + 1 == partnerTypes.size()) {
51
			return this;
52
		} else {
53
			return partnerTypes.get(index + 1);
54
		}
55
	}
25503 amit.gupta 56
}