Merged 5.1.N (5.1.1) to HEAD (5.2)

123428 amorarasu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.1)
      123346 cturlica: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4)
         123048 rmunteanu: Merged V4.2.6 (4.2.6) to V4.2-BUG-FIX (4.2.7)
            122964 rneamtu: MNT-15679: Delete comment updates the "Modifier" and "Modified date" properties of a file
               - Fixed failing test


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@123703 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-03-11 22:34:39 +00:00
parent 6da9f1acc7
commit d62ac8b95a
3 changed files with 34 additions and 12 deletions

View File

@@ -183,14 +183,21 @@ public abstract class AbstractCommentsWebScript extends DeclarativeWebScript
JSONParser parser = new JSONParser();
try
{
json = (JSONObject) parser.parse(input);
if (input != null)
{
json = (JSONObject) parser.parse(input);
return json;
}
}
catch (ParseException pe)
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Invalid JSON: " + pe.getMessage());
if (logger.isDebugEnabled())
{
logger.debug("Invalid JSON: " + pe.getMessage());
}
}
return json;
return null;
}
/**
@@ -207,10 +214,18 @@ public abstract class AbstractCommentsWebScript extends DeclarativeWebScript
String jsonActivityData = "";
String siteId = "";
String page = "";
String title = "";
String title = ""
if (nodeRef == null)
{
// in case we don't have an parent nodeRef provided we do not need
// to post activity for parent node
return;
}
String strNodeRef = nodeRef.toString();
SiteInfo siteInfo = getSiteInfo(req, COMMENT_CREATED_ACTIVITY.equals(activityType));
// post an activity item, but only if we've got a site
if (siteInfo != null)

View File

@@ -54,9 +54,17 @@ public class CommentDelete extends AbstractCommentsWebScript
JSONObject jsonPageParams = parseJSONFromString(pageParams);
NodeRef parentNodeRef = new NodeRef((String) getOrNull(jsonPageParams, JSON_KEY_NODEREF));
String parentNodeRefStr = getOrNull(jsonPageParams, JSON_KEY_NODEREF);
NodeRef parentNodeRef = null;
if (parentNodeRefStr != null)
{
parentNodeRef = new NodeRef((String) getOrNull(jsonPageParams, JSON_KEY_NODEREF));
}
this.behaviourFilter.disableBehaviour(parentNodeRef, ContentModel.ASPECT_AUDITABLE);
if (parentNodeRef != null)
{
this.behaviourFilter.disableBehaviour(parentNodeRef, ContentModel.ASPECT_AUDITABLE);
}
try
{
@@ -83,7 +91,10 @@ public class CommentDelete extends AbstractCommentsWebScript
}
finally
{
this.behaviourFilter.enableBehaviour(parentNodeRef, ContentModel.ASPECT_AUDITABLE);
if (parentNodeRef != null)
{
this.behaviourFilter.enableBehaviour(parentNodeRef, ContentModel.ASPECT_AUDITABLE);
}
}
}

View File

@@ -21,9 +21,7 @@ package org.alfresco.repo.web.scripts.comment;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.transaction.UserTransaction;
@@ -37,10 +35,8 @@ import org.alfresco.repo.security.permissions.PermissionReference;
import org.alfresco.repo.security.permissions.PermissionServiceSPI;
import org.alfresco.repo.security.permissions.impl.ModelDAO;
import org.alfresco.repo.security.permissions.impl.SimplePermissionEntry;
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
import org.alfresco.repo.site.SiteModel;
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
import org.alfresco.repo.web.scripts.comments.AbstractCommentsWebScript;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;