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)
|
if (nodeService.exists(newNodeRef) == true)
|
||||||
{
|
{
|
||||||
// Remove unwanted aspects
|
// only remove the search details .. the rest will be resolved automatically
|
||||||
removeUnwantedAspects(nodeService, newNodeRef);
|
nodeService.removeAspect(newNodeRef, RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@@ -482,6 +482,10 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (AlfrescoRuntimeException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
onCreateChildAssociation.enable();
|
onCreateChildAssociation.enable();
|
||||||
@@ -659,28 +663,27 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
ParameterCheck.mandatory("filePlan", filePlan);
|
ParameterCheck.mandatory("filePlan", filePlan);
|
||||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||||
ParameterCheck.mandatory("isLinked", isLinked);
|
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)
|
||||||
{
|
{
|
||||||
// first we do a sanity check to ensure that the user has at least write permissions on the document
|
throw new AccessDeniedException("Can not create record from document, because the user " +
|
||||||
if (permissionService.hasPermission(nodeRef, PermissionService.WRITE) != AccessStatus.ALLOWED)
|
AuthenticationUtil.getFullyAuthenticatedUser() +
|
||||||
|
" does not have Write permissions on the doucment " +
|
||||||
|
nodeRef.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the id of the currently logged in user
|
||||||
|
final String userId = AuthenticationUtil.getRunAsUser();
|
||||||
|
|
||||||
|
// do the work of creating the record as the system user
|
||||||
|
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void doWork() throws Exception
|
||||||
{
|
{
|
||||||
throw new AccessDeniedException("Can not create record from document, because the user " +
|
if (nodeService.hasAspect(nodeRef, ASPECT_RECORD) == false)
|
||||||
AuthenticationUtil.getFullyAuthenticatedUser() +
|
{
|
||||||
" does not have Write permissions on the doucment " +
|
|
||||||
nodeRef.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the id of the currently logged in user
|
|
||||||
final String userId = AuthenticationUtil.getRunAsUser();
|
|
||||||
|
|
||||||
// do the work of creating the record as the system user
|
|
||||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Void doWork() throws Exception
|
|
||||||
{
|
|
||||||
// disable delete rules
|
// disable delete rules
|
||||||
ruleService.disableRuleType("outbound");
|
ruleService.disableRuleType("outbound");
|
||||||
try
|
try
|
||||||
@@ -745,11 +748,11 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
{
|
{
|
||||||
ruleService.enableRuleType("outbound");
|
ruleService.enableRuleType("outbound");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -267,7 +267,15 @@ public class VitalRecordServiceImpl implements VitalRecordService,
|
|||||||
nodeService.setProperties(nodeRef, props);
|
nodeService.setProperties(nodeRef, props);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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;
|
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.RM452Test;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM994Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Suite;
|
import org.junit.runners.Suite;
|
||||||
import org.junit.runners.Suite.SuiteClasses;
|
import org.junit.runners.Suite.SuiteClasses;
|
||||||
@@ -32,7 +33,8 @@ import org.junit.runners.Suite.SuiteClasses;
|
|||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@SuiteClasses(
|
@SuiteClasses(
|
||||||
{
|
{
|
||||||
RM452Test.class
|
RM452Test.class,
|
||||||
|
RM994Test.class
|
||||||
})
|
})
|
||||||
public class IssueTestSuite
|
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