diff --git a/xwiki-platform-core/pom.xml b/xwiki-platform-core/pom.xml index 084a274f4be..6cb7cfa1e67 100644 --- a/xwiki-platform-core/pom.xml +++ b/xwiki-platform-core/pom.xml @@ -158,11 +158,61 @@ allowed + + true + java.method.numberOfParametersChanged + method org.xwiki.rest.model.jaxb.Pages org.xwiki.rest.resources.pages.PageChildrenResource::getPageChildren(java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Boolean) throws org.xwiki.rest.XWikiRestException + method org.xwiki.rest.model.jaxb.Pages org.xwiki.rest.resources.pages.PageChildrenResource::getPageChildren(java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Boolean, java.lang.String, java.lang.String) throws org.xwiki.rest.XWikiRestException + + + + + Changes in unstable API of notification for watching pages. + allowed + + + true + java.field.removed + field org.xwiki.notifications.filters.watch.WatchedEntityReference.WatchedStatus.NOT_WATCHED + + + true + java.field.removed + field org.xwiki.notifications.filters.watch.WatchedEntityReference.WatchedStatus.WATCHED_FOR_SOME_EVENTS_OR_FORMATS + + + true + java.method.parameterTypeChanged + parameter org.xwiki.notifications.filters.watch.WatchedEntityReference.WatchedStatus org.xwiki.notifications.filters.watch.WatchedEntityReference::getWatchedStatus(===org.xwiki.model.reference.DocumentReference===) throws org.xwiki.notifications.NotificationException + parameter org.xwiki.notifications.filters.watch.WatchedEntityReference.WatchedStatus org.xwiki.notifications.filters.watch.WatchedEntityReference::getWatchedStatus(===org.xwiki.user.UserReference===) throws org.xwiki.notifications.NotificationException + 0 + + + true + java.method.parameterTypeChanged + parameter org.xwiki.notifications.filters.watch.WatchedEntityReference.WatchedStatus org.xwiki.notifications.filters.watch.WatchedEntityReference::getWatchedStatus(===org.xwiki.model.reference.DocumentReference===) throws org.xwiki.notifications.NotificationException @ org.xwiki.notifications.filters.watch.WatchedUserReference + parameter org.xwiki.notifications.filters.watch.WatchedEntityReference.WatchedStatus org.xwiki.notifications.filters.watch.WatchedUserReference::getWatchedStatus(===org.xwiki.user.UserReference===) throws org.xwiki.notifications.NotificationException + 0 + + + + + Watch page API changes to be able to compute it more exactly + highlight + + + true + java.method.numberOfParametersChanged + method void org.xwiki.notifications.filters.watch.WatchedLocationReference::<init>(org.xwiki.model.reference.EntityReference, java.lang.String, org.xwiki.model.reference.EntityReferenceResolver<java.lang.String>, org.xwiki.notifications.filters.internal.scope.ScopeNotificationFilterLocationStateComputer, org.xwiki.notifications.filters.NotificationFilterPreferenceManager) + method void org.xwiki.notifications.filters.watch.WatchedLocationReference::<init>(org.xwiki.model.reference.EntityReference, org.xwiki.component.manager.ComponentManager) + Simplify future extensions of this API. + true java.method.numberOfParametersChanged - method org.xwiki.rest.model.jaxb.Pages org.xwiki.rest.resources.pages.PageChildrenResource::getPageChildren(java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Boolean) throws org.xwiki.rest.XWikiRestException - method org.xwiki.rest.model.jaxb.Pages org.xwiki.rest.resources.pages.PageChildrenResource::getPageChildren(java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Boolean, java.lang.String, java.lang.String) throws org.xwiki.rest.XWikiRestException + method void org.xwiki.notifications.filters.watch.WatchedUserReference::<init>(java.lang.String, org.xwiki.notifications.filters.internal.user.EventUserFilterPreferencesGetter, org.xwiki.notifications.filters.NotificationFilterPreferenceManager) + method void org.xwiki.notifications.filters.watch.WatchedUserReference::<init>(java.lang.String, org.xwiki.notifications.filters.internal.user.EventUserFilterPreferencesGetter, org.xwiki.notifications.filters.NotificationFilterPreferenceManager, org.xwiki.user.UserReferenceSerializer<org.xwiki.model.reference.DocumentReference>) + Simplify future extensions of this API. 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/WatchedEntitiesManager.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/WatchedEntitiesManager.java index b259068bc19..013f846daca 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/WatchedEntitiesManager.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/WatchedEntitiesManager.java @@ -43,8 +43,9 @@ public interface WatchedEntitiesManager * @param entity the entity to watch * @param user user that will watch the entity * @throws NotificationException if an error happens + * @deprecated use {@link #watch(WatchedEntityReference, UserReference)}. */ - @Deprecated + @Deprecated(since = "16.5.0RC1") void watchEntity(WatchedEntityReference entity, DocumentReference user) throws NotificationException; /** @@ -53,10 +54,13 @@ public interface WatchedEntitiesManager * @param user the user for whom to create the filter * @return {@code true} if a new filter has been created * @throws NotificationException in case of problem to save the changes - * @since 16.4.0RC1 + * @since 16.5.0RC1 */ @Unstable - boolean watch(WatchedEntityReference entity, UserReference user) throws NotificationException; + default boolean watch(WatchedEntityReference entity, UserReference user) throws NotificationException + { + return false; + } /** * Remove filter related to watching the specified location be it inclusive or exclusive. @@ -64,10 +68,13 @@ public interface WatchedEntitiesManager * @param user the user for whom to remove the filter * @return {@code true} if a filter has been removed * @throws NotificationException in case of problem to save the changes - * @since 16.4.0RC1 + * @since 16.5.0RC1 */ @Unstable - boolean removeWatchFilter(WatchedEntityReference entity, UserReference user) throws NotificationException; + default boolean removeWatchFilter(WatchedEntityReference entity, UserReference user) throws NotificationException + { + return false; + } /** * Add an exclusive filter to ignore the specified location if it's not ignored yet. @@ -75,10 +82,13 @@ public interface WatchedEntitiesManager * @param user the user for whom to create the filter * @return {@code true} if a new filter has been created * @throws NotificationException in case of problem to save the changes - * @since 16.4.0RC1 + * @since 16.5.0RC1 */ @Unstable - boolean block(WatchedEntityReference entity, UserReference user) throws NotificationException; + default boolean block(WatchedEntityReference entity, UserReference user) throws NotificationException + { + return false; + } /** * Remove a filter to stop watching the specified entity. @@ -86,8 +96,9 @@ public interface WatchedEntitiesManager * @param entity the entity to watch * @param user user that will watch the entity * @throws NotificationException if an error happens + * @deprecated use {@link #block(WatchedEntityReference, UserReference)}. */ - @Deprecated + @Deprecated(since = "16.5.0RC1") void unwatchEntity(WatchedEntityReference entity, DocumentReference user) throws NotificationException; /** 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/WatchedEntityReference.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/WatchedEntityReference.java index 1139aad968c..1806a1ef921 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/WatchedEntityReference.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/WatchedEntityReference.java @@ -52,14 +52,14 @@ enum WatchedStatus /** * The entity is watched for all events and all formats through a filter placed on an ancestor. - * @since 16.4.0RC1 + * @since 16.5.0RC1 */ @Unstable WATCHED_BY_ANCESTOR_FOR_ALL_EVENTS_AND_FORMATS(true, false), /** * The entity and its children are watched for all events and all formats. - * @since 16.4.0RC1 + * @since 16.5.0RC1 */ @Unstable WATCHED_WITH_CHILDREN_FOR_ALL_EVENTS_AND_FORMATS(true, false), @@ -78,21 +78,21 @@ enum WatchedStatus /** * The entity is ignored for all events and all formats through a filter placed on an ancestor. - * @since 16.4.0RC1 + * @since 16.5.0RC1 */ @Unstable BLOCKED_BY_ANCESTOR_FOR_ALL_EVENTS_AND_FORMATS(false, true), /** * The entity and its children are ignored for all events and all formats. - * @since 16.4.0RC1 + * @since 16.5.0RC1 */ @Unstable BLOCKED_WITH_CHILDREN_FOR_ALL_EVENTS_AND_FORMATS(false, true), /** * There is a filter for the exact location of the entity but it concerns a subset of event types or formats. - * @since 16.4.0RC1 + * @since 16.5.0RC1 */ @Unstable CUSTOM(false, false); @@ -135,10 +135,13 @@ public boolean isBlocked() * @param userReference the user for whom to check if the entity is watched or not * @return the specific watched status of the entity by the given user * @throws NotificationException in case of errors - * @since 16.4.0RC1 + * @since 16.5.0RC1 */ @Unstable - WatchedStatus getWatchedStatus(UserReference userReference) throws NotificationException; + default WatchedStatus getWatchedStatus(UserReference userReference) throws NotificationException + { + return WatchedStatus.CUSTOM; + } /** * Try to retrieve the first ancestor of the location which have a status whose status is watched or blocked. @@ -151,19 +154,23 @@ public boolean isBlocked() * @see WatchedStatus#isWatched() * @see WatchedStatus#isBlocked() * @throws NotificationException in case of problem for computing the status - * @since 16.4.0RC1 + * @since 16.5.0RC1 */ @Unstable - Optional> getFirstFilteredAncestor(UserReference userReference) - throws NotificationException; + default Optional> getFirstFilteredAncestor(UserReference userReference) + throws NotificationException + { + return Optional.empty(); + } /** * @param userReference a user * @return {@code true} if the given user watch the current entity reference for any event type or format. * @throws NotificationException if an error happens * @since 9.9RC1 + * @deprecated use {@link #getWatchedStatus(UserReference)}. */ - @Deprecated + @Deprecated(since = "16.5.0RC1") boolean isWatched(DocumentReference userReference) throws NotificationException; /** @@ -171,8 +178,9 @@ Optional> getFirstFilteredAncestor(UserRefe * @return {@code true} if the given user watch the current entity reference for all events. * @throws NotificationException if an error happens * @since 12.8RC1 + * @deprecated use {@link #getWatchedStatus(UserReference)}. */ - @Deprecated + @Deprecated(since = "16.5.0RC1") default boolean isWatchedWithAllEventTypes(DocumentReference userReference) throws NotificationException { return isWatched(userReference); 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 d9bbfcb2473..631eba1b495 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 @@ -117,7 +117,15 @@ public WatchedStatus getWatchedStatus(UserReference userReference) throws Notifi return getWatchedStatus(userDocReference); } - private WatchedStatus getWatchedStatus(DocumentReference userReference) throws NotificationException + /** + * Retrieve the specific watched status of an entity for the given user. + * + * @param userReference the user for whom to check if the entity is watched or not + * @return the specific watched status of the entity by the given user + * @throws NotificationException in case of errors + * @since 15.5RC1 + */ + public WatchedStatus getWatchedStatus(DocumentReference userReference) throws NotificationException { Collection filterPreferences = notificationFilterPreferenceManager.getFilterPreferences(userReference);