Skip to content

Commit

Permalink
Bug #8896
Browse files Browse the repository at this point in the history
The name of the subscription activation parameter is now a constant defined in
the ResourceSubscriptionService. Any components that supports such a parameter
have to use it instead of its own parameter name. With such a constant, the
management of subscriptions related to this parameter can be done automatically
by the subscription service.
  • Loading branch information
mmoqui committed Nov 18, 2019
1 parent 880e10d commit 1972f3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
</profiles>
<parameters>
<parameter>
<!-- the name of the parameter is defined by the ResourceSubscriptionService interface as it
is used to automatically listen any value change of this parameter -->
<name>useSubscription</name>
<label>
<message lang="fr">Gestion de l'abonnement</message>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.silverpeas.core.contribution.content.wysiwyg.notification.WysiwygEvent;
import org.silverpeas.core.node.model.NodePK;
import org.silverpeas.core.notification.system.CDIResourceEventListener;
import org.silverpeas.core.subscription.ResourceSubscriptionService;

import javax.inject.Inject;

Expand All @@ -56,8 +57,8 @@ private void notifyUsersAboutChange(WysiwygContent content) {
String componentId = content.getContribution().getContributionId().getComponentInstanceId();

// If parameter useSubscription is used
if ("yes".equals(
organisationController.getComponentParameterValue(componentId, "useSubscription"))) {
if ("yes".equals(organisationController.getComponentParameterValue(componentId,
ResourceSubscriptionService.Constants.SUBSCRIPTION_PARAMETER))) {
if (isAboutWebPage(content)) {
WebPagesUserNotifier.notify(new NodePK("0", componentId), userId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.silverpeas.core.index.indexing.model.FullIndexEntry;
import org.silverpeas.core.index.indexing.model.IndexEngineProxy;
import org.silverpeas.core.node.model.NodePK;
import org.silverpeas.core.subscription.ResourceSubscriptionService;
import org.silverpeas.core.subscription.SubscriptionService;
import org.silverpeas.core.subscription.SubscriptionServiceProvider;
import org.silverpeas.core.subscription.service.ComponentSubscription;
Expand Down Expand Up @@ -122,7 +123,8 @@ private SubscriptionService getSubscribeService() {
* @return boolean
*/
public boolean isSubscriptionUsed() {
return StringUtil.getBooleanValue(getComponentParameterValue("useSubscription"));
return StringUtil.getBooleanValue(
getComponentParameterValue(ResourceSubscriptionService.Constants.SUBSCRIPTION_PARAMETER));
}

/*
Expand Down

0 comments on commit 1972f3d

Please sign in to comment.