mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for CLOUD-2248: Disabling Activity Feeds for a specific site doesn't work.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@59475 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -225,6 +225,9 @@
|
|||||||
<property name="activityService">
|
<property name="activityService">
|
||||||
<ref bean="activityService"/>
|
<ref bean="activityService"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="tenantService">
|
||||||
|
<ref bean="tenantService"/>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="applicationScriptUtils" parent="baseJavaScriptExtension" class="org.alfresco.repo.jscript.ApplicationScriptUtils">
|
<bean id="applicationScriptUtils" parent="baseJavaScriptExtension" class="org.alfresco.repo.jscript.ApplicationScriptUtils">
|
||||||
|
@@ -21,6 +21,7 @@ package org.alfresco.repo.activities.script;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
|
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
|
||||||
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
import org.alfresco.service.cmr.activities.ActivityService;
|
import org.alfresco.service.cmr.activities.ActivityService;
|
||||||
import org.alfresco.service.cmr.activities.FeedControl;
|
import org.alfresco.service.cmr.activities.FeedControl;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -35,6 +36,7 @@ import org.mozilla.javascript.Scriptable;
|
|||||||
public final class Activity extends BaseScopableProcessorExtension
|
public final class Activity extends BaseScopableProcessorExtension
|
||||||
{
|
{
|
||||||
private ActivityService activityService;
|
private ActivityService activityService;
|
||||||
|
private TenantService tenantService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the activity service
|
* Set the activity service
|
||||||
@@ -46,6 +48,15 @@ public final class Activity extends BaseScopableProcessorExtension
|
|||||||
this.activityService = activityService;
|
this.activityService = activityService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the tenant service
|
||||||
|
*
|
||||||
|
* @param tenantService the tenant service
|
||||||
|
*/
|
||||||
|
public void setTenantService(TenantService tenantService)
|
||||||
|
{
|
||||||
|
this.tenantService = tenantService;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Post Activity
|
* Post Activity
|
||||||
@@ -127,9 +138,12 @@ public final class Activity extends BaseScopableProcessorExtension
|
|||||||
{
|
{
|
||||||
List<FeedControl> feedControls = activityService.getFeedControls();
|
List<FeedControl> feedControls = activityService.getFeedControls();
|
||||||
Object[] results = new Object[feedControls.size()];
|
Object[] results = new Object[feedControls.size()];
|
||||||
for (int i=0; i < feedControls.size(); i++)
|
|
||||||
|
int i = 0;
|
||||||
|
for(FeedControl fc : feedControls)
|
||||||
{
|
{
|
||||||
results[i] = feedControls.get(i);
|
results[i] = new FeedControl(this.tenantService.getBaseName(fc.getSiteId()), fc.getAppToolId());
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return Context.getCurrentContext().newArray(getScope(), results);
|
return Context.getCurrentContext().newArray(getScope(), results);
|
||||||
}
|
}
|
||||||
@@ -142,7 +156,7 @@ public final class Activity extends BaseScopableProcessorExtension
|
|||||||
*/
|
*/
|
||||||
public void setFeedControl(String siteId, String appToolId)
|
public void setFeedControl(String siteId, String appToolId)
|
||||||
{
|
{
|
||||||
activityService.setFeedControl(new FeedControl(siteId, appToolId));
|
activityService.setFeedControl(new FeedControl(getTenantSpecificSiteId(siteId), appToolId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,6 +167,12 @@ public final class Activity extends BaseScopableProcessorExtension
|
|||||||
*/
|
*/
|
||||||
public void unsetFeedControl(String siteId, String appToolId)
|
public void unsetFeedControl(String siteId, String appToolId)
|
||||||
{
|
{
|
||||||
activityService.unsetFeedControl(new FeedControl(siteId, appToolId));
|
activityService.unsetFeedControl(new FeedControl(getTenantSpecificSiteId(siteId), appToolId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CLOUD-2248
|
||||||
|
private String getTenantSpecificSiteId(String siteId)
|
||||||
|
{
|
||||||
|
return this.tenantService.getName(siteId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user