Subversion Repositories SmartDukaan

Rev

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

Rev 25652 Rev 26930
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;
3
import java.util.AbstractMap;
4
import java.util.Arrays;
4
import java.util.Arrays;
-
 
5
import java.util.HashMap;
5
import java.util.List;
6
import java.util.List;
6
import java.util.Map;
7
import java.util.Map;
7
import java.util.stream.Collectors;
8
import java.util.stream.Collectors;
8
import java.util.stream.Stream;
9
import java.util.stream.Stream;
9
 
10
 
10
public enum PartnerType {
11
public enum PartnerType {
11
	ALL("All"), PLATINUM("Platinum"), DIAMOND("Diamond"), GOLD("Gold"), SILVER("Silver"), BRONZE("Bronze"),
12
	ALL("All"), PLATINUM("Platinum"), DIAMOND("Diamond"), GOLD("Gold"), SILVER("Silver"), BRONZE("Bronze"),
12
	NEW("Rising Star");
13
	NEW("Rising Star");
13
	private static final List<PartnerType> partnerTypes = Arrays.asList(BRONZE, SILVER, GOLD, DIAMOND, PLATINUM);
14
	private static final List<PartnerType> partnerTypes = Arrays.asList(BRONZE, SILVER, GOLD, DIAMOND, PLATINUM);
-
 
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
	}
14
	private String value;
27
	private String value;
15
 
28
 
16
	public static final Map<PartnerType, String> imageMap = Stream.of(
29
	public static final Map<PartnerType, String> imageMap = Stream
-
 
30
			.of(new AbstractMap.SimpleEntry<>(PartnerType.GOLD, "resources/images/small_gold.png"),
17
			new AbstractMap.SimpleEntry<>(PartnerType.GOLD, "resources/images/small_gold.png"), new AbstractMap.SimpleEntry<>(PartnerType.SILVER, "resources/images/small_silver.png"),
31
					new AbstractMap.SimpleEntry<>(PartnerType.SILVER, "resources/images/small_silver.png"),
-
 
32
					new AbstractMap.SimpleEntry<>(PartnerType.NEW, "resources/images/small_risingstar.png"),
18
			new AbstractMap.SimpleEntry<>(PartnerType.NEW, "resources/images/small_risingstar.png"), new AbstractMap.SimpleEntry<>(PartnerType.PLATINUM, "resources/images/small_platinum.png"),
33
					new AbstractMap.SimpleEntry<>(PartnerType.PLATINUM, "resources/images/small_platinum.png"),
19
			new AbstractMap.SimpleEntry<>(PartnerType.BRONZE, "resources/images/small_bronze.png"),
34
					new AbstractMap.SimpleEntry<>(PartnerType.BRONZE, "resources/images/small_bronze.png"),
20
			new AbstractMap.SimpleEntry<>(PartnerType.DIAMOND, "resources/images/small_diamond.png"))
35
					new AbstractMap.SimpleEntry<>(PartnerType.DIAMOND, "resources/images/small_diamond.png"))
21
			.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
36
			.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
22
 
37
 
23
	private PartnerType(String value) {
38
	private PartnerType(String value) {
24
		this.value = value;
39
		this.value = value;
25
	}
40
	}
Line 36... Line 51...
36
			return this;
51
			return this;
37
		} else {
52
		} else {
38
			return partnerTypes.get(index + 1);
53
			return partnerTypes.get(index + 1);
39
		}
54
		}
40
	}
55
	}
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
}
56
}