Merge remote-tracking branch 'remotes/origin/feature/RM-6792_AddLocnParamToDeclareAsRec' into feature/RM-6796_DeclareAndFileTests

This commit is contained in:
cagache
2019-05-21 15:38:47 +03:00
2 changed files with 12 additions and 9 deletions

View File

@@ -905,19 +905,20 @@ public class RecordServiceImpl extends BaseBehaviourBean
// if optional location not specified, use the unfiledContainer
if (newRecordContainer == null)
{
// get the new record container for the file plan
// get the unfiled record container node for the file plan
newRecordContainer = filePlanService.getUnfiledContainer(checkedFilePlan);
if (newRecordContainer == null)
{
throw new AlfrescoRuntimeException("Unable to create record, because record container could not be found.");
}
}
// if optional location supplied, check that it is a valid record folder
// if optional location supplied, check that it is a valid record folder, unfiled record container or folder
else
{
QName nodeType = nodeService.getType(newRecordContainer);
final QName nodeType = nodeService.getType(newRecordContainer);
if(!(nodeType.equals(RecordsManagementModel.TYPE_RECORD_FOLDER) ||
nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER)))
nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER) ||
nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER)))
{
throw new AlfrescoRuntimeException("Unable to create record, because container is not a valid type for new record.");
}