mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
104368: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud) 104301: Merged DEV to 5.0.N (5.0.2) 104289: MNT-14052 : CLONE - <filter-activities> config doesn't work in share -added method to set the ignored-types pots git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@104524 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
<property name="tenantService" ref="tenantService"/>
|
<property name="tenantService" ref="tenantService"/>
|
||||||
<property name="userNamesAreCaseSensitive" value="${user.name.caseSensitive}"/>
|
<property name="userNamesAreCaseSensitive" value="${user.name.caseSensitive}"/>
|
||||||
<property name="eventPublisher" ref="eventPublisher" />
|
<property name="eventPublisher" ref="eventPublisher" />
|
||||||
|
<property name="ignoredActivityTypes" value="${activities.post.ignored-types}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="activityService" class="org.alfresco.repo.activities.ActivityServiceImpl">
|
<bean id="activityService" class="org.alfresco.repo.activities.ActivityServiceImpl">
|
||||||
|
@@ -19,7 +19,10 @@
|
|||||||
package org.alfresco.repo.activities;
|
package org.alfresco.repo.activities;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.events.types.ActivityEvent;
|
import org.alfresco.events.types.ActivityEvent;
|
||||||
@@ -61,7 +64,17 @@ public class ActivityPostServiceImpl implements ActivityPostService
|
|||||||
private int estGridSize = 1;
|
private int estGridSize = 1;
|
||||||
|
|
||||||
private boolean userNamesAreCaseSensitive = false;
|
private boolean userNamesAreCaseSensitive = false;
|
||||||
|
|
||||||
|
public void setIgnoredActivityTypes(String ignoredActivityTypes)
|
||||||
|
{
|
||||||
|
if (ignoredActivityTypes!= null && ignoredActivityTypes.length() > 0)
|
||||||
|
{
|
||||||
|
this.ignoredActivityTypes = Arrays.asList(ignoredActivityTypes.split(","));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> ignoredActivityTypes = new ArrayList<>();
|
||||||
|
|
||||||
public void setUserNamesAreCaseSensitive(boolean userNamesAreCaseSensitive)
|
public void setUserNamesAreCaseSensitive(boolean userNamesAreCaseSensitive)
|
||||||
{
|
{
|
||||||
this.userNamesAreCaseSensitive = userNamesAreCaseSensitive;
|
this.userNamesAreCaseSensitive = userNamesAreCaseSensitive;
|
||||||
@@ -199,6 +212,13 @@ public class ActivityPostServiceImpl implements ActivityPostService
|
|||||||
{
|
{
|
||||||
throw new IllegalArgumentException("Invalid activity type - exceeds " + ActivityPostDAO.MAX_LEN_ACTIVITY_TYPE + " chars: " + activityType);
|
throw new IllegalArgumentException("Invalid activity type - exceeds " + ActivityPostDAO.MAX_LEN_ACTIVITY_TYPE + " chars: " + activityType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ignoredActivityTypes != null && ignoredActivityTypes.contains(activityType))
|
||||||
|
{
|
||||||
|
// do not log the activity for ignored activity types.
|
||||||
|
logger.debug("Ignoring activity type for posting: " + activityType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// optional - default to empty string
|
// optional - default to empty string
|
||||||
if (activityData == null)
|
if (activityData == null)
|
||||||
@@ -371,13 +391,13 @@ public class ActivityPostServiceImpl implements ActivityPostService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate that the nodeRef property - if present in the activity data - is valid
|
* Validate that the nodeRef property - if present in the activity data - is valid
|
||||||
* on a basic level (it can be used to construct a NodeRef object).
|
* on a basic level (it can be used to construct a NodeRef object).
|
||||||
*
|
*
|
||||||
* @param jo
|
* @param jo
|
||||||
* @throws JSONException
|
* @throws JSONException
|
||||||
*/
|
*/
|
||||||
private NodeRef checkNodeRef(JSONObject jo) throws JSONException
|
private NodeRef checkNodeRef(JSONObject jo) throws JSONException
|
||||||
{
|
{
|
||||||
String nodeRefStr = null;
|
String nodeRefStr = null;
|
||||||
try
|
try
|
||||||
|
@@ -100,7 +100,10 @@ public class ActivityServiceImplTest extends TestCase
|
|||||||
activityService.postActivity("org.alfresco.testActivityType2", "", "", "");
|
activityService.postActivity("org.alfresco.testActivityType2", "", "", "");
|
||||||
|
|
||||||
activityService.postActivity("org.alfresco.testActivityType3", "site1", "appToolA", "{ \"var1\" : \"val1\" }");
|
activityService.postActivity("org.alfresco.testActivityType3", "site1", "appToolA", "{ \"var1\" : \"val1\" }");
|
||||||
}
|
|
||||||
|
// ignore posting this type even though its valid
|
||||||
|
activityService.postActivity("file-previewed", "site1", "appToolA", "{ \"var1\" : \"val1\" }");
|
||||||
|
}
|
||||||
|
|
||||||
public void testPostInvalidActivities() throws Exception
|
public void testPostInvalidActivities() throws Exception
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user