@Test public void getAutomaticWatchMode() throws Exception { assertEquals(AutomaticWatchMode.MAJOR, mocker.getComponentUnderTest().getAutomaticWatchMode(CURRENT_USER)); when(documentAccessBridge.getProperty( CURRENT_USER, new DocumentReference("wikiA", "XWiki", "WatchListClass"), "automaticwatch")).thenReturn("NEW"); assertEquals(AutomaticWatchMode.NEW, mocker.getComponentUnderTest().getAutomaticWatchMode(CURRENT_USER)); when(documentAccessBridge.getProperty( CURRENT_USER, new DocumentReference("wikiA", Arrays.asList("XWiki", "Notifications", "Code"), "AutomaticWatchModeClass"), "automaticWatchMode")).thenReturn("ALL"); assertEquals(AutomaticWatchMode.ALL, mocker.getComponentUnderTest().getAutomaticWatchMode(CURRENT_USER)); }
@Override public AutomaticWatchMode getAutomaticWatchMode(DocumentReference user) { Object value = documentAccessBridge.getProperty(user, getAbsoluteClassReference(user), AUTOMATIC_WATCH_MODE); if (value != null && StringUtils.isNotBlank((String) value)) { return AutomaticWatchMode.valueOf((String) value); } value = documentAccessBridge.getProperty(user, getAbsoluteWatchlistClassReference(user), "automaticwatch"); if (value != null && StringUtils.isNotBlank((String) value) && !"default".equals(value)) { return AutomaticWatchMode.valueOf((String) value); } return getDefaultAutomaticWatchMode(user.getWikiReference()); }
DefaultWatchedEntitiesConfiguration implements WatchedEntitiesConfiguration { @Override public AutomaticWatchMode getAutomaticWatchMode(DocumentReference user) { Object value = documentAccessBridge.getProperty(user, getAbsoluteClassReference(user), AUTOMATIC_WATCH_MODE); if (value != null && StringUtils.isNotBlank((String) value)) { return AutomaticWatchMode.valueOf((String) value); } value = documentAccessBridge.getProperty(user, getAbsoluteWatchlistClassReference(user), "automaticwatch"); if (value != null && StringUtils.isNotBlank((String) value) && !"default".equals(value)) { return AutomaticWatchMode.valueOf((String) value); } return getDefaultAutomaticWatchMode(user.getWikiReference()); } }
DefaultWatchedEntitiesConfiguration implements WatchedEntitiesConfiguration { @Override public AutomaticWatchMode getAutomaticWatchMode(DocumentReference user) { Object value = documentAccessBridge.getProperty(user, getAbsoluteClassReference(user), AUTOMATIC_WATCH_MODE); if (value != null && StringUtils.isNotBlank((String) value)) { return AutomaticWatchMode.valueOf((String) value); } value = documentAccessBridge.getProperty(user, getAbsoluteWatchlistClassReference(user), "automaticwatch"); if (value != null && StringUtils.isNotBlank((String) value) && !"default".equals(value)) { return AutomaticWatchMode.valueOf((String) value); } return getDefaultAutomaticWatchMode(user.getWikiReference()); }  }
DefaultWatchedEntitiesConfiguration implements WatchedEntitiesConfiguration { @Override public AutomaticWatchMode getAutomaticWatchMode(DocumentReference user) { Object value = documentAccessBridge.getProperty(user, getAbsoluteClassReference(user), AUTOMATIC_WATCH_MODE); if (value != null && StringUtils.isNotBlank((String) value)) { return AutomaticWatchMode.valueOf((String) value); } value = documentAccessBridge.getProperty(user, getAbsoluteWatchlistClassReference(user), "automaticwatch"); if (value != null && StringUtils.isNotBlank((String) value) && !"default".equals(value)) { return AutomaticWatchMode.valueOf((String) value); } return getDefaultAutomaticWatchMode(user.getWikiReference()); }  @Override boolean isEnabled(); @Override AutomaticWatchMode getAutomaticWatchMode(DocumentReference user); @Override AutomaticWatchMode getDefaultAutomaticWatchMode(WikiReference wikiReference); }
DefaultWatchedEntitiesConfiguration implements WatchedEntitiesConfiguration { @Override public AutomaticWatchMode getAutomaticWatchMode(DocumentReference user) { Object value = documentAccessBridge.getProperty(user, getAbsoluteClassReference(user), AUTOMATIC_WATCH_MODE); if (value != null && StringUtils.isNotBlank((String) value)) { return AutomaticWatchMode.valueOf((String) value); } value = documentAccessBridge.getProperty(user, getAbsoluteWatchlistClassReference(user), "automaticwatch"); if (value != null && StringUtils.isNotBlank((String) value) && !"default".equals(value)) { return AutomaticWatchMode.valueOf((String) value); } return getDefaultAutomaticWatchMode(user.getWikiReference()); }  @Override boolean isEnabled(); @Override AutomaticWatchMode getAutomaticWatchMode(DocumentReference user); @Override AutomaticWatchMode getDefaultAutomaticWatchMode(WikiReference wikiReference);  }