|
8 | 8 | import java.awt.Color; |
9 | 9 | import java.util.List; |
10 | 10 | import java.util.Set; |
| 11 | +import java.util.concurrent.ConcurrentHashMap; |
11 | 12 |
|
12 | 13 | import static com.github.pyckle.oref.integration.translationstores.FlashUpdateTypeConstants.GREEN_LEAVE_BUILDING; |
13 | 14 | import static com.github.pyckle.oref.integration.translationstores.FlashUpdateTypeConstants.GREEN_NRC_LEAVE_BUILDING; |
| 15 | +import static com.github.pyckle.oref.integration.translationstores.FlashUpdateTypeConstants.GREEN_ROCKET_THREAT_ENDED; |
14 | 16 | import static com.github.pyckle.oref.integration.translationstores.FlashUpdateTypeConstants.GREEN_TERRORIST_THREAT_ENDED; |
15 | 17 | import static com.github.pyckle.oref.integration.translationstores.FlashUpdateTypeConstants.GREEN_UAV_THREAT_ENDED; |
16 | 18 | import static com.github.pyckle.oref.integration.translationstores.FlashUpdateTypeConstants.ORANGE_ALERTS_EXPECTED_SHORTLY; |
|
26 | 28 | public enum UpdateFlashType |
27 | 29 | { |
28 | 30 | GREEN(100, Color.GREEN, GREEN_NRC_LEAVE_BUILDING, GREEN_LEAVE_BUILDING, GREEN_TERRORIST_THREAT_ENDED, |
29 | | - GREEN_UAV_THREAT_ENDED), // safe to leave building |
| 31 | + GREEN_ROCKET_THREAT_ENDED, GREEN_UAV_THREAT_ENDED), // safe to leave building |
30 | 32 | YELLOW(90, Color.YELLOW, YELLOW_EARTHQUAKE, YELLOW_STAY_CLOSE_TO_SHELTER, YELLOW_STAY_CLOSE_TO_SHELTER2, |
31 | 33 | YELLOW_LEAVE_SHELTER_STAY_CLOSE, YELLOW_LEAVE_SHELTER), // stay close to a shelter |
32 | 34 | ORANGE(80, Color.ORANGE, ORANGE_ALERTS_EXPECTED_SHORTLY), // alerts expected area shortly |
33 | | - RED(70, Color.RED, RED_NRC, RED_CONTINUE_SHELTER, RED_SHELTER_IMMEDIATELY); // go to shelter immediately |
| 35 | + RED(70, Color.RED, RED_NRC, RED_CONTINUE_SHELTER, RED_SHELTER_IMMEDIATELY), // go to shelter immediately |
| 36 | + UNKNOWN(60, new Color(255, 0, 255)) //purple |
| 37 | + ; |
34 | 38 |
|
| 39 | + private static final Set<String> unknownColor = ConcurrentHashMap.newKeySet(); |
35 | 40 | private static final Set<String> HISTORICAL_LABELS = Set.of("עדכון", "מבזק"); |
36 | 41 | private static final Logger logger = LoggerFactory.getLogger(OrefApiCachingService.class); |
37 | 42 | private final int severity; |
@@ -62,8 +67,10 @@ public static UpdateFlashType findUpdateFlashType(String hebTitle) |
62 | 67 | if (HISTORICAL_LABELS.contains(hebTitle)) |
63 | 68 | return YELLOW; |
64 | 69 |
|
65 | | - logger.warn("Cannot find alert type for {}, defaulting to red.", hebTitle); |
66 | | - return RED; |
| 70 | + // print out warning only once. |
| 71 | + if (unknownColor.add(hebTitle)) |
| 72 | + logger.warn("Cannot find alert type for {}, return UNKNOWN.", hebTitle); |
| 73 | + return UNKNOWN; |
67 | 74 | } |
68 | 75 |
|
69 | 76 | public Color getColor() { |
|
0 commit comments