mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-1030: Can't run Freeze Rule if sub-folder record is freezed.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@56273 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -332,6 +332,9 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
|||||||
{
|
{
|
||||||
List<NodeRef> records = recordsManagementService.getRecords(nodeRef);
|
List<NodeRef> records = recordsManagementService.getRecords(nodeRef);
|
||||||
for (NodeRef record : records)
|
for (NodeRef record : records)
|
||||||
|
{
|
||||||
|
// no need to freeze if already frozen!
|
||||||
|
if (nodeService.hasAspect(record, ASPECT_FROZEN) == false)
|
||||||
{
|
{
|
||||||
nodeService.addAspect(record, ASPECT_FROZEN, props);
|
nodeService.addAspect(record, ASPECT_FROZEN, props);
|
||||||
|
|
||||||
@@ -344,6 +347,7 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String,
|
* @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String,
|
||||||
|
@@ -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.RM1008Test;
|
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM1008Test;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM1030Test;
|
||||||
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.alfresco.module.org_alfresco_module_rm.test.issue.RM994Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -36,7 +37,8 @@ import org.junit.runners.Suite.SuiteClasses;
|
|||||||
{
|
{
|
||||||
RM452Test.class,
|
RM452Test.class,
|
||||||
RM994Test.class,
|
RM994Test.class,
|
||||||
RM1008Test.class
|
RM1008Test.class,
|
||||||
|
RM1030Test.class
|
||||||
})
|
})
|
||||||
public class IssueTestSuite
|
public class IssueTestSuite
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@@ -42,6 +42,7 @@ import org.alfresco.util.GUID;
|
|||||||
* System test for RM-1008
|
* System test for RM-1008
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public class RM1008Test extends BaseRMTestCase
|
public class RM1008Test extends BaseRMTestCase
|
||||||
{
|
{
|
||||||
|
@@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2013 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 java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for RM-1030 .. can't freeze a record folder that already has a frozen record containted within
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
* @since 2.1
|
||||||
|
*/
|
||||||
|
public class RM1030Test extends BaseRMTestCase
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected boolean isRecordTest()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testRM1030() throws Exception
|
||||||
|
{
|
||||||
|
final NodeRef recordHold = doTestInTransaction(new Test<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public NodeRef run()
|
||||||
|
{
|
||||||
|
// show there are no holds when we start
|
||||||
|
Set<NodeRef> holds = freezeService.getHolds(filePlan);
|
||||||
|
assertNotNull(holds);
|
||||||
|
assertEquals(0, holds.size());
|
||||||
|
|
||||||
|
// freeze record contained within the record folder
|
||||||
|
NodeRef hold = freezeService.freeze("in true life for serious", recordOne);
|
||||||
|
assertNotNull(hold);
|
||||||
|
|
||||||
|
return hold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test(NodeRef hold) throws Exception
|
||||||
|
{
|
||||||
|
// show the record is frozen
|
||||||
|
assertTrue(freezeService.isFrozen(recordOne));
|
||||||
|
|
||||||
|
// count the number of holds
|
||||||
|
Set<NodeRef> holds = freezeService.getHolds(filePlan);
|
||||||
|
assertNotNull(holds);
|
||||||
|
assertEquals(1, holds.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
final NodeRef recordFolderHold = doTestInTransaction(new Test<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public NodeRef run()
|
||||||
|
{
|
||||||
|
// freeze the record folder that contains the frozen record
|
||||||
|
NodeRef folderHold = freezeService.freeze("innit but", rmFolder);
|
||||||
|
assertNotNull(folderHold);
|
||||||
|
|
||||||
|
return folderHold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test(NodeRef hold) throws Exception
|
||||||
|
{
|
||||||
|
// show that the record and the record folder are frozen
|
||||||
|
assertTrue(freezeService.isFrozen(recordOne));
|
||||||
|
assertTrue(freezeService.isFrozen(rmFolder));
|
||||||
|
|
||||||
|
// count the number of holds
|
||||||
|
Set<NodeRef> holds = freezeService.getHolds(filePlan);
|
||||||
|
assertNotNull(holds);
|
||||||
|
assertEquals(2, holds.size());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
doTestInTransaction(new Test<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void run()
|
||||||
|
{
|
||||||
|
// relinquish the record folder hold
|
||||||
|
freezeService.relinquish(recordFolderHold);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test(Void result) throws Exception
|
||||||
|
{
|
||||||
|
assertTrue(freezeService.isFrozen(recordOne));
|
||||||
|
assertFalse(freezeService.isFrozen(rmFolder));
|
||||||
|
|
||||||
|
Set<NodeRef> holds = freezeService.getHolds(filePlan);
|
||||||
|
assertNotNull(holds);
|
||||||
|
assertEquals(1, holds.size());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
doTestInTransaction(new Test<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void run()
|
||||||
|
{
|
||||||
|
// relinquish the record hold
|
||||||
|
freezeService.relinquish(recordHold);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test(Void result) throws Exception
|
||||||
|
{
|
||||||
|
assertFalse(freezeService.isFrozen(recordOne));
|
||||||
|
assertFalse(freezeService.isFrozen(rmFolder));
|
||||||
|
|
||||||
|
Set<NodeRef> holds = freezeService.getHolds(filePlan);
|
||||||
|
assertNotNull(holds);
|
||||||
|
assertEquals(0, holds.size());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@@ -29,6 +29,7 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.TestService;
|
|||||||
* See alfresco.extension.rm-method-security.properties
|
* See alfresco.extension.rm-method-security.properties
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public class RM452Test extends BaseRMTestCase
|
public class RM452Test extends BaseRMTestCase
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@@ -28,6 +28,7 @@ import org.alfresco.service.cmr.repository.Period;
|
|||||||
* System test for RM-994
|
* System test for RM-994
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public class RM994Test extends BaseRMTestCase
|
public class RM994Test extends BaseRMTestCase
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user