mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged BRANCHES/V2.3 to HEAD:
96631: RM-1887: Unfiled record behaves as not unfiled after move 96663: Added the test for RM-1887 to the test suite. 96724: Probable fix for RM-1886. 96754: RM-1867 (Reject rule works incorrect if set up in File Plan) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@96756 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -731,7 +731,6 @@
|
||||
|
||||
<bean id="reject" class="org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction" parent="rmAction">
|
||||
<property name="publicAction" value="true"/>
|
||||
<property name="auditedImmediately" value="true" />
|
||||
</bean>
|
||||
|
||||
<!-- File To -->
|
||||
|
@@ -16,12 +16,14 @@
|
||||
<property name="registry" ref="auditModel.extractorRegistry" />
|
||||
<property name="nodeService" ref="nodeService" />
|
||||
<property name="filePlanService" ref="filePlanService" />
|
||||
<property name="ruleService" ref="RuleService" />
|
||||
</bean>
|
||||
|
||||
<bean id="org_alfresco_module_rm_nodeRefPathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.extractor.FilePlanNodeRefPathDataExtractor">
|
||||
<property name="registry" ref="auditModel.extractorRegistry" />
|
||||
<property name="nodeService" ref="nodeService" />
|
||||
<property name="filePlanService" ref="filePlanService" />
|
||||
<property name="ruleService" ref="RuleService" />
|
||||
</bean>
|
||||
|
||||
<bean id="org_alfresco_module_rm_identifierExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.extractor.FilePlanIdentifierDataExtractor">
|
||||
|
@@ -27,6 +27,7 @@ import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.repo.audit.extractor.AbstractDataExtractor;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
|
||||
/**
|
||||
* An extractor that extracts the <b>cm:name</b> path from the RM root down to
|
||||
@@ -42,6 +43,7 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor
|
||||
{
|
||||
private NodeService nodeService;
|
||||
private FilePlanService filePlanService;
|
||||
private RuleService ruleService;
|
||||
|
||||
/**
|
||||
* Used to check that the node in the context is a fileplan component
|
||||
@@ -59,6 +61,14 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor
|
||||
this.filePlanService = filePlanService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ruleService the ruleService to set
|
||||
*/
|
||||
public void setRuleService(RuleService ruleService)
|
||||
{
|
||||
this.ruleService = ruleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>true</tt> if the data is a NodeRef and it represents
|
||||
* a fileplan component
|
||||
@@ -77,19 +87,31 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor
|
||||
*/
|
||||
public Serializable extractData(Serializable value)
|
||||
{
|
||||
NodeRef nodeRef = (NodeRef) value;
|
||||
String extractedData = null;
|
||||
|
||||
// Get path from the RM root
|
||||
List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef);
|
||||
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
for (NodeRef pathNodeRef : nodeRefPath)
|
||||
ruleService.disableRules();
|
||||
try
|
||||
{
|
||||
String name = (String)nodeService.getProperty(pathNodeRef, ContentModel.PROP_NAME);
|
||||
sb.append("/").append(name);
|
||||
NodeRef nodeRef = (NodeRef) value;
|
||||
|
||||
// Get path from the RM root
|
||||
List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef);
|
||||
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
for (NodeRef pathNodeRef : nodeRefPath)
|
||||
{
|
||||
String name = (String)nodeService.getProperty(pathNodeRef, ContentModel.PROP_NAME);
|
||||
sb.append("/").append(name);
|
||||
}
|
||||
|
||||
// Done
|
||||
extractedData = sb.toString();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ruleService.enableRules();
|
||||
}
|
||||
|
||||
// Done
|
||||
return sb.toString();
|
||||
return extractedData;
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.repo.audit.extractor.AbstractDataExtractor;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
|
||||
/**
|
||||
* An extractor that extracts the NodeRef path from the RM root down to
|
||||
@@ -41,6 +42,7 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto
|
||||
{
|
||||
private NodeService nodeService;
|
||||
private FilePlanService filePlanService;
|
||||
private RuleService ruleService;
|
||||
|
||||
/**
|
||||
* Used to check that the node in the context is a fileplan component
|
||||
@@ -50,11 +52,22 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filePlanService file plan service
|
||||
*/
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
{
|
||||
this.filePlanService = filePlanService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ruleService the ruleService to set
|
||||
*/
|
||||
public void setRuleService(RuleService ruleService)
|
||||
{
|
||||
this.ruleService = ruleService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>true</tt> if the data is a NodeRef and it represents
|
||||
* a fileplan component
|
||||
@@ -70,12 +83,24 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto
|
||||
|
||||
public Serializable extractData(Serializable value)
|
||||
{
|
||||
NodeRef nodeRef = (NodeRef) value;
|
||||
Serializable extractedData = null;
|
||||
|
||||
// Get path from the RM root
|
||||
List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef);
|
||||
ruleService.disableRules();
|
||||
try
|
||||
{
|
||||
NodeRef nodeRef = (NodeRef) value;
|
||||
|
||||
// Done
|
||||
return (Serializable) nodeRefPath;
|
||||
// Get path from the RM root
|
||||
List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef);
|
||||
|
||||
// Done
|
||||
extractedData = (Serializable) nodeRefPath;
|
||||
}
|
||||
finally
|
||||
{
|
||||
ruleService.enableRules();
|
||||
}
|
||||
|
||||
return extractedData;
|
||||
}
|
||||
}
|
||||
|
@@ -76,13 +76,8 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
|
||||
public boolean supports(ConfigAttribute configAttribute)
|
||||
{
|
||||
boolean supports = false;
|
||||
String attribute = configAttribute.getAttribute();
|
||||
if (StringUtils.isNotBlank(attribute) && attribute.startsWith(AFTER_RM))
|
||||
{
|
||||
supports = true;
|
||||
}
|
||||
return supports;
|
||||
return (StringUtils.isNotBlank(attribute) && attribute.startsWith(AFTER_RM));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -292,10 +287,9 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes" })
|
||||
private List<ConfigAttributeDefintion> extractSupportedDefinitions(ConfigAttributeDefinition config)
|
||||
{
|
||||
List<ConfigAttributeDefintion> definitions = new ArrayList<ConfigAttributeDefintion>();
|
||||
List<ConfigAttributeDefintion> definitions = new ArrayList<>();
|
||||
Iterator iter = config.getConfigAttributes();
|
||||
|
||||
while (iter.hasNext())
|
||||
@@ -332,7 +326,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
{
|
||||
NodeRef testNodeRef = null;
|
||||
|
||||
if (cad.typeString.equals(cad.parent))
|
||||
if (cad.parent)
|
||||
{
|
||||
testNodeRef = returnedObject.getParentRef();
|
||||
}
|
||||
@@ -348,7 +342,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cad.typeString.equals(cad.parent) && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED)
|
||||
if (cad.parent && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED)
|
||||
{
|
||||
throw new AccessDeniedException("Access Denied");
|
||||
}
|
||||
|
@@ -236,7 +236,8 @@ public class RecordAspect extends AbstractDisposableItem
|
||||
{
|
||||
public Object doWork()
|
||||
{
|
||||
if (nodeService.exists(record))
|
||||
if (nodeService.exists(record) &&
|
||||
recordService.isFiled(record))
|
||||
{
|
||||
// clean record
|
||||
cleanDisposableItem(nodeService, record);
|
||||
|
@@ -44,7 +44,8 @@ import org.junit.runners.Suite.SuiteClasses;
|
||||
RM1039Test.class,
|
||||
RM1799Test.class,
|
||||
RM1814Test.class,
|
||||
RM978Test.class
|
||||
RM978Test.class,
|
||||
RM1887Test.class
|
||||
})
|
||||
public class IssueTestSuite
|
||||
{
|
||||
|
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2014 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.integration.issue;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
|
||||
/**
|
||||
* Integration test for RM-1887
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.3
|
||||
*/
|
||||
public class RM1887Test extends BaseRMTestCase
|
||||
{
|
||||
@Override
|
||||
protected boolean isRecordTest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given that a record is unfiled
|
||||
* And an unfiled folder has been created
|
||||
* When I move the unfiled record into the unfiled folder
|
||||
* Then the filed date of the unfiled record remains unset
|
||||
*/
|
||||
public void testMoveUnfiledRecord() throws Exception
|
||||
{
|
||||
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||
{
|
||||
private NodeRef unfiledRecordFolder;
|
||||
private NodeRef unfiledRecord;
|
||||
|
||||
public void given() throws Exception
|
||||
{
|
||||
// create unfiled folder
|
||||
unfiledRecordFolder = fileFolderService.create(filePlanService.getUnfiledContainer(filePlan), "my test folder", TYPE_UNFILED_RECORD_FOLDER).getNodeRef();
|
||||
|
||||
// crate unfiled record
|
||||
unfiledRecord = recordService.createRecordFromContent(filePlan, "test.txt", TYPE_CONTENT, null, null);
|
||||
|
||||
// check the record
|
||||
assertTrue(recordService.isRecord(unfiledRecord));
|
||||
assertFalse(recordService.isFiled(unfiledRecord));
|
||||
}
|
||||
|
||||
public void when() throws Exception
|
||||
{
|
||||
// move the record into the unfiled folder
|
||||
fileFolderService.move(unfiledRecord, unfiledRecordFolder, null);
|
||||
}
|
||||
|
||||
public void then()
|
||||
{
|
||||
// check the record
|
||||
assertTrue(recordService.isRecord(unfiledRecord));
|
||||
assertFalse(recordService.isFiled(unfiledRecord));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user