mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-4528 (Electronic record using file upload creation in invalid parent container returns HTTP 500)
This commit is contained in:
@@ -39,22 +39,23 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.query.PagingResults;
|
import org.alfresco.query.PagingResults;
|
||||||
import org.alfresco.repo.activities.ActivityType;
|
|
||||||
import org.alfresco.repo.node.getchildren.FilterProp;
|
import org.alfresco.repo.node.getchildren.FilterProp;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.rest.api.impl.Util;
|
import org.alfresco.rest.api.impl.Util;
|
||||||
import org.alfresco.rest.api.model.UserInfo;
|
import org.alfresco.rest.api.model.UserInfo;
|
||||||
import org.alfresco.rest.framework.WebApiDescription;
|
import org.alfresco.rest.framework.WebApiDescription;
|
||||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||||
|
import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||||
|
import org.alfresco.rest.framework.webscripts.WithResponse;
|
||||||
import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory;
|
import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory;
|
||||||
import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
|
import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
|
||||||
import org.alfresco.rm.rest.api.impl.SearchTypesFactory;
|
import org.alfresco.rm.rest.api.impl.SearchTypesFactory;
|
||||||
import org.alfresco.rm.rest.api.model.FilePlan;
|
import org.alfresco.rm.rest.api.model.FilePlan;
|
||||||
import org.alfresco.rm.rest.api.model.Record;
|
|
||||||
import org.alfresco.rm.rest.api.model.RecordCategory;
|
import org.alfresco.rm.rest.api.model.RecordCategory;
|
||||||
import org.alfresco.service.cmr.model.FileFolderService;
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
import org.alfresco.service.cmr.model.FileInfo;
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
@@ -63,6 +64,7 @@ import org.alfresco.service.namespace.QName;
|
|||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.extensions.webscripts.servlet.FormData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File plan children relation
|
* File plan children relation
|
||||||
@@ -72,7 +74,9 @@ import org.springframework.beans.factory.InitializingBean;
|
|||||||
*/
|
*/
|
||||||
@RelationshipResource(name="categories", entityResource = FilePlanEntityResource.class, title = "Category children of file plan")
|
@RelationshipResource(name="categories", entityResource = FilePlanEntityResource.class, title = "Category children of file plan")
|
||||||
public class FilePlanChildrenRelation implements RelationshipResourceAction.Read<RecordCategory>,
|
public class FilePlanChildrenRelation implements RelationshipResourceAction.Read<RecordCategory>,
|
||||||
RelationshipResourceAction.Create<RecordCategory>, InitializingBean
|
RelationshipResourceAction.Create<RecordCategory>,
|
||||||
|
MultiPartRelationshipResourceAction.Create<FilePlan>,
|
||||||
|
InitializingBean
|
||||||
{
|
{
|
||||||
/** Record category type */
|
/** Record category type */
|
||||||
public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory";
|
public static final String RECORD_CATEGORY_TYPE = "rma:recordCategory";
|
||||||
@@ -218,4 +222,10 @@ public class FilePlanChildrenRelation implements RelationshipResourceAction.Read
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FilePlan create(String entityResourceId, FormData formData, Parameters parameters, WithResponse withResponse)
|
||||||
|
{
|
||||||
|
throw new IntegrityException("Uploading records into file plan root is not allowed.", null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,15 +45,18 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.query.PagingResults;
|
import org.alfresco.query.PagingResults;
|
||||||
import org.alfresco.repo.node.getchildren.FilterProp;
|
import org.alfresco.repo.node.getchildren.FilterProp;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.rest.api.Nodes;
|
import org.alfresco.rest.api.Nodes;
|
||||||
import org.alfresco.rest.api.impl.Util;
|
import org.alfresco.rest.api.impl.Util;
|
||||||
import org.alfresco.rest.api.model.UserInfo;
|
import org.alfresco.rest.api.model.UserInfo;
|
||||||
import org.alfresco.rest.framework.WebApiDescription;
|
import org.alfresco.rest.framework.WebApiDescription;
|
||||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||||
|
import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||||
|
import org.alfresco.rest.framework.webscripts.WithResponse;
|
||||||
import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory;
|
import org.alfresco.rm.rest.api.impl.ApiNodesModelFactory;
|
||||||
import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
|
import org.alfresco.rm.rest.api.impl.FilePlanComponentsApiUtils;
|
||||||
import org.alfresco.rm.rest.api.impl.SearchTypesFactory;
|
import org.alfresco.rm.rest.api.impl.SearchTypesFactory;
|
||||||
@@ -66,6 +69,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.extensions.webscripts.servlet.FormData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record category children relation
|
* Record category children relation
|
||||||
@@ -76,7 +80,8 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
*/
|
*/
|
||||||
@RelationshipResource(name="children", entityResource = RecordCategoriesEntityResource.class, title = "Children of a record category")
|
@RelationshipResource(name="children", entityResource = RecordCategoriesEntityResource.class, title = "Children of a record category")
|
||||||
public class RecordCategoryChildrenRelation implements RelationshipResourceAction.Read<RecordCategoryChild>,
|
public class RecordCategoryChildrenRelation implements RelationshipResourceAction.Read<RecordCategoryChild>,
|
||||||
RelationshipResourceAction.Create<RecordCategoryChild>
|
RelationshipResourceAction.Create<RecordCategoryChild>,
|
||||||
|
MultiPartRelationshipResourceAction.Create<RecordCategoryChild>
|
||||||
{
|
{
|
||||||
private final static Set<String> LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES = new HashSet<>(Arrays
|
private final static Set<String> LIST_RECORD_CATEGORY_CHILDREN_EQUALS_QUERY_PROPERTIES = new HashSet<>(Arrays
|
||||||
.asList(new String[] { RecordCategoryChild.PARAM_IS_RECORD_CATEGORY, RecordCategoryChild.PARAM_IS_RECORD_FOLDER,
|
.asList(new String[] { RecordCategoryChild.PARAM_IS_RECORD_CATEGORY, RecordCategoryChild.PARAM_IS_RECORD_FOLDER,
|
||||||
@@ -208,4 +213,10 @@ public class RecordCategoryChildrenRelation implements RelationshipResourceActio
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecordCategoryChild create(String entityResourceId, FormData formData, Parameters parameters, WithResponse withResponse)
|
||||||
|
{
|
||||||
|
throw new IntegrityException("Uploading records into record categories is not allowed.", null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user