mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -182,15 +182,22 @@ public abstract class AbstractCommentsWebScript extends DeclarativeWebScript
|
|||||||
|
|
||||||
JSONParser parser = new JSONParser();
|
JSONParser parser = new JSONParser();
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (input != null)
|
||||||
{
|
{
|
||||||
json = (JSONObject) parser.parse(input);
|
json = (JSONObject) parser.parse(input);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (ParseException pe)
|
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 jsonActivityData = "";
|
||||||
String siteId = "";
|
String siteId = "";
|
||||||
String page = "";
|
String page = "";
|
||||||
String title = "";
|
String title = ""
|
||||||
String strNodeRef = nodeRef.toString();
|
|
||||||
SiteInfo siteInfo = getSiteInfo(req, COMMENT_CREATED_ACTIVITY.equals(activityType));
|
|
||||||
|
|
||||||
|
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
|
// post an activity item, but only if we've got a site
|
||||||
if (siteInfo != null)
|
if (siteInfo != null)
|
||||||
|
@@ -54,9 +54,17 @@ public class CommentDelete extends AbstractCommentsWebScript
|
|||||||
|
|
||||||
JSONObject jsonPageParams = parseJSONFromString(pageParams);
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentNodeRef != null)
|
||||||
|
{
|
||||||
this.behaviourFilter.disableBehaviour(parentNodeRef, ContentModel.ASPECT_AUDITABLE);
|
this.behaviourFilter.disableBehaviour(parentNodeRef, ContentModel.ASPECT_AUDITABLE);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -82,10 +90,13 @@ public class CommentDelete extends AbstractCommentsWebScript
|
|||||||
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
if (parentNodeRef != null)
|
||||||
{
|
{
|
||||||
this.behaviourFilter.enableBehaviour(parentNodeRef, ContentModel.ASPECT_AUDITABLE);
|
this.behaviourFilter.enableBehaviour(parentNodeRef, ContentModel.ASPECT_AUDITABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* deletes comment node
|
* deletes comment node
|
||||||
|
@@ -21,9 +21,7 @@ package org.alfresco.repo.web.scripts.comment;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.transaction.UserTransaction;
|
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.PermissionServiceSPI;
|
||||||
import org.alfresco.repo.security.permissions.impl.ModelDAO;
|
import org.alfresco.repo.security.permissions.impl.ModelDAO;
|
||||||
import org.alfresco.repo.security.permissions.impl.SimplePermissionEntry;
|
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.site.SiteModel;
|
||||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
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.model.FileFolderService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
Reference in New Issue
Block a user