Subversion Repositories SmartDukaan

Rev

Rev 25503 | Rev 26930 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25503 Rev 25652
Line 1... Line 1...
1
package com.spice.profitmandi.dao.entity.fofo;
1
package com.spice.profitmandi.dao.entity.fofo;
2
 
2
 
-
 
3
import java.util.AbstractMap;
-
 
4
import java.util.Arrays;
-
 
5
import java.util.List;
-
 
6
import java.util.Map;
-
 
7
import java.util.stream.Collectors;
-
 
8
import java.util.stream.Stream;
3
 
9
 
4
public enum PartnerType {
10
public enum PartnerType {
5
	ALL("All"),
-
 
6
	PLATINUM("Platinum"),
11
	ALL("All"), PLATINUM("Platinum"), DIAMOND("Diamond"), GOLD("Gold"), SILVER("Silver"), BRONZE("Bronze"),
7
	DIAMOND("Diamond"),
-
 
8
	GOLD("Gold"),
-
 
9
	SILVER("Silver"),
-
 
10
	BRONZE("Bronze"),
-
 
11
	NEW("Rising Star");
12
	NEW("Rising Star");
-
 
13
	private static final List<PartnerType> partnerTypes = Arrays.asList(BRONZE, SILVER, GOLD, DIAMOND, PLATINUM);
12
	private String value;
14
	private String value;
-
 
15
 
-
 
16
	public static final Map<PartnerType, String> imageMap = Stream.of(
-
 
17
			new AbstractMap.SimpleEntry<>(PartnerType.GOLD, "resources/images/small_gold.png"), new AbstractMap.SimpleEntry<>(PartnerType.SILVER, "resources/images/small_silver.png"),
-
 
18
			new AbstractMap.SimpleEntry<>(PartnerType.NEW, "resources/images/small_risingstar.png"), new AbstractMap.SimpleEntry<>(PartnerType.PLATINUM, "resources/images/small_platinum.png"),
-
 
19
			new AbstractMap.SimpleEntry<>(PartnerType.BRONZE, "resources/images/small_bronze.png"),
-
 
20
			new AbstractMap.SimpleEntry<>(PartnerType.DIAMOND, "resources/images/small_diamond.png"))
-
 
21
			.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
-
 
22
 
13
	private PartnerType(String value) {
23
	private PartnerType(String value) {
14
		this.value = value;
24
		this.value = value;
15
	}
25
	}
-
 
26
 
16
	public String getValue() {
27
	public String getValue() {
17
		return value;
28
		return value;
18
	}
29
	}
19
}
-
 
20
 
30
 
-
 
31
	public PartnerType next() {
-
 
32
		if (this.equals(PartnerType.NEW))
-
 
33
			return PartnerType.GOLD;
-
 
34
		int index = partnerTypes.indexOf(this);
-
 
35
		if (index + 1 == partnerTypes.size()) {
-
 
36
			return this;
-
 
37
		} else {
-
 
38
			return partnerTypes.get(index + 1);
-
 
39
		}
-
 
40
	}
-
 
41
 
-
 
42
	public PartnerType previous() {
-
 
43
		int index = partnerTypes.indexOf(this);
-
 
44
		if (index == 0) {
-
 
45
			return this;
-
 
46
		} else {
-
 
47
			return partnerTypes.get(index + 1);
-
 
48
		}
-
 
49
	}
-
 
50
}