mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-994: Records filed from unfiled container do not pick up vital record review period or disposition schedule
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@56135 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -169,8 +169,8 @@ public class RecordCopyBehaviours implements RecordsManagementModel
|
||||
{
|
||||
if (nodeService.exists(newNodeRef) == true)
|
||||
{
|
||||
// Remove unwanted aspects
|
||||
removeUnwantedAspects(nodeService, newNodeRef);
|
||||
// only remove the search details .. the rest will be resolved automatically
|
||||
nodeService.removeAspect(newNodeRef, RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@@ -482,6 +482,10 @@ public class RecordServiceImpl implements RecordService,
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (AlfrescoRuntimeException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
onCreateChildAssociation.enable();
|
||||
@@ -660,8 +664,6 @@ public class RecordServiceImpl implements RecordService,
|
||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||
ParameterCheck.mandatory("isLinked", isLinked);
|
||||
|
||||
if (nodeService.hasAspect(nodeRef, ASPECT_RECORD) == false)
|
||||
{
|
||||
// first we do a sanity check to ensure that the user has at least write permissions on the document
|
||||
if (permissionService.hasPermission(nodeRef, PermissionService.WRITE) != AccessStatus.ALLOWED)
|
||||
{
|
||||
@@ -677,9 +679,10 @@ public class RecordServiceImpl implements RecordService,
|
||||
// do the work of creating the record as the system user
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
if (nodeService.hasAspect(nodeRef, ASPECT_RECORD) == false)
|
||||
{
|
||||
// disable delete rules
|
||||
ruleService.disableRuleType("outbound");
|
||||
@@ -745,12 +748,12 @@ public class RecordServiceImpl implements RecordService,
|
||||
{
|
||||
ruleService.enableRuleType("outbound");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map, org.alfresco.service.cmr.repository.ContentReader)
|
||||
|
@@ -268,6 +268,14 @@ public class VitalRecordServiceImpl implements VitalRecordService,
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if we are re-filling then remove the vital aspect if it is not longer a vital record
|
||||
if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD) == true)
|
||||
{
|
||||
nodeService.removeAspect(nodeRef, ASPECT_VITAL_RECORD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -19,6 +19,7 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.test;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM452Test;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM994Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
import org.junit.runners.Suite.SuiteClasses;
|
||||
@@ -32,7 +33,8 @@ import org.junit.runners.Suite.SuiteClasses;
|
||||
@RunWith(Suite.class)
|
||||
@SuiteClasses(
|
||||
{
|
||||
RM452Test.class
|
||||
RM452Test.class,
|
||||
RM994Test.class
|
||||
})
|
||||
public class IssueTestSuite
|
||||
{
|
||||
|
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.issue;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.Period;
|
||||
|
||||
|
||||
/**
|
||||
* System test for RM-994
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public class RM994Test extends BaseRMTestCase
|
||||
{
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCollaborationSiteTest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isRecordTest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void testRM944() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
checkVitalRecordNotSet(rmContainer);
|
||||
checkVitalRecordNotSet(rmFolder);
|
||||
checkVitalRecordNotSet(recordOne);
|
||||
assertNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF));
|
||||
|
||||
vitalRecordService.setVitalRecordDefintion(rmContainer, true, new Period("month|1"));
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
checkVitalRecordSet(rmContainer);
|
||||
checkVitalRecordSet(rmFolder);
|
||||
checkVitalRecordSet(recordOne);
|
||||
assertNotNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF));
|
||||
|
||||
recordService.createRecord(filePlan, dmDocument, true);
|
||||
|
||||
assertTrue(recordService.isRecord(dmDocument));
|
||||
checkVitalRecordNotSet(dmDocument);
|
||||
|
||||
fileFolderService.move(dmDocument, rmFolder, null);
|
||||
|
||||
checkVitalRecordSet(dmDocument);
|
||||
|
||||
return null;
|
||||
}
|
||||
}, "admin");
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
checkVitalRecordSet(dmDocument);
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void checkVitalRecordSet(NodeRef nodeRef)
|
||||
{
|
||||
VitalRecordDefinition def = vitalRecordService.getVitalRecordDefinition(nodeRef);
|
||||
assertNotNull(def);
|
||||
assertTrue(def.isEnabled());
|
||||
assertEquals("month", def.getReviewPeriod().getPeriodType());
|
||||
assertEquals("1", def.getReviewPeriod().getExpression());
|
||||
}
|
||||
|
||||
private void checkVitalRecordNotSet(NodeRef nodeRef)
|
||||
{
|
||||
VitalRecordDefinition recordDef = vitalRecordService.getVitalRecordDefinition(nodeRef);
|
||||
if (recordDef != null)
|
||||
{
|
||||
assertFalse(recordDef.isEnabled());
|
||||
assertEquals("none", recordDef.getReviewPeriod().getPeriodType());
|
||||
assertNull(recordDef.getNextReviewDate());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user