RM-5012 - fix record folder children - 2

This commit is contained in:
Ana Bozianu
2017-05-15 23:31:42 +03:00
parent 1276e5c5c7
commit 5988185459
2 changed files with 65 additions and 39 deletions

View File

@@ -255,14 +255,19 @@ public class RecordFolderType extends AbstractDisposableItem
)
public void onCreateChildAssociationOnCommit(ChildAssociationRef childAssocRef, boolean bNew)
{
final NodeRef recordFolder = childAssocRef.getChildRef();
final NodeRef child = childAssocRef.getChildRef();
// only records can be added in a record folder or hidden folders(is the case of e-mail attachments)
if (instanceOf(recordFolder, ContentModel.TYPE_FOLDER) && !nodeService.hasAspect(recordFolder, ContentModel.ASPECT_HIDDEN))
if (instanceOf(child, ContentModel.TYPE_FOLDER) && !nodeService.hasAspect(child, ContentModel.ASPECT_HIDDEN))
{
throw new IntegrityException(I18NUtil.getMessage(MSG_CANNOT_CREATE_RECORD_FOLDER_CHILD, nodeService.getType(recordFolder)), null);
throw new IntegrityException(I18NUtil.getMessage(MSG_CANNOT_CREATE_RECORD_FOLDER_CHILD, nodeService.getType(child)), null);
}
// file the record
recordService.file(child);
// recalculate disposition schedule
dispositionService.recalculateNextDispositionStep(child);
behaviourFilter.disableBehaviour();
try
{
@@ -272,7 +277,7 @@ public class RecordFolderType extends AbstractDisposableItem
public Void doWork()
{
// setup vital record definition
vitalRecordService.setupVitalRecordDefinition(recordFolder);
vitalRecordService.setupVitalRecordDefinition(child);
return null;
}