RM-4586 (Record can be declared a record) / RM-4587 (Folder in collaboration site can be declared a record)

This commit is contained in:
Tuna Aksoy
2017-01-09 20:52:33 +00:00
parent 149deaa6cb
commit 65699e34c3
3 changed files with 73 additions and 11 deletions

View File

@@ -61,7 +61,7 @@
<bean class="org.alfresco.rm.rest.api.files.FilesEntityResource"> <bean class="org.alfresco.rm.rest.api.files.FilesEntityResource">
<property name="records" ref="Records" /> <property name="records" ref="Records" />
</bean> </bean>
<!-- extended sites bean definition --> <!-- extended sites bean definition -->
<bean id="rm.sites" class="org.alfresco.rm.rest.api.impl.RMSitesImpl" parent="sites"> <bean id="rm.sites" class="org.alfresco.rm.rest.api.impl.RMSitesImpl" parent="sites">
<property name="siteSurfConfig" ref="rm.siteSurfConfig" /> <property name="siteSurfConfig" ref="rm.siteSurfConfig" />
@@ -89,7 +89,7 @@
<property name="sites" ref="rm.Sites" /> <property name="sites" ref="rm.Sites" />
</bean> </bean>
<bean id="records" class="org.alfresco.rm.rest.api.impl.RecordsImpl"> <bean id="records" class="org.alfresco.rm.rest.api.impl.RecordsImpl">
<property name="recordService" ref="RecordService"/> <property name="recordService" ref="RecordService"/>
<property name="filePlanService" ref="FilePlanService"/> <property name="filePlanService" ref="FilePlanService"/>
@@ -119,11 +119,12 @@
<property name="exceptionMappings"> <property name="exceptionMappings">
<map merge="true"> <map merge="true">
<entry key="org.alfresco.service.cmr.attributes.DuplicateAttributeException" value="#{T(org.springframework.extensions.webscripts.Status).STATUS_CONFLICT}" /> <entry key="org.alfresco.service.cmr.attributes.DuplicateAttributeException" value="#{T(org.springframework.extensions.webscripts.Status).STATUS_CONFLICT}" />
<entry key="org.alfresco.module.org_alfresco_module_rm.record.RecordCreationException" value="422" />
</map> </map>
</property> </property>
</bean> </bean>
<bean class="org.alfresco.util.BeanExtender"> <bean class="org.alfresco.util.BeanExtender">
<property name="beanName" value="simpleMappingExceptionResolver"/> <property name="beanName" value="simpleMappingExceptionResolver"/>
<property name="extendingBeanName" value="rm.simpleMappingExceptionResolver"/> <property name="extendingBeanName" value="rm.simpleMappingExceptionResolver"/>
</bean> </bean>
</beans> </beans>

View File

@@ -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 <http://www.gnu.org/licenses/>.
* #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);
}
}

View File

@@ -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."; 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); LOGGER.debug(msg);
throw new AlfrescoRuntimeException(msg); throw new RecordCreationException(msg);
} }
} }
else 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."; String msg = "Cannot create record, because the provided file plan node reference is not a file plan.";
LOGGER.debug(msg); LOGGER.debug(msg);
throw new AlfrescoRuntimeException(msg); throw new RecordCreationException(msg);
} }
result = filePlan; result = filePlan;
@@ -1017,7 +1017,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
{ {
String msg = "Cannot create record, because " + nodeRef.toString() + " does not exist."; String msg = "Cannot create record, because " + nodeRef.toString() + " does not exist.";
LOGGER.debug(msg); 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 // 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."; String msg = "Cannot create record, because " + nodeRef.toString() + " is not a supported type.";
LOGGER.debug(msg); LOGGER.debug(msg);
throw new AlfrescoRuntimeException(msg); throw new RecordCreationException(msg);
} }
// Do not create record if the node is already a record! // 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."; String msg = "Cannot create record, because " + nodeRef.toString() + " is already a record.";
LOGGER.debug(msg); LOGGER.debug(msg);
throw new AlfrescoRuntimeException(msg); throw new RecordCreationException(msg);
} }
// We cannot create records from working copies // 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."; String msg = "Can node create record, because " + nodeRef.toString() + " is a working copy.";
LOGGER.debug(msg); LOGGER.debug(msg);
throw new AlfrescoRuntimeException(msg); throw new RecordCreationException(msg);
} }
// Cannot create a record from a previously rejected one // 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."; String msg = "Cannot create record, because " + nodeRef.toString() + " has previously been rejected.";
LOGGER.debug(msg); LOGGER.debug(msg);
throw new AlfrescoRuntimeException(msg); throw new RecordCreationException(msg);
} }
// can't declare the record if the node is sync'ed // 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."; String msg = "Can't declare as record, because " + nodeRef.toString() + " is synched content.";
LOGGER.debug(msg); LOGGER.debug(msg);
throw new AlfrescoRuntimeException(msg); throw new RecordCreationException(msg);
} }
} }