RM-1867 (Reject rule works incorrect if set up in File Plan)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.3@96754 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-02-10 15:54:29 +00:00
parent 6bd51cb8fa
commit 32cedde74c
4 changed files with 64 additions and 16 deletions

View File

@@ -731,7 +731,6 @@
<bean id="reject" class="org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction" parent="rmAction"> <bean id="reject" class="org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction" parent="rmAction">
<property name="publicAction" value="true"/> <property name="publicAction" value="true"/>
<property name="auditedImmediately" value="true" />
</bean> </bean>
<!-- File To --> <!-- File To -->

View File

@@ -16,12 +16,14 @@
<property name="registry" ref="auditModel.extractorRegistry" /> <property name="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" /> <property name="nodeService" ref="nodeService" />
<property name="filePlanService" ref="filePlanService" /> <property name="filePlanService" ref="filePlanService" />
<property name="ruleService" ref="RuleService" />
</bean> </bean>
<bean id="org_alfresco_module_rm_nodeRefPathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.extractor.FilePlanNodeRefPathDataExtractor"> <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="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" /> <property name="nodeService" ref="nodeService" />
<property name="filePlanService" ref="filePlanService" /> <property name="filePlanService" ref="filePlanService" />
<property name="ruleService" ref="RuleService" />
</bean> </bean>
<bean id="org_alfresco_module_rm_identifierExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.extractor.FilePlanIdentifierDataExtractor"> <bean id="org_alfresco_module_rm_identifierExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.extractor.FilePlanIdentifierDataExtractor">

View File

@@ -27,6 +27,7 @@ import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.audit.extractor.AbstractDataExtractor; import org.alfresco.repo.audit.extractor.AbstractDataExtractor;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; 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 * 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 NodeService nodeService;
private FilePlanService filePlanService; private FilePlanService filePlanService;
private RuleService ruleService;
/** /**
* Used to check that the node in the context is a fileplan component * 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; 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 * @return Returns <tt>true</tt> if the data is a NodeRef and it represents
* a fileplan component * a fileplan component
@@ -77,19 +87,31 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor
*/ */
public Serializable extractData(Serializable value) public Serializable extractData(Serializable value)
{ {
NodeRef nodeRef = (NodeRef) value; String extractedData = null;
// Get path from the RM root ruleService.disableRules();
List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef); try
StringBuilder sb = new StringBuilder(128);
for (NodeRef pathNodeRef : nodeRefPath)
{ {
String name = (String)nodeService.getProperty(pathNodeRef, ContentModel.PROP_NAME); NodeRef nodeRef = (NodeRef) value;
sb.append("/").append(name);
// 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 extractedData;
return sb.toString();
} }
} }

View File

@@ -26,6 +26,7 @@ import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.audit.extractor.AbstractDataExtractor; import org.alfresco.repo.audit.extractor.AbstractDataExtractor;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; 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 * 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 NodeService nodeService;
private FilePlanService filePlanService; private FilePlanService filePlanService;
private RuleService ruleService;
/** /**
* Used to check that the node in the context is a fileplan component * 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; this.nodeService = nodeService;
} }
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService) public void setFilePlanService(FilePlanService filePlanService)
{ {
this.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 * @return Returns <tt>true</tt> if the data is a NodeRef and it represents
* a fileplan component * a fileplan component
@@ -70,12 +83,24 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto
public Serializable extractData(Serializable value) public Serializable extractData(Serializable value)
{ {
NodeRef nodeRef = (NodeRef) value; Serializable extractedData = null;
// Get path from the RM root ruleService.disableRules();
List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef); try
{
NodeRef nodeRef = (NodeRef) value;
// Done // Get path from the RM root
return (Serializable) nodeRefPath; List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef);
// Done
extractedData = (Serializable) nodeRefPath;
}
finally
{
ruleService.enableRules();
}
return extractedData;
} }
} }