Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

57072: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      56559: Merged V4.1-BUG-FIX (4.1.7) to V4.2-BUG-FIX (4.2.1)
         56110: MNT-9104 : If username contains uppercase letters the action of joining a site will not be displayed in "My activities"
          Rename test SiteActivityTest to AbstractSiteActivityTest and FeedCleanerTest to AbstractFeedCleanerTest.
          Add case sensitivity tests SiteActivityTestCaseInsensitivity, SiteActivityTestCaseSensitivity, FeedCleanerTestCaseInsensitivity, FeedCleanerTestCaseSensitivity.
          Was implemented code, the activities dependent of 'user.name.caseSensitive' property.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61703 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-11 19:14:16 +00:00
parent b11acd5737
commit 92a49b48e6
11 changed files with 228 additions and 60 deletions

View File

@@ -233,6 +233,11 @@ public class ActivityPostServiceImpl implements ActivityPostService
{
Date postDate = new Date();
ActivityPostEntity activityPost = new ActivityPostEntity();
//MNT-9104 If username contains uppercase letters the action of joining a site will not be displayed in "My activities"
if (! userNamesAreCaseSensitive)
{
userId = userId.toLowerCase();
}
activityPost.setUserId(userId);
activityPost.setSiteNetwork(tenantService.getName(siteId));

View File

@@ -624,6 +624,11 @@ public class ActivityServiceImpl implements ActivityService, InitializingBean
{
logger.debug("Inserting feed control for siteId: " + feedControl.getSiteId() + ",\n appToolId : " + feedControl.getAppToolId() + ",\n for user : " + userId);
}
//MNT-9104 If username contains uppercase letters the action of joining a site will not be displayed in "My activities"
if (! userNamesAreCaseSensitive)
{
userId = userId.toLowerCase();
}
feedControlDAO.insertFeedControl(new FeedControlEntity(userId, feedControl));
}
}
@@ -673,6 +678,11 @@ public class ActivityServiceImpl implements ActivityService, InitializingBean
{
ParameterCheck.mandatoryString("userId", userId);
if (!userNamesAreCaseSensitive)
{
userId = userId.toLowerCase();
}
try
{
List<FeedControlEntity> feedControlDaos = feedControlDAO.selectFeedControls(userId);
@@ -721,6 +731,12 @@ public class ActivityServiceImpl implements ActivityService, InitializingBean
{
logger.debug("Deleting feed control for siteId: " + feedControl.getSiteId() + ",\n appToolId : " + feedControl.getAppToolId() + ",\n for user : " + userId);
}
// MNT-9104 If username contains uppercase letters the action of joining a site will not be displayed in "My activities"
if (!userNamesAreCaseSensitive)
{
userId = userId.toLowerCase();
}
feedControlDAO.deleteFeedControl(new FeedControlEntity(userId, feedControl));
}
catch (SQLException e)
@@ -746,6 +762,12 @@ public class ActivityServiceImpl implements ActivityService, InitializingBean
{
logger.debug("Selecting feed control for siteId: " + feedControl.getSiteId() + ",\n appToolId : " + feedControl.getAppToolId() + ",\n for user : " + userId);
}
// MNT-9104 If username contains uppercase letters the action of joining a site will not be displayed in "My activities"
if (!userNamesAreCaseSensitive)
{
userId = userId.toLowerCase();
}
long id = feedControlDAO.selectFeedControl(new FeedControlEntity(userId, feedControl));
boolean exists = (id != -1);
if (logger.isDebugEnabled())

View File

@@ -81,6 +81,13 @@ public abstract class FeedTaskProcessor
private static final String URL_SERVICE_TEMPLATES = "/api/activities/templates";
private static final String URL_SERVICE_TEMPLATE = "/api/activities/template";
private boolean userNamesAreCaseSensitive = false;
public void setUserNamesAreCaseSensitive(boolean userNamesAreCaseSensitive)
{
this.userNamesAreCaseSensitive = userNamesAreCaseSensitive;
}
public void process(int jobTaskNode, long minSeq, long maxSeq, RepoCtx ctx) throws Exception
{
long startTime = System.currentTimeMillis();
@@ -245,6 +252,12 @@ public abstract class FeedTaskProcessor
ActivityFeedEntity feed = new ActivityFeedEntity();
// Generate activity feed summary
//MNT-9104 If username contains uppercase letters the action of joining a site will not be displayed in "My activities"
if (! userNamesAreCaseSensitive)
{
recipient = recipient.toLowerCase();
postingUserId = postingUserId.toLowerCase();
}
feed.setFeedUserId(recipient);
feed.setPostUserId(postingUserId);
feed.setActivityType(activityType);
@@ -618,6 +631,12 @@ public abstract class FeedTaskProcessor
protected List<FeedControlEntity> getFeedControls(String connectedUser) throws SQLException
{
//MNT-9104 If username contains uppercase letters the action of joining a site will not be displayed in "My activities"
if (! userNamesAreCaseSensitive)
{
connectedUser = connectedUser.toLowerCase();
}
return selectUserFeedControls(connectedUser);
}

View File

@@ -68,6 +68,7 @@ public class FeedCleaner implements NodeServicePolicies.BeforeDeleteNodePolicy
private int maxIdRange = 1000000;
private int maxAgeMins = 0;
private int maxFeedSize = 100;
private boolean userNamesAreCaseSensitive = false;
private ActivityFeedDAO feedDAO;
@@ -80,6 +81,10 @@ public class FeedCleaner implements NodeServicePolicies.BeforeDeleteNodePolicy
private FeedCleanerDeleteSiteTransactionListener deleteSiteTransactionListener;
private FeedCleanerDeletePersonTransactionListener deletePersonTransactionListener;
public void setUserNamesAreCaseSensitive(boolean userNamesAreCaseSensitive)
{
this.userNamesAreCaseSensitive = userNamesAreCaseSensitive;
}
public void setFeedDAO(ActivityFeedDAO feedDAO)
{
@@ -430,7 +435,11 @@ public class FeedCleaner implements NodeServicePolicies.BeforeDeleteNodePolicy
public void beforeDeleteNodePerson(NodeRef personNodeRef)
{
String userId = (String)nodeService.getProperty(personNodeRef, ContentModel.PROP_USERNAME);
//MNT-9104 If username contains uppercase letters the action of joining a site will not be displayed in "My activities"
if (! userNamesAreCaseSensitive)
{
userId = userId.toLowerCase();
}
Set<String> deletedUserIds = (Set<String>)AlfrescoTransactionSupport.getResource(KEY_DELETED_USER_IDS);
if (deletedUserIds == null)
{
@@ -503,8 +512,19 @@ public class FeedCleaner implements NodeServicePolicies.BeforeDeleteNodePolicy
Set<String> deletedUserIds = TransactionalResourceHelper.getSet(KEY_DELETED_USER_IDS);
if (deletedUserIds != null)
{
for (final String userId : deletedUserIds)
for (String user : deletedUserIds)
{
//MNT-9104 If username contains uppercase letters the action of joining a site will not be displayed in "My activities"
final String userId;
if (! userNamesAreCaseSensitive)
{
userId = user.toLowerCase();
}
else
{
userId = user;
}
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable