diff options
Diffstat (limited to 'src/main/java/com/android/vts/servlet/DashboardMainServlet.java')
-rw-r--r-- | src/main/java/com/android/vts/servlet/DashboardMainServlet.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/main/java/com/android/vts/servlet/DashboardMainServlet.java b/src/main/java/com/android/vts/servlet/DashboardMainServlet.java index e0eded1..17b9b38 100644 --- a/src/main/java/com/android/vts/servlet/DashboardMainServlet.java +++ b/src/main/java/com/android/vts/servlet/DashboardMainServlet.java @@ -74,6 +74,7 @@ public class DashboardMainServlet extends BaseServlet { private final Key testKey; private final int passCount; private final int failCount; + private boolean muteNotifications; /** * Test display constructor. @@ -86,6 +87,7 @@ public class DashboardMainServlet extends BaseServlet { this.testKey = testKey; this.passCount = passCount; this.failCount = failCount; + this.muteNotifications = false; } /** @@ -115,6 +117,20 @@ public class DashboardMainServlet extends BaseServlet { return this.failCount; } + /** + * Get the notification mute status. + * + * @return True if the subscriber has muted notifications, false otherwise. + */ + public boolean getMuteNotifications() { + return this.muteNotifications; + } + + /** Set the notification mute status. */ + public void setMuteNotifications(boolean muteNotifications) { + this.muteNotifications = muteNotifications; + } + @Override public int compareTo(TestDisplay test) { return this.testKey.getName().compareTo(test.getName()); @@ -199,14 +215,17 @@ public class DashboardMainServlet extends BaseServlet { UserFavoriteEntity.USER, FilterOperator.EQUAL, currentUser); query = new Query(UserFavoriteEntity.KIND).setFilter(userFilter); - for (Entity favorite : datastore.prepare(query).asIterable()) { - Key testKey = (Key) favorite.getProperty(UserFavoriteEntity.TEST_KEY); + for (Entity favoriteEntity : datastore.prepare(query).asIterable()) { + UserFavoriteEntity favorite = UserFavoriteEntity.fromEntity(favoriteEntity); + Key testKey = favorite.testKey; if (!testMap.containsKey(testKey)) { continue; } - displayedTests.add(testMap.get(testKey)); + TestDisplay display = testMap.get(testKey); + display.setMuteNotifications(favorite.muteNotifications); + displayedTests.add(display); subscriptionMap.put( - testKey.getName(), KeyFactory.keyToString(favorite.getKey())); + testKey.getName(), KeyFactory.keyToString(favoriteEntity.getKey())); } } header = FAVORITES_HEADER; |