diff --git a/xwiki-platform-core/pom.xml b/xwiki-platform-core/pom.xml
index 2414f19badc9..a1dbd0a8392b 100644
--- a/xwiki-platform-core/pom.xml
+++ b/xwiki-platform-core/pom.xml
@@ -138,6 +138,18 @@
Single justification example:
-->
+
+ Deprecated method available through legacy but breakage triggered by a
+ dependant module.
+ allowed
+
+ -
+ true
+
java.method.removed
+ method java.lang.String org.xwiki.notifications.filters.NotificationFilterPreference::getProviderHint()
+
+
+
diff --git a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/pom.xml b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/pom.xml
index 100bf07d7332..50cb9e936ec0 100644
--- a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/pom.xml
+++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/pom.xml
@@ -37,14 +37,18 @@
By setting this property, we make sure this application would be automatically uninstalled if the administrator
installs the old Activity Stream Application. -->
org.xwiki.platform:xwiki-platform-notifications-filters-api
- 0.63
+ 0.08
+
org.xwiki.platform
xwiki-platform-notifications-filters-api
${project.version}
+ pom
+
org.xwiki.platform
xwiki-platform-notifications-api
@@ -56,6 +60,27 @@
xwiki-platform-legacy-notifications-api
${project.version}
+
+
+ org.xwiki.platform
+ xwiki-platform-notifications-filters-api
+ ${project.version}
+
+ provided
+
+
+
+ org.xwiki.platform
+ xwiki-platform-notifications-api
+
+
+
+
+
+
+ org.aspectj
+ aspectjrt
+
org.xwiki.commons
@@ -64,4 +89,111 @@
test
+
+
+
+
+ org.codehaus.mojo
+ aspectj-maven-plugin
+
+
+ backward-compatibility-aspects
+
+
+
+ org.xwiki.platform
+ xwiki-platform-notifications-filters-api
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ **/builddef.lst
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+ process-classes
+
+
+
+
+
+
+
+
+
+
+ run
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ org.xwiki.platform:xwiki-platform-notifications-filters-api:jar
+
+
+
+
+ fr.inria.gforge.spoon
+ spoon-maven-plugin
+
+
+ spoon-main
+
+
+
+ org.xwiki.tool.spoon.ComponentAnnotationProcessor
+
+
+
+ skipForeignDeclarations
+ true
+
+
+
+ componentsTxtPath
+ target/classes/META-INF/components.txt
+
+
+
+
+
+
+
+ spoon-test
+
+
+ true
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/src/main/aspect/org/xwiki/notifications/filters/NotificationFilterPreferenceCompatibilityAspect.aj b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/src/main/aspect/org/xwiki/notifications/filters/NotificationFilterPreferenceCompatibilityAspect.aj
new file mode 100644
index 000000000000..c7ee91a0ec63
--- /dev/null
+++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/src/main/aspect/org/xwiki/notifications/filters/NotificationFilterPreferenceCompatibilityAspect.aj
@@ -0,0 +1,31 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.notifications.filters;
+
+/**
+ * Add a backward compatibility layer to {@link NotificationFilterPreference}.
+ *
+ * @version $Id$
+ * @since 16.5.0RC1
+ */
+public privileged aspect NotificationFilterPreferenceCompatibilityAspect
+{
+ declare parents : NotificationFilterPreference implements CompatibilityNotificationFilterPreference;
+}
diff --git a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/CompatibilityNotificationFilterPreference.java b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/CompatibilityNotificationFilterPreference.java
new file mode 100644
index 000000000000..4a54383c5083
--- /dev/null
+++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/CompatibilityNotificationFilterPreference.java
@@ -0,0 +1,39 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.notifications.filters;
+
+/**
+ * Deprecated methods of {@link NotificationFilterPreference}.
+ *
+ * @version $Id$
+ * @since 16.5.0RC1
+ */
+public interface CompatibilityNotificationFilterPreference
+{
+ /**
+ * @return the name of the provider hint associated with this preference.
+ * @deprecated this information is now useless with support of a single location for storing preferences
+ */
+ @Deprecated(since = "16.5.0RC1")
+ default String getProviderHint()
+ {
+ return "";
+ }
+}
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreferenceProvider.java b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreferenceProvider.java
similarity index 96%
rename from xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreferenceProvider.java
rename to xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreferenceProvider.java
index b374ceed51bf..51b014a7561b 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreferenceProvider.java
+++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-filters/xwiki-platform-legacy-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreferenceProvider.java
@@ -34,8 +34,10 @@
*
* @version $Id$
* @since 9.8RC1
+ * @deprecated this interface is not used anywhere anymore in XWiki Standard.
*/
@Role
+@Deprecated(since = "16.5.0RC1")
public interface NotificationFilterPreferenceProvider
{
/**
@@ -73,7 +75,7 @@ default Set getFilterPreferences(WikiReference wik
* @since 9.11.9
*/
void saveFilterPreferences(DocumentReference user, Set filterPreferences)
- throws NotificationException;
+ throws NotificationException;
/**
* Delete a filter preference.
@@ -129,7 +131,7 @@ default void deleteFilterPreference(WikiReference wikiReference, String filterPr
* @since 9.11.9
*/
void setFilterPreferenceEnabled(DocumentReference user, String filterPreferenceId, boolean enabled)
- throws NotificationException;
+ throws NotificationException;
/**
* Enable or disable a filter preference.
@@ -158,4 +160,4 @@ default void setFilterPreferenceEnabled(WikiReference wikiReference, String filt
* @since 9.11.5
*/
void setStartDateForUser(DocumentReference user, Date startDate) throws NotificationException;
-}
+}
\ No newline at end of file
diff --git a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-sources/src/test/java/org/xwiki/notifications/sources/internal/LegacyDefaultNotificationParametersFactoryTest.java b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-sources/src/test/java/org/xwiki/notifications/sources/internal/LegacyDefaultNotificationParametersFactoryTest.java
index 85d9f6b55d33..7617d8b5de55 100644
--- a/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-sources/src/test/java/org/xwiki/notifications/sources/internal/LegacyDefaultNotificationParametersFactoryTest.java
+++ b/xwiki-platform-core/xwiki-platform-legacy/xwiki-platform-legacy-notifications/xwiki-platform-legacy-notifications-sources/src/test/java/org/xwiki/notifications/sources/internal/LegacyDefaultNotificationParametersFactoryTest.java
@@ -368,7 +368,6 @@ private DefaultNotificationFilterPreference getFilterPreference(String property,
filterPreference.setFilterName(ScopeNotificationFilter.FILTER_NAME);
filterPreference.setFilterType(NotificationFilterType.INCLUSIVE);
filterPreference.setNotificationFormats(Collections.singleton(NotificationFormat.ALERT));
- filterPreference.setProviderHint("FACTORY");
return filterPreference;
}
}
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/pom.xml
index 4b0436bd1711..6ed1072e2aa5 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/pom.xml
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/pom.xml
@@ -35,6 +35,8 @@
Notifications Filters API
${basedir}/src/checkstyle/checkstyle-suppressions.xml
+
+ true
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreference.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreference.java
index ca191db0abc0..fb67d446d87d 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreference.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreference.java
@@ -26,6 +26,7 @@
import org.apache.commons.lang3.StringUtils;
import org.xwiki.notifications.NotificationFormat;
+import org.xwiki.stability.Unstable;
import static com.xpn.xwiki.doc.XWikiDocument.DB_SPACE_SEP;
@@ -47,6 +48,13 @@
*/
public interface NotificationFilterPreference
{
+ /**
+ * Prefix to be used for the ID only when the preference is stored in database.
+ * @since 16.5.0RC1
+ */
+ @Unstable
+ String DB_STORED_FILTER_PREFIX = "NFP_";
+
/**
* @return the unique identifier of the filter preference.
* @since 10.8RC1
@@ -59,11 +67,6 @@ public interface NotificationFilterPreference
*/
String getFilterName();
- /**
- * @return the name of the {@link NotificationFilterPreferenceProvider} associated with this preference.
- */
- String getProviderHint();
-
/**
* @return true if the current notification preference is enabled.
*/
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreferenceManager.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreferenceManager.java
index 048dc872a318..7a44c9ae721a 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreferenceManager.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/NotificationFilterPreferenceManager.java
@@ -105,7 +105,8 @@ Stream getFilterPreferences(
* @since 10.8.3
* @since 9.11.9
*/
- void saveFilterPreferences(DocumentReference user, Set notificationFilterPreferences);
+ void saveFilterPreferences(DocumentReference user, Set notificationFilterPreferences)
+ throws NotificationException;
/**
* Delete a filter preference.
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreferenceManager.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreferenceManager.java
index b2d02ca16b37..1e85071f35fe 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreferenceManager.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreferenceManager.java
@@ -19,25 +19,16 @@
*/
package org.xwiki.notifications.filters.internal;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.inject.Inject;
+import javax.inject.Named;
import javax.inject.Singleton;
-import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.slf4j.Logger;
import org.xwiki.component.annotation.Component;
-import org.xwiki.component.manager.ComponentLookupException;
-import org.xwiki.component.manager.ComponentManager;
import org.xwiki.model.reference.DocumentReference;
import org.xwiki.model.reference.WikiReference;
import org.xwiki.notifications.NotificationException;
@@ -45,240 +36,106 @@
import org.xwiki.notifications.filters.NotificationFilter;
import org.xwiki.notifications.filters.NotificationFilterPreference;
import org.xwiki.notifications.filters.NotificationFilterPreferenceManager;
-import org.xwiki.notifications.filters.NotificationFilterPreferenceProvider;
import org.xwiki.notifications.filters.NotificationFilterType;
/**
- * Default implementation of {@link NotificationFilterPreferenceManager}.
+ * Default implementation of the role {@link NotificationFilterPreferenceManager}.
*
* @version $Id$
- * @since 10.9
+ * @since 9.8RC1
*/
@Component
@Singleton
public class DefaultNotificationFilterPreferenceManager implements NotificationFilterPreferenceManager
{
- @Inject
- private ComponentManager componentManager;
@Inject
- private Logger logger;
-
- @FunctionalInterface
- interface ProviderCallable
- {
- void doInProvider(NotificationFilterPreferenceProvider provider) throws NotificationException;
- }
-
- @FunctionalInterface
- interface RetrieveWithProviderCallable
- {
- Collection retrieveWithProvider(NotificationFilterPreferenceProvider provider)
- throws NotificationException;
- }
-
- private List getProviderList() throws NotificationException
- {
- try {
- return componentManager.getInstanceList(NotificationFilterPreferenceProvider.class);
- } catch (ComponentLookupException e) {
- throw new NotificationException("Error when trying to load the list of providers", e);
- }
- }
-
- private String getProviderDebugMessage(String loggerMessage, NotificationFilterPreferenceProvider provider)
- {
- return String.format("%s with provider %s", loggerMessage, provider);
- }
-
- private String getExceptionMessage(String loggerMessage, List exceptions)
- {
- return String.format("%s - All providers called failed, see exceptions: [%s].",
- loggerMessage,
- exceptions.stream().map(ExceptionUtils::getRootCauseMessage).collect(Collectors.joining(",")));
- }
-
- private void providerExceptionWrapper(ProviderCallable callable, String loggerMessage) throws NotificationException
- {
- boolean allFailing = true;
- List exceptions = new ArrayList<>();
- List providerList = getProviderList();
- if (providerList.size() > 1) {
- for (NotificationFilterPreferenceProvider provider : providerList) {
- try {
- callable.doInProvider(provider);
- allFailing = false;
- } catch (NotificationException e) {
- this.logger.debug(getProviderDebugMessage(loggerMessage, provider), e);
- exceptions.add(e);
- }
- }
- if (allFailing) {
- throw new NotificationException(getExceptionMessage(loggerMessage, exceptions));
- }
- } else {
- callable.doInProvider(providerList.get(0));
- }
- }
-
- private Collection retrieveWithProviderExceptionWrapper(RetrieveWithProviderCallable callable,
- String loggerMessage) throws NotificationException
- {
- boolean allFailing = true;
- List exceptions = new ArrayList<>();
- Set result = new HashSet<>();
- List providerList = getProviderList();
- if (providerList.size() > 1) {
- for (NotificationFilterPreferenceProvider provider : getProviderList()) {
- try {
- result.addAll(callable.retrieveWithProvider(provider));
- allFailing = false;
- } catch (NotificationException e) {
- this.logger.debug(getProviderDebugMessage(loggerMessage, provider), e);
- exceptions.add(e);
- }
- }
- if (allFailing) {
- throw new NotificationException(getExceptionMessage(loggerMessage, exceptions));
- }
- } else {
- result.addAll(callable.retrieveWithProvider(providerList.get(0)));
- }
- return result;
- }
+ @Named("cached")
+ private FilterPreferencesModelBridge filterPreferencesModelBridge;
@Override
- public Collection getFilterPreferences(DocumentReference user)
- throws NotificationException
+ public Set getFilterPreferences(DocumentReference user) throws NotificationException
{
- return this.retrieveWithProviderExceptionWrapper(provider -> provider.getFilterPreferences(user),
- String.format("Error when trying to get filter preferences for user [%s]", user));
+
+ return this.filterPreferencesModelBridge.getFilterPreferences(user);
}
@Override
- public Collection getFilterPreferences(WikiReference wikiReference)
+ public Set getFilterPreferences(WikiReference wikiReference)
throws NotificationException
{
- return this.retrieveWithProviderExceptionWrapper(provider -> provider.getFilterPreferences(wikiReference),
- String.format("Error when trying to get filter preferences for wiki [%s]", wikiReference));
+ return this.filterPreferencesModelBridge.getFilterPreferences(wikiReference);
}
@Override
public Stream getFilterPreferences(
- Collection filterPreferences, NotificationFilter filter)
+ Collection filterPreferences, NotificationFilter filter)
{
return filterPreferences.stream().filter(preference -> filter.getName().equals(preference.getFilterName()));
}
@Override
public Stream getFilterPreferences(
- Collection filterPreferences, NotificationFilter filter,
- NotificationFilterType filterType)
+ Collection filterPreferences, NotificationFilter filter,
+ NotificationFilterType filterType)
{
- return getFilterPreferences(filterPreferences, filter).filter(
- preference -> preference.getFilterType() == filterType);
+ return getFilterPreferences(filterPreferences, filter)
+ .filter(preference -> preference.getFilterType() == filterType);
}
@Override
public Stream getFilterPreferences(
- Collection filterPreferences, NotificationFilter filter,
- NotificationFilterType filterType, NotificationFormat format)
+ Collection filterPreferences, NotificationFilter filter,
+ NotificationFilterType filterType, NotificationFormat format)
{
- return getFilterPreferences(filterPreferences, filter, filterType).filter(
- preference -> preference.getNotificationFormats().contains(format));
+ return getFilterPreferences(filterPreferences, filter, filterType)
+ .filter(preference -> preference.getNotificationFormats().contains(format));
}
@Override
public void saveFilterPreferences(DocumentReference user, Set filterPreferences)
+ throws NotificationException
{
- Map> preferencesMapping = new HashMap<>();
-
- for (NotificationFilterPreference filterPreference : filterPreferences) {
- // Try to get the corresponding provider, if no provider can be found, discard the save of the preference
- String providerHint = filterPreference.getProviderHint();
- if (componentManager.hasComponent(NotificationFilterPreferenceProvider.class, providerHint)) {
- if (!preferencesMapping.containsKey(providerHint)) {
- preferencesMapping.put(providerHint, new HashSet<>());
- }
-
- preferencesMapping.get(providerHint).add(filterPreference);
- }
- }
-
- // Once we have created the mapping, save all the preferences using their correct providers
- for (String providerHint : preferencesMapping.keySet()) {
- try {
- NotificationFilterPreferenceProvider provider =
- componentManager.getInstance(NotificationFilterPreferenceProvider.class, providerHint);
-
- provider.saveFilterPreferences(user, preferencesMapping.get(providerHint));
-
- } catch (ComponentLookupException e) {
- logger.error("Unable to retrieve the notification filter preference provider for hint [{}]:",
- providerHint, e);
- } catch (NotificationException e) {
- logger.warn("Unable save the filter preferences [{}] against the provider [{}]: [{}]",
- preferencesMapping.get(providerHint), providerHint, ExceptionUtils.getRootCauseMessage(e));
- }
- }
+ this.filterPreferencesModelBridge.saveFilterPreferences(user, filterPreferences);
}
@Override
public void deleteFilterPreference(DocumentReference user, String filterPreferenceId) throws NotificationException
{
- deleteFilterPreferences(user, Set.of(filterPreferenceId));
+ this.filterPreferencesModelBridge.deleteFilterPreference(user, filterPreferenceId);
}
@Override
public void deleteFilterPreferences(DocumentReference user, Set filterPreferenceIds)
throws NotificationException
{
- this.providerExceptionWrapper(provider -> provider.deleteFilterPreferences(user, filterPreferenceIds),
- String.format("Error when trying to remove filter preferences %s for user [%s]", filterPreferenceIds,
- user));
+ this.filterPreferencesModelBridge.deleteFilterPreferences(user, filterPreferenceIds);
}
@Override
public void deleteFilterPreference(WikiReference wikiReference, String filterPreferenceId)
throws NotificationException
{
- this.providerExceptionWrapper(provider -> provider.deleteFilterPreference(wikiReference, filterPreferenceId),
- String.format("Error when trying to remove filter preference [%s] for wiki [%s]", filterPreferenceId,
- wikiReference));
+ this.filterPreferencesModelBridge.deleteFilterPreference(wikiReference, filterPreferenceId);
}
-
@Override
public void setFilterPreferenceEnabled(DocumentReference user, String filterPreferenceId, boolean enabled)
- throws NotificationException
+ throws NotificationException
{
- this.providerExceptionWrapper(provider ->
- provider.setFilterPreferenceEnabled(user, filterPreferenceId, enabled),
- String.format("Error when trying to set filter preference [%s] enabled to [%s] for user [%s]",
- enabled,
- filterPreferenceId,
- user));
+ this.filterPreferencesModelBridge.setFilterPreferenceEnabled(user, filterPreferenceId, enabled);
}
@Override
public void setFilterPreferenceEnabled(WikiReference wikiReference, String filterPreferenceId, boolean enabled)
throws NotificationException
{
- this.providerExceptionWrapper(provider ->
- provider.setFilterPreferenceEnabled(wikiReference, filterPreferenceId, enabled),
- String.format("Error when trying to set filter preference [%s] enabled to [%s] for wiki [%s]",
- enabled,
- filterPreferenceId,
- wikiReference));
+ this.filterPreferencesModelBridge.setFilterPreferenceEnabled(wikiReference, filterPreferenceId, enabled);
}
@Override
public void setStartDateForUser(DocumentReference user, Date startDate) throws NotificationException
{
- this.providerExceptionWrapper(provider ->
- provider.setStartDateForUser(user, startDate),
- String.format("Error when trying to set start date to [%s] for user [%s]",
- startDate,
- user));
+ this.filterPreferencesModelBridge.setStartDateForUser(user, startDate);
}
}
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/UserProfileNotificationFilterPreferenceProvider.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/UserProfileNotificationFilterPreferenceProvider.java
deleted file mode 100644
index 8739d5a8a26e..000000000000
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/UserProfileNotificationFilterPreferenceProvider.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * See the NOTICE file distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.xwiki.notifications.filters.internal;
-
-import java.util.Date;
-import java.util.Set;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.xwiki.component.annotation.Component;
-import org.xwiki.model.reference.DocumentReference;
-import org.xwiki.model.reference.WikiReference;
-import org.xwiki.notifications.NotificationException;
-import org.xwiki.notifications.filters.NotificationFilterPreference;
-import org.xwiki.notifications.filters.NotificationFilterPreferenceProvider;
-
-/**
- * This is the default implementation of the role {@link NotificationFilterPreferenceProvider}. It allows retrieving
- * filter preferences from the user XObjects.
- *
- * @version $Id$
- * @since 9.8RC1
- */
-@Component
-@Named(UserProfileNotificationFilterPreferenceProvider.HINT)
-@Singleton
-public class UserProfileNotificationFilterPreferenceProvider implements NotificationFilterPreferenceProvider
-{
- /**
- * Hint for this provider.
- */
- public static final String HINT = "userProfile";
-
- @Inject
- @Named("cached")
- private FilterPreferencesModelBridge filterPreferencesModelBridge;
-
- @Override
- public Set getFilterPreferences(DocumentReference user) throws NotificationException
- {
- return this.filterPreferencesModelBridge.getFilterPreferences(user);
- }
-
- @Override
- public Set getFilterPreferences(WikiReference wikiReference)
- throws NotificationException
- {
- return this.filterPreferencesModelBridge.getFilterPreferences(wikiReference);
- }
-
- @Override
- public void saveFilterPreferences(DocumentReference user, Set filterPreferences)
- throws NotificationException
- {
- this.filterPreferencesModelBridge.saveFilterPreferences(user, filterPreferences);
- }
-
- @Override
- public void deleteFilterPreference(DocumentReference user, String filterPreferenceId) throws NotificationException
- {
- this.filterPreferencesModelBridge.deleteFilterPreference(user, filterPreferenceId);
- }
-
- @Override
- public void deleteFilterPreferences(DocumentReference user, Set filterPreferenceIds)
- throws NotificationException
- {
- this.filterPreferencesModelBridge.deleteFilterPreferences(user, filterPreferenceIds);
- }
-
- @Override
- public void deleteFilterPreference(WikiReference wikiReference, String filterPreferenceId)
- throws NotificationException
- {
- this.filterPreferencesModelBridge.deleteFilterPreference(wikiReference, filterPreferenceId);
- }
-
- @Override
- public void setFilterPreferenceEnabled(DocumentReference user, String filterPreferenceId, boolean enabled)
- throws NotificationException
- {
- this.filterPreferencesModelBridge.setFilterPreferenceEnabled(user, filterPreferenceId, enabled);
- }
-
- @Override
- public void setFilterPreferenceEnabled(WikiReference wikiReference, String filterPreferenceId, boolean enabled)
- throws NotificationException
- {
- this.filterPreferencesModelBridge.setFilterPreferenceEnabled(wikiReference, filterPreferenceId, enabled);
- }
-
- @Override
- public void setStartDateForUser(DocumentReference user, Date startDate) throws NotificationException
- {
- this.filterPreferencesModelBridge.setStartDateForUser(user, startDate);
- }
-}
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterExpressionGenerator.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterExpressionGenerator.java
index ef5bb2025df5..d46c4abd6367 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterExpressionGenerator.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterExpressionGenerator.java
@@ -28,6 +28,7 @@
import javax.inject.Inject;
import javax.inject.Singleton;
+import org.apache.commons.lang3.StringUtils;
import org.xwiki.component.annotation.Component;
import org.xwiki.model.reference.DocumentReference;
import org.xwiki.model.reference.EntityReferenceSerializer;
@@ -39,8 +40,6 @@
import org.xwiki.notifications.filters.expression.generics.AbstractOperatorNode;
import org.xwiki.notifications.filters.expression.generics.AbstractValueNode;
import org.xwiki.notifications.filters.internal.LocationOperatorNodeGenerator;
-import org.xwiki.notifications.filters.internal.UserProfileNotificationFilterPreferenceProvider;
-import org.xwiki.text.StringUtils;
import static org.xwiki.notifications.filters.expression.generics.ExpressionBuilder.not;
import static org.xwiki.notifications.filters.expression.generics.ExpressionBuilder.value;
@@ -204,7 +203,6 @@ private boolean isPageOnly(ScopeNotificationFilterPreference pref)
// filterExpression(Collection filterPreferences, NotificationFormat format,
// NotificationFilterType type, DocumentReference user).
return StringUtils.isNotBlank(pref.getPageOnly())
- && UserProfileNotificationFilterPreferenceProvider.HINT.equals(pref.getProviderHint())
&& pref.getEventTypes().isEmpty();
}
@@ -288,17 +286,18 @@ public AbstractOperatorNode filterExpression(Collection isAPageOnlyFilterPreferenceThatConcernAllEvents(
NotificationFormat format, NotificationFilterType type)
{
- return nfp -> isEnabledScopeNotificationFilterPreference(nfp)
+ return nfp -> isEnabledAndStoredScopeNotificationFilterPreference(nfp)
&& doesFilterTypeAndFormatMatch(nfp, format, type)
&& StringUtils.isNotBlank(nfp.getPageOnly());
}
- private boolean isEnabledScopeNotificationFilterPreference(NotificationFilterPreference nfp)
+ private boolean isEnabledAndStoredScopeNotificationFilterPreference(NotificationFilterPreference nfp)
{
- // This optimization can only works on preferences stored by the user, that's why we add a condition
- // on the provider hint.
+ // This optimization can only works on preferences stored by the user, that's why we add the final condition
return nfp.isEnabled() && ScopeNotificationFilter.FILTER_NAME.equals(nfp.getFilterName())
- && UserProfileNotificationFilterPreferenceProvider.HINT.equals(nfp.getProviderHint());
+ && (StringUtils.startsWith(nfp.getId(), NotificationFilterPreference.DB_STORED_FILTER_PREFIX)
+ // we also check for watchlist prefix in case of old migrated filters.
+ || StringUtils.startsWith(nfp.getId(), "watchlist_"));
}
private boolean doesFilterTypeAndFormatMatch(NotificationFilterPreference nfp, NotificationFormat format,
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterPreference.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterPreference.java
index 1faab1d6be8e..87423defd655 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterPreference.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterPreference.java
@@ -146,12 +146,6 @@ public String getFilterName()
return filterPreference.getFilterName();
}
- @Override
- public String getProviderHint()
- {
- return filterPreference.getProviderHint();
- }
-
@Override
public boolean isEnabled()
{
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/resources/META-INF/components.txt b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/resources/META-INF/components.txt
index 84fa677bd074..093bc7f4545e 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/resources/META-INF/components.txt
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/main/resources/META-INF/components.txt
@@ -17,7 +17,6 @@ org.xwiki.notifications.filters.internal.DeletedDocumentCleanUpFilterListener
org.xwiki.notifications.filters.internal.DeletedDocumentCleanUpFilterProcessingQueue
org.xwiki.notifications.filters.internal.LocationOperatorNodeGenerator
org.xwiki.notifications.filters.internal.SystemUserNotificationFilter
-org.xwiki.notifications.filters.internal.UserProfileNotificationFilterPreferenceProvider
org.xwiki.notifications.filters.internal.listener.DeletedWikiEventListener
org.xwiki.notifications.filters.internal.listener.DeleteUserEventListener
org.xwiki.notifications.filters.script.NotificationFiltersScriptService
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/test/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreferenceManagerTest.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/test/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreferenceManagerTest.java
index c35b98b6202a..e4dee496c1d8 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/test/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreferenceManagerTest.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/test/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreferenceManagerTest.java
@@ -24,29 +24,24 @@
import java.util.Set;
import java.util.stream.Collectors;
+import javax.inject.Named;
+
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.internal.util.collections.Sets;
import org.xwiki.model.reference.DocumentReference;
import org.xwiki.model.reference.WikiReference;
-import org.xwiki.notifications.NotificationException;
import org.xwiki.notifications.filters.NotificationFilter;
import org.xwiki.notifications.filters.NotificationFilterPreference;
-import org.xwiki.notifications.filters.NotificationFilterPreferenceProvider;
import org.xwiki.notifications.filters.NotificationFilterType;
import org.xwiki.test.junit5.mockito.ComponentTest;
-import org.xwiki.test.junit5.mockito.InjectComponentManager;
import org.xwiki.test.junit5.mockito.InjectMockComponents;
import org.xwiki.test.junit5.mockito.MockComponent;
-import org.xwiki.test.mockito.MockitoComponentManager;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -62,13 +57,11 @@ public class DefaultNotificationFilterPreferenceManagerTest
@InjectMockComponents
private DefaultNotificationFilterPreferenceManager filterPreferenceManager;
- private DocumentReference testUser;
-
@MockComponent
- private NotificationFilterPreferenceProvider testProvider;
+ @Named("cached")
+ private FilterPreferencesModelBridge filterPreferencesModelBridge;
- @InjectComponentManager
- private MockitoComponentManager componentManager;
+ private DocumentReference testUser;
@BeforeEach
public void setUp() throws Exception
@@ -82,7 +75,8 @@ void filterPreferences() throws Exception
NotificationFilterPreference filterPreference1 = mock(NotificationFilterPreference.class);
NotificationFilterPreference filterPreference2 = mock(NotificationFilterPreference.class);
- when(testProvider.getFilterPreferences(testUser)).thenReturn(Sets.newSet(filterPreference1, filterPreference2));
+ when(filterPreferencesModelBridge.getFilterPreferences(testUser))
+ .thenReturn(Sets.newSet(filterPreference1, filterPreference2));
Collection resultSet = filterPreferenceManager.getFilterPreferences(testUser);
@@ -146,44 +140,7 @@ void filterPreferencesWithFilterAndFilterType() throws Exception
void deleteFilterPreference() throws Exception
{
filterPreferenceManager.deleteFilterPreference(testUser, "myFilter");
-
- verify(testProvider).deleteFilterPreferences(testUser, Set.of("myFilter"));
- }
-
- @Test
- void deleteFilterPreferenceProviderException() throws Exception
- {
- String providerName1 = "providerName1";
- String providerName2 = "providerName2";
-
- NotificationFilterPreferenceProvider provider1 =
- componentManager.registerMockComponent(NotificationFilterPreferenceProvider.class, providerName1);
- NotificationFilterPreferenceProvider provider2 =
- componentManager.registerMockComponent(NotificationFilterPreferenceProvider.class, providerName2);
-
- String filterId = "filterId";
- doThrow(new NotificationException("error provider1")).when(provider1).deleteFilterPreferences(testUser,
- Set.of(filterId));
- filterPreferenceManager.deleteFilterPreference(testUser, filterId);
- verify(testProvider).deleteFilterPreferences(testUser, Set.of(filterId));
- verify(provider1).deleteFilterPreferences(testUser, Set.of(filterId));
- verify(provider2).deleteFilterPreferences(testUser, Set.of(filterId));
-
- doThrow(new NotificationException("error provider2")).when(provider2).deleteFilterPreferences(testUser,
- Set.of(filterId));
- filterPreferenceManager.deleteFilterPreference(testUser, filterId);
- verify(testProvider, times(2)).deleteFilterPreferences(testUser, Set.of(filterId));
- verify(provider1, times(2)).deleteFilterPreferences(testUser, Set.of(filterId));
- verify(provider2, times(2)).deleteFilterPreferences(testUser, Set.of(filterId));
-
- doThrow(new NotificationException("error testprovider")).when(testProvider).deleteFilterPreferences(testUser,
- Set.of(filterId));
- NotificationException notificationException = assertThrows(NotificationException.class,
- () -> filterPreferenceManager.deleteFilterPreference(testUser, filterId));
- assertEquals("Error when trying to remove filter preferences [filterId] for user [wiki:test.user] - "
- + "All providers called failed, see exceptions: [NotificationException: error testprovider,"
- + "NotificationException: error provider1,NotificationException: error provider2].",
- notificationException.getMessage());
+ verify(filterPreferencesModelBridge).deleteFilterPreference(testUser, "myFilter");
}
@Test
@@ -194,20 +151,15 @@ void setFilterPreferenceEnabled() throws Exception
filterPreferenceManager.setFilterPreferenceEnabled(new WikiReference("foo"), "myFilter3", true);
filterPreferenceManager.setFilterPreferenceEnabled(new WikiReference("foo"), "myFilter4", false);
- verify(testProvider).setFilterPreferenceEnabled(testUser, "myFilter1", true);
- verify(testProvider).setFilterPreferenceEnabled(testUser, "myFilter2", false);
- verify(testProvider).setFilterPreferenceEnabled(new WikiReference("foo"), "myFilter3", true);
- verify(testProvider).setFilterPreferenceEnabled(new WikiReference("foo"), "myFilter4", false);
+ verify(filterPreferencesModelBridge).setFilterPreferenceEnabled(testUser, "myFilter1", true);
+ verify(filterPreferencesModelBridge).setFilterPreferenceEnabled(testUser, "myFilter2", false);
+ verify(filterPreferencesModelBridge).setFilterPreferenceEnabled(new WikiReference("foo"), "myFilter3", true);
+ verify(filterPreferencesModelBridge).setFilterPreferenceEnabled(new WikiReference("foo"), "myFilter4", false);
}
@Test
void setStartDateForUser() throws Exception
{
- NotificationFilterPreferenceProvider provider1 =
- componentManager.registerMockComponent(NotificationFilterPreferenceProvider.class, "provider1");
- NotificationFilterPreferenceProvider provider2 =
- componentManager.registerMockComponent(NotificationFilterPreferenceProvider.class, "provider2");
-
DocumentReference user = new DocumentReference("xwiki", "XWiki", "User");
Date date = new Date();
@@ -215,8 +167,7 @@ void setStartDateForUser() throws Exception
filterPreferenceManager.setStartDateForUser(user, date);
// Checks
- verify(provider1).setStartDateForUser(eq(user), eq(date));
- verify(provider2).setStartDateForUser(eq(user), eq(date));
+ verify(filterPreferencesModelBridge).setStartDateForUser(eq(user), eq(date));
}
@Test
@@ -227,20 +178,7 @@ void saveFilterPreferences() throws Exception
NotificationFilterPreference pref2 = mock(NotificationFilterPreference.class, "pref2");
NotificationFilterPreference pref3 = mock(NotificationFilterPreference.class, "pref3");
- String providerName1 = "providerName1";
- String providerName2 = "providerName2";
-
- NotificationFilterPreferenceProvider provider1 =
- componentManager.registerMockComponent(NotificationFilterPreferenceProvider.class, providerName1);
- NotificationFilterPreferenceProvider provider2 =
- componentManager.registerMockComponent(NotificationFilterPreferenceProvider.class, providerName2);
-
- when(pref1.getProviderHint()).thenReturn(providerName1);
- when(pref2.getProviderHint()).thenReturn(providerName2);
- when(pref3.getProviderHint()).thenReturn(providerName1);
-
this.filterPreferenceManager.saveFilterPreferences(user, Set.of(pref1, pref2, pref3));
- verify(provider1).saveFilterPreferences(user, Set.of(pref1, pref3));
- verify(provider2).saveFilterPreferences(user, Set.of(pref2));
+ verify(filterPreferencesModelBridge).saveFilterPreferences(user, Set.of(pref1, pref2, pref3));
}
}
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/test/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterTest.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/test/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterTest.java
index 9c47e0cc11c2..4c9d63be0c84 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/test/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterTest.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-api/src/test/java/org/xwiki/notifications/filters/internal/scope/ScopeNotificationFilterTest.java
@@ -95,6 +95,7 @@ private NotificationFilterPreference mockNotificationFilterPreference(String ent
EntityReference resultReference, NotificationFilterType filterType, String eventName)
{
NotificationFilterPreference preference = mock(NotificationFilterPreference.class);
+ when(preference.getId()).thenReturn("NFP_343");
if (resultReference.getType() == EntityType.SPACE) {
when(preference.getPage()).thenReturn(entityStringValue);
}
@@ -117,8 +118,6 @@ private NotificationFilterPreference mockNotificationFilterPreference(String ent
when(serializer.serialize(eq(resultReference))).thenReturn(entityStringValue);
- when(preference.getProviderHint()).thenReturn("userProfile");
-
when(preference.getStartingDate()).thenReturn(new Date(0));
return preference;
@@ -268,7 +267,6 @@ void withTopLevelInclusiveFilters() throws Exception
DocumentReference documentReference = new DocumentReference("wikiA", "SpaceM", "DocumentN");
NotificationFilterPreference prefζ = mockNotificationFilterPreference("wikiA:SpaceM.DocumentN",
documentReference, NotificationFilterType.INCLUSIVE, null);
- when(prefζ.getProviderHint()).thenReturn("userProfile");
when(prefζ.getStartingDate()).thenReturn(new Date(99000));
Collection filterPreferences = Sets.newSet(prefγ, prefζ);
@@ -408,7 +406,6 @@ void targetableEvent()
DocumentReference documentReference = new DocumentReference("wikiA", "SpaceM", "DocumentN");
NotificationFilterPreference prefζ = mockNotificationFilterPreference("wikiA:SpaceM.DocumentN",
documentReference, NotificationFilterType.EXCLUSIVE, null);
- when(prefζ.getProviderHint()).thenReturn("userProfile");
Collection filterPreferences = Sets.newSet(prefγ, prefζ);
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreference.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreference.java
index 83cdda8077f2..b382a2998494 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreference.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/DefaultNotificationFilterPreference.java
@@ -49,8 +49,6 @@ public class DefaultNotificationFilterPreference implements NotificationFilterPr
private String filterName;
- private String providerHint;
-
private boolean enabled;
private boolean active;
@@ -105,7 +103,6 @@ public DefaultNotificationFilterPreference(NotificationFilterPreference notifica
this.id = notificationFilterPreference.getId();
this.filterName = notificationFilterPreference.getFilterName();
- this.providerHint = notificationFilterPreference.getProviderHint();
this.enabled = notificationFilterPreference.isEnabled();
this.active = notificationFilterPreference.isActive();
this.filterType = notificationFilterPreference.getFilterType();
@@ -142,7 +139,7 @@ public long getInternalId()
public void setInternalId(long internalId)
{
this.internalId = internalId;
- this.id = String.format("NFP_%d", internalId);
+ this.id = String.format("%s_%d", DB_STORED_FILTER_PREFIX, internalId);
}
/**
@@ -169,14 +166,6 @@ public void setFilterName(String filterName)
this.filterName = filterName;
}
- /**
- * @param providerHint the name of the provider that have built this preference
- */
- public void setProviderHint(String providerHint)
- {
- this.providerHint = providerHint;
- }
-
/**
* @param enabled if the preference is enabled or not
*/
@@ -280,12 +269,6 @@ public String getFilterName()
return filterName;
}
- @Override
- public String getProviderHint()
- {
- return providerHint;
- }
-
@Override
public boolean isEnabled()
{
@@ -429,7 +412,6 @@ public String toString()
+ ", internalId=" + internalId
+ ", owner='" + owner + '\''
+ ", filterName='" + filterName + '\''
- + ", providerHint='" + providerHint + '\''
+ ", enabled=" + enabled
+ ", active=" + active
+ ", filterType=" + filterType
@@ -462,7 +444,6 @@ public boolean equals(Object o)
.append(id, other.id)
.append(owner, other.owner)
.append(filterName, other.filterName)
- .append(providerHint, other.providerHint)
.append(filterType, other.filterType)
.append(notificationFormats, other.notificationFormats)
.append(startingDate, other.startingDate)
@@ -484,7 +465,6 @@ public int hashCode()
.append(id)
.append(owner)
.append(filterName)
- .append(providerHint)
.append(filterType)
.append(notificationFormats)
.append(startingDate)
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/NotificationFilterPreferenceStore.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/NotificationFilterPreferenceStore.java
index 65877d9e7e91..6ae81e1a2680 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/NotificationFilterPreferenceStore.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/NotificationFilterPreferenceStore.java
@@ -42,8 +42,6 @@
import org.xwiki.notifications.filters.NotificationFilterPreference;
import org.xwiki.notifications.filters.internal.event.NotificationFilterPreferenceAddOrUpdatedEvent;
import org.xwiki.notifications.filters.internal.event.NotificationFilterPreferenceDeletedEvent;
-import org.xwiki.notifications.preferences.internal.UserProfileNotificationPreferenceProvider;
-import org.xwiki.notifications.preferences.internal.WikiNotificationPreferenceProvider;
import org.xwiki.observation.ObservationManager;
import org.xwiki.query.Query;
import org.xwiki.query.QueryException;
@@ -167,7 +165,7 @@ public List getPreferencesOfUser(DocumentRe
throws NotificationException
{
try {
- return this.getPreferencesOfEntity(user, UserProfileNotificationPreferenceProvider.NAME);
+ return this.getPreferencesOfEntity(user);
} catch (QueryException e) {
throw new NotificationException(String.format(
"Error while loading the notification filter preferences of the user [%s].", user.toString()), e);
@@ -186,7 +184,7 @@ public List getPreferencesOfWiki(WikiRefere
throws NotificationException
{
try {
- return getPreferencesOfEntity(wikiReference, WikiNotificationPreferenceProvider.NAME);
+ return getPreferencesOfEntity(wikiReference);
} catch (QueryException e) {
throw new NotificationException(
String.format("Error while loading the notification filter preferences of the wiki [%s].",
@@ -224,8 +222,8 @@ public Set getPaginatedFilterPreferences(in
});
}
- private List getPreferencesOfEntity(EntityReference entityReference,
- String providerHint) throws QueryException
+ private List getPreferencesOfEntity(EntityReference entityReference)
+ throws QueryException
{
if (entityReference == null) {
return Collections.emptyList();
@@ -239,13 +237,7 @@ private List getPreferencesOfEntity(EntityR
Query.HQL);
query.bindValue("owner", serializedEntity);
- List results = query.execute();
-
- for (DefaultNotificationFilterPreference preference : results) {
- preference.setProviderHint(providerHint);
- }
-
- return results;
+ return query.execute();
});
}
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/UserAddedEventListener.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/UserAddedEventListener.java
index 4cf7cd60559d..c248aaddb05b 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/UserAddedEventListener.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/UserAddedEventListener.java
@@ -113,7 +113,6 @@ private void copyFilterPreferences(DocumentReference userDocReference) throws No
for (NotificationFilterPreference filterPreference : filterPreferences) {
DefaultNotificationFilterPreference preference =
new DefaultNotificationFilterPreference(filterPreference, false);
- preference.setProviderHint(UserProfileNotificationFilterPreferenceProvider.HINT);
userFilterPreferences.add(preference);
}
this.notificationFilterPreferenceManager.saveFilterPreferences(userDocReference, userFilterPreferences);
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/migrators/NotificationFilterPreferencesMigrator.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/migrators/NotificationFilterPreferencesMigrator.java
index a123a05313bd..7e521ac73555 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/migrators/NotificationFilterPreferencesMigrator.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/migrators/NotificationFilterPreferencesMigrator.java
@@ -206,7 +206,6 @@ private void handleObject(List preferencesToConver
filterFormats.add(NotificationFormat.valueOf(format.toUpperCase()));
}
- preference.setProviderHint("userProfile");
preference.setFilterName(obj.getStringValue(FIELD_FILTER_NAME));
preference.setEnabled(obj.getIntValue(FIELD_IS_ENABLED, 1) == 1);
preference.setActive(obj.getIntValue(FIELD_IS_ACTIVE, 1) == 1);
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/migration/R160300000XWIKI17243DataMigration.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/migration/R160300000XWIKI17243DataMigration.java
index 956aa2c90db4..9b82837e23ab 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/migration/R160300000XWIKI17243DataMigration.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/migration/R160300000XWIKI17243DataMigration.java
@@ -43,7 +43,6 @@
import org.xwiki.notifications.filters.NotificationFilterType;
import org.xwiki.notifications.filters.internal.DefaultNotificationFilterPreference;
import org.xwiki.notifications.filters.internal.NotificationFilterPreferenceStore;
-import org.xwiki.notifications.filters.internal.UserProfileNotificationFilterPreferenceProvider;
import org.xwiki.notifications.filters.internal.scope.ScopeNotificationFilter;
import org.xwiki.query.Query;
import org.xwiki.query.QueryException;
@@ -263,7 +262,6 @@ private DefaultNotificationFilterPreference createNotificationFilterPreference(S
pref.setId(id);
pref.setEnabled(true);
pref.setNotificationFormats(Set.of(NotificationFormat.values()));
- pref.setProviderHint(UserProfileNotificationFilterPreferenceProvider.HINT);
pref.setFilterName(ScopeNotificationFilter.FILTER_NAME);
pref.setFilterType(NotificationFilterType.INCLUSIVE);
return pref;
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/NotificationFilterPreferenceStoreTest.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/NotificationFilterPreferenceStoreTest.java
index 7e8ba9f34fee..c11582399f82 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/NotificationFilterPreferenceStoreTest.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/NotificationFilterPreferenceStoreTest.java
@@ -280,7 +280,5 @@ void getPreferencesOfUser() throws QueryException, NotificationException
verify(this.context).setWikiReference(new WikiReference("subwiki"));
verify(this.context).setWikiReference(CURRENT_WIKI_REFERENCE);
verify(xwikiQuery).bindValue("owner", serializedRef);
- verify(pref1).setProviderHint(UserProfileNotificationFilterPreferenceProvider.HINT);
- verify(pref2).setProviderHint(UserProfileNotificationFilterPreferenceProvider.HINT);
}
}
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/UserAddedEventListenerTest.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/UserAddedEventListenerTest.java
index 0b4c7aef2a0a..577569cbf616 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/UserAddedEventListenerTest.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/UserAddedEventListenerTest.java
@@ -102,17 +102,14 @@ void onEvent() throws NotificationException, XWikiException
Set expectedSet = new HashSet<>();
DefaultNotificationFilterPreference expectedFilterPref1 = new DefaultNotificationFilterPreference();
expectedFilterPref1.setFilterName("filter1");
- expectedFilterPref1.setProviderHint(UserProfileNotificationFilterPreferenceProvider.HINT);
expectedSet.add(expectedFilterPref1);
DefaultNotificationFilterPreference expectedFilterPref2 = new DefaultNotificationFilterPreference();
expectedFilterPref2.setFilterName("filter2");
- expectedFilterPref2.setProviderHint(UserProfileNotificationFilterPreferenceProvider.HINT);
expectedSet.add(expectedFilterPref2);
DefaultNotificationFilterPreference expectedFilterPref3 = new DefaultNotificationFilterPreference();
expectedFilterPref3.setFilterName("filter3");
- expectedFilterPref3.setProviderHint(UserProfileNotificationFilterPreferenceProvider.HINT);
expectedSet.add(expectedFilterPref3);
when(userDoc.getXObjects(UserAddedEventListener.TOGGLEABLE_FILTER_PREFERENCE_CLASS))
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/migrators/NotificationFilterPreferencesMigratorTest.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/migrators/NotificationFilterPreferencesMigratorTest.java
index f1a9837b5ba5..d01704d2d820 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/migrators/NotificationFilterPreferencesMigratorTest.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/test/java/org/xwiki/notifications/filters/internal/migrators/NotificationFilterPreferencesMigratorTest.java
@@ -195,7 +195,6 @@ private DefaultNotificationFilterPreference createExpectedPreference(
preference.setEventTypes(eventType);
preference.setNotificationFormats(formats);
preference.setFilterType(filterType);
- preference.setProviderHint("userProfile");
preference.setFilterName(filterName);
preference.setEnabled(isEnabled);
preference.setStartingDate(date);
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/main/java/org/xwiki/notifications/filters/watch/WatchedLocationReference.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/main/java/org/xwiki/notifications/filters/watch/WatchedLocationReference.java
index 0f4f3a279d44..06bbd7cdefc2 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/main/java/org/xwiki/notifications/filters/watch/WatchedLocationReference.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/main/java/org/xwiki/notifications/filters/watch/WatchedLocationReference.java
@@ -34,7 +34,6 @@
import org.xwiki.notifications.filters.internal.scope.ScopeNotificationFilter;
import org.xwiki.notifications.filters.internal.scope.ScopeNotificationFilterLocationStateComputer;
import org.xwiki.notifications.filters.internal.scope.ScopeNotificationFilterPreference;
-import org.xwiki.notifications.preferences.internal.UserProfileNotificationPreferenceProvider;
/**
* Reference of a location to watch.
@@ -142,7 +141,6 @@ private DefaultNotificationFilterPreference createFilterPreference()
filterPreference.setFilterType(NotificationFilterType.INCLUSIVE);
filterPreference.setFilterName(ScopeNotificationFilter.FILTER_NAME);
filterPreference.setNotificationFormats(ALL_NOTIFICATION_FORMATS);
- filterPreference.setProviderHint(UserProfileNotificationPreferenceProvider.NAME);
filterPreference.setActive(false);
filterPreference.setStartingDate(new Date());
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/main/java/org/xwiki/notifications/filters/watch/WatchedUserReference.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/main/java/org/xwiki/notifications/filters/watch/WatchedUserReference.java
index 99172b4f810b..4b35b7543c7d 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/main/java/org/xwiki/notifications/filters/watch/WatchedUserReference.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/main/java/org/xwiki/notifications/filters/watch/WatchedUserReference.java
@@ -31,7 +31,6 @@
import org.xwiki.notifications.filters.internal.DefaultNotificationFilterPreference;
import org.xwiki.notifications.filters.internal.user.EventUserFilter;
import org.xwiki.notifications.filters.internal.user.EventUserFilterPreferencesGetter;
-import org.xwiki.notifications.preferences.internal.UserProfileNotificationPreferenceProvider;
/**
* Reference to a user to watch.
@@ -96,7 +95,6 @@ public NotificationFilterPreference createInclusiveFilterPreference()
filterPreference.setFilterType(NotificationFilterType.INCLUSIVE);
filterPreference.setFilterName(EventUserFilter.FILTER_NAME);
filterPreference.setNotificationFormats(Sets.newHashSet(NotificationFormat.values()));
- filterPreference.setProviderHint(UserProfileNotificationPreferenceProvider.NAME);
filterPreference.setActive(true);
filterPreference.setStartingDate(new Date());
filterPreference.setUser(userId);
@@ -113,7 +111,6 @@ public NotificationFilterPreference createExclusiveFilterPreference()
filterPreference.setFilterType(NotificationFilterType.EXCLUSIVE);
filterPreference.setFilterName(EventUserFilter.FILTER_NAME);
filterPreference.setNotificationFormats(Sets.newHashSet(NotificationFormat.values()));
- filterPreference.setProviderHint(UserProfileNotificationPreferenceProvider.NAME);
filterPreference.setActive(false);
filterPreference.setStartingDate(new Date());
filterPreference.setUser(userId);
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/test/java/org/xwiki/notifications/filters/watch/WatchedLocationReferenceTest.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/test/java/org/xwiki/notifications/filters/watch/WatchedLocationReferenceTest.java
index 937c714d08a1..8118c124e6ce 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/test/java/org/xwiki/notifications/filters/watch/WatchedLocationReferenceTest.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-watch/src/test/java/org/xwiki/notifications/filters/watch/WatchedLocationReferenceTest.java
@@ -179,7 +179,6 @@ void createInclusiveFilterPreference()
filterPreference.setFilterType(NotificationFilterType.INCLUSIVE);
filterPreference.setFilterName(ScopeNotificationFilter.FILTER_NAME);
filterPreference.setNotificationFormats(Set.of(NotificationFormat.values()));
- filterPreference.setProviderHint(UserProfileNotificationPreferenceProvider.NAME);
filterPreference.setActive(false);
filterPreference.setPageOnly(this.serializedReference);
@@ -216,7 +215,6 @@ void createExclusiveFilterPreference()
filterPreference.setFilterType(NotificationFilterType.EXCLUSIVE);
filterPreference.setFilterName(ScopeNotificationFilter.FILTER_NAME);
filterPreference.setNotificationFormats(Set.of(NotificationFormat.values()));
- filterPreference.setProviderHint(UserProfileNotificationPreferenceProvider.NAME);
filterPreference.setActive(false);
filterPreference.setPage(this.serializedReference);
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/main/java/org/xwiki/notifications/sources/internal/DefaultNotificationParametersFactory.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/main/java/org/xwiki/notifications/sources/internal/DefaultNotificationParametersFactory.java
index 45b572b7819f..0699a93ebe9c 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/main/java/org/xwiki/notifications/sources/internal/DefaultNotificationParametersFactory.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/main/java/org/xwiki/notifications/sources/internal/DefaultNotificationParametersFactory.java
@@ -538,7 +538,6 @@ private void handleLocationParameter(String locations, NotificationParameters pa
pref.setFilterName(ScopeNotificationFilter.FILTER_NAME);
pref.setFilterType(NotificationFilterType.INCLUSIVE);
pref.setNotificationFormats(formats);
- pref.setProviderHint("FACTORY");
switch (property) {
case WIKI:
pref.setWiki(locationArray[i]);
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/main/java/org/xwiki/notifications/sources/internal/TagNotificationFilterPreference.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/main/java/org/xwiki/notifications/sources/internal/TagNotificationFilterPreference.java
index 5360f509ddf7..4474e15a871a 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/main/java/org/xwiki/notifications/sources/internal/TagNotificationFilterPreference.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/main/java/org/xwiki/notifications/sources/internal/TagNotificationFilterPreference.java
@@ -79,12 +79,6 @@ public String getFilterName()
return TagNotificationFilter.NAME;
}
- @Override
- public String getProviderHint()
- {
- return "FACTORY";
- }
-
@Override
public boolean isEnabled()
{
diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/test/java/org/xwiki/notifications/sources/internal/DefaultNotificationParametersFactoryTest.java b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/test/java/org/xwiki/notifications/sources/internal/DefaultNotificationParametersFactoryTest.java
index 59bb6fdb9fd6..b71abc7a69ac 100644
--- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/test/java/org/xwiki/notifications/sources/internal/DefaultNotificationParametersFactoryTest.java
+++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-sources/src/test/java/org/xwiki/notifications/sources/internal/DefaultNotificationParametersFactoryTest.java
@@ -397,7 +397,6 @@ private DefaultNotificationFilterPreference getFilterPreference(String property,
filterPreference.setFilterName(ScopeNotificationFilter.FILTER_NAME);
filterPreference.setFilterType(NotificationFilterType.INCLUSIVE);
filterPreference.setNotificationFormats(Collections.singleton(NotificationFormat.ALERT));
- filterPreference.setProviderHint("FACTORY");
return filterPreference;
}
}