From 65699e34c385f769b207b21b07b7ff259ac6ad2c Mon Sep 17 00:00:00 2001 From: Tuna Aksoy Date: Mon, 9 Jan 2017 20:52:33 +0000 Subject: [PATCH] RM-4586 (Record can be declared a record) / RM-4587 (Folder in collaboration site can be declared a record) --- .../rm-public-rest-context.xml | 7 ++- .../record/RecordCreationException.java | 61 +++++++++++++++++++ .../record/RecordServiceImpl.java | 16 ++--- 3 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordCreationException.java diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml index dab99eb8eb..34da746fb3 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml @@ -61,7 +61,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -119,11 +119,12 @@ + - + \ No newline at end of file diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordCreationException.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordCreationException.java new file mode 100644 index 0000000000..5bd352cdd8 --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordCreationException.java @@ -0,0 +1,61 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2017 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ + +package org.alfresco.module.org_alfresco_module_rm.record; + +import org.alfresco.error.AlfrescoRuntimeException; + +/** + * Record creation exception class + * + * @author Tuna Aksoy + * @since 2.6 + */ +public class RecordCreationException extends AlfrescoRuntimeException +{ + private static final long serialVersionUID = 1331453363788941681L; + + public RecordCreationException(String msgId, Throwable cause) + { + super(msgId, cause); + } + + public RecordCreationException(String msgId, Object[] msgParams, Throwable cause) + { + super(msgId, msgParams, cause); + } + + public RecordCreationException(String msgId, Object[] msgParams) + { + super(msgId, msgParams); + } + + public RecordCreationException(String msgId) + { + super(msgId); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java index 7f38228dc5..b40c64b197 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java @@ -975,7 +975,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { String msg = "Cannot create record, because the default file plan cannot be determined. Make sure at least one file plan has been created."; LOGGER.debug(msg); - throw new AlfrescoRuntimeException(msg); + throw new RecordCreationException(msg); } } else @@ -985,7 +985,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { String msg = "Cannot create record, because the provided file plan node reference is not a file plan."; LOGGER.debug(msg); - throw new AlfrescoRuntimeException(msg); + throw new RecordCreationException(msg); } result = filePlan; @@ -1017,7 +1017,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { String msg = "Cannot create record, because " + nodeRef.toString() + " does not exist."; LOGGER.debug(msg); - throw new AlfrescoRuntimeException(msg); + throw new RecordCreationException(msg); } // TODO eventually we should support other types .. either as record folders or as composite records @@ -1025,7 +1025,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { String msg = "Cannot create record, because " + nodeRef.toString() + " is not a supported type."; LOGGER.debug(msg); - throw new AlfrescoRuntimeException(msg); + throw new RecordCreationException(msg); } // Do not create record if the node is already a record! @@ -1033,7 +1033,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { String msg = "Cannot create record, because " + nodeRef.toString() + " is already a record."; LOGGER.debug(msg); - throw new AlfrescoRuntimeException(msg); + throw new RecordCreationException(msg); } // We cannot create records from working copies @@ -1041,7 +1041,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { String msg = "Can node create record, because " + nodeRef.toString() + " is a working copy."; LOGGER.debug(msg); - throw new AlfrescoRuntimeException(msg); + throw new RecordCreationException(msg); } // Cannot create a record from a previously rejected one @@ -1049,7 +1049,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { String msg = "Cannot create record, because " + nodeRef.toString() + " has previously been rejected."; LOGGER.debug(msg); - throw new AlfrescoRuntimeException(msg); + throw new RecordCreationException(msg); } // can't declare the record if the node is sync'ed @@ -1057,7 +1057,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { String msg = "Can't declare as record, because " + nodeRef.toString() + " is synched content."; LOGGER.debug(msg); - throw new AlfrescoRuntimeException(msg); + throw new RecordCreationException(msg); } }