Rev 27797 | Rev 31523 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.entity.fofo;import org.apache.commons.collections4.list.UnmodifiableList;import java.util.*;import java.util.stream.Collectors;import java.util.stream.Stream;public enum PartnerType {ALL("All"), PLATINUM("Platinum"), DIAMOND("Diamond"), GOLD("Gold"), SILVER("Silver"), BRONZE("Bronze"),NEW("Rising Star");private static final List<PartnerType> partnerTypes = new UnmodifiableList<>(Arrays.asList(BRONZE, SILVER, GOLD, DIAMOND, PLATINUM));public static final Map<PartnerType, Integer> PartnerTypeRankMap = new HashMap<>();static {PartnerTypeRankMap.put(PartnerType.BRONZE, 1);PartnerTypeRankMap.put(PartnerType.SILVER, 2);PartnerTypeRankMap.put(PartnerType.GOLD, 3);PartnerTypeRankMap.put(PartnerType.DIAMOND, 4);PartnerTypeRankMap.put(PartnerType.PLATINUM, 5);PartnerTypeRankMap.put(PartnerType.NEW, 6);}private String value;public static final Map<PartnerType, String> imageMap = Stream.of(new AbstractMap.SimpleEntry<>(PartnerType.GOLD, "resources/images/small-gold.png"),new AbstractMap.SimpleEntry<>(PartnerType.SILVER, "resources/images/small-silver.png"),new AbstractMap.SimpleEntry<>(PartnerType.NEW, "resources/images/small-risingstar.png"),new AbstractMap.SimpleEntry<>(PartnerType.PLATINUM, "resources/images/small-platinum.png"),new AbstractMap.SimpleEntry<>(PartnerType.BRONZE, "resources/images/small-bronze.png"),new AbstractMap.SimpleEntry<>(PartnerType.DIAMOND, "resources/images/small-diamond.png")).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));private PartnerType(String value) {this.value = value;}public String getValue() {return value;}public PartnerType next() {if (this.equals(PartnerType.NEW))return PartnerType.GOLD;int index = partnerTypes.indexOf(this);if (index + 1 == partnerTypes.size()) {return this;} else {return partnerTypes.get(index + 1);}}public List<PartnerType> nextPartnerTypes() {if (this.equals(PartnerType.NEW))return Arrays.asList(this);int index = partnerTypes.indexOf(this);return partnerTypes.stream().skip(index + 1).collect(Collectors.toList());}}