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
@@ -76,6 +86,11 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor
* @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable) * @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable)
*/ */
public Serializable extractData(Serializable value) public Serializable extractData(Serializable value)
{
String extractedData = null;
ruleService.disableRules();
try
{ {
NodeRef nodeRef = (NodeRef) value; NodeRef nodeRef = (NodeRef) value;
@@ -90,6 +105,13 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor
} }
// Done // Done
return sb.toString(); extractedData = sb.toString();
}
finally
{
ruleService.enableRules();
}
return extractedData;
} }
} }

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
@@ -69,6 +82,11 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto
} }
public Serializable extractData(Serializable value) public Serializable extractData(Serializable value)
{
Serializable extractedData = null;
ruleService.disableRules();
try
{ {
NodeRef nodeRef = (NodeRef) value; NodeRef nodeRef = (NodeRef) value;
@@ -76,6 +94,13 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto
List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef); List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef);
// Done // Done
return (Serializable) nodeRefPath; extractedData = (Serializable) nodeRefPath;
}
finally
{
ruleService.enableRules();
}
return extractedData;
} }
} }