code review comments

This commit is contained in:
cagache
2019-08-21 18:19:18 +03:00
parent bee8d09bd4
commit 27496b81f1
5 changed files with 97 additions and 6 deletions

View File

@@ -616,7 +616,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
*/
private void checkNodeCanBeAddedToHold(NodeRef nodeRef)
{
if (!isRecord(nodeRef) && !isRecordFolder(nodeRef) && !instanceOf(nodeRef, ContentModel.TYPE_CONTENT))
if (!isRecordFolder(nodeRef) && !instanceOf(nodeRef, ContentModel.TYPE_CONTENT))
{
final String nodeName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
throw new IntegrityException(I18NUtil.getMessage("rm.hold.add-to-hold-invalid-type", nodeName), null);

View File

@@ -140,7 +140,7 @@ public class FrozenAspect extends BaseBehaviourBean
public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName)
{
AuthenticationUtil.runAsSystem((RunAsWork<Void>) () -> {
if (nodeService.exists(nodeRef) && (isRecord(nodeRef) || instanceOf(nodeRef, TYPE_CONTENT)))
if (nodeService.exists(nodeRef) && instanceOf(nodeRef, TYPE_CONTENT))
{
// get the owning folder
final NodeRef parentRef = nodeService.getPrimaryParent(nodeRef).getParentRef();
@@ -177,8 +177,7 @@ public class FrozenAspect extends BaseBehaviourBean
{
AuthenticationUtil.runAsSystem((RunAsWork<Void>) () -> {
if (nodeService.exists(nodeRef) &&
(isRecord(nodeRef) || instanceOf(nodeRef, TYPE_CONTENT)))
if (nodeService.exists(nodeRef) && instanceOf(nodeRef, TYPE_CONTENT))
{
// get the owning folder
final NodeRef owningFolder = nodeService.getPrimaryParent(nodeRef).getParentRef();

View File

@@ -219,7 +219,7 @@ public abstract class BaseHold extends DeclarativeWebScript
}
// ensure that the node we are adding to the hold is a record or record folder or active content
if (!recordService.isRecord(nodeRef) && !recordFolderService.isRecordFolder(nodeRef) &&
if (!recordFolderService.isRecordFolder(nodeRef) &&
!nodeTypeUtility.instanceOf(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT))
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items added to a hold must be either a record, a record folder or active content.");