mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-7068 restrict items in delete hold error msg
This commit is contained in:
@@ -39,6 +39,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
@@ -104,6 +105,9 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
private static final String MSG_ERR_HOLD_PERMISSION_GENERIC_ERROR = "rm.hold.generic-permission-error";
|
private static final String MSG_ERR_HOLD_PERMISSION_GENERIC_ERROR = "rm.hold.generic-permission-error";
|
||||||
private static final String MSG_ERR_HOLD_PERMISSION_DETAILED_ERROR = "rm.hold.detailed-permission-error";
|
private static final String MSG_ERR_HOLD_PERMISSION_DETAILED_ERROR = "rm.hold.detailed-permission-error";
|
||||||
|
|
||||||
|
/** Maximum number of held items to display in error message */
|
||||||
|
private static final int MAX_HELD_ITEMS_LIST_SIZE = 5;
|
||||||
|
|
||||||
/** File Plan Service */
|
/** File Plan Service */
|
||||||
private FilePlanService filePlanService;
|
private FilePlanService filePlanService;
|
||||||
|
|
||||||
@@ -570,13 +574,13 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
if (heldNames.size() > 0)
|
if (heldNames.size() > 0)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (String name : heldNames)
|
Stream<String> stream1 = heldNames.stream();
|
||||||
{
|
stream1.limit(MAX_HELD_ITEMS_LIST_SIZE).forEach((name) -> {
|
||||||
sb.append("\n ");
|
sb.append("\n ");
|
||||||
sb.append("'");
|
sb.append("'");
|
||||||
sb.append(name);
|
sb.append(name);
|
||||||
sb.append("'");
|
sb.append("'");
|
||||||
}
|
});
|
||||||
throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_HOLD_PERMISSION_DETAILED_ERROR) + sb.toString());
|
throw new AccessDeniedException(I18NUtil.getMessage(MSG_ERR_HOLD_PERMISSION_DETAILED_ERROR) + sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user