RM-1541: Unlink Record

* Unlink record UI action added
  * Unused DeleteLink capability repurposed as Unlink capability
  * UI evaluator ensuring unlink action only appears for linked record that are not in their primary location
  * evaluator unit test



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@91840 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2014-12-05 01:31:41 +00:00
parent 3200e48c3a
commit 64bbcf4bdc
5 changed files with 28 additions and 5 deletions

View File

@@ -126,8 +126,7 @@
</bean> </bean>
<bean id="rmDeleteLinksCapability" <bean id="rmDeleteLinksCapability"
parent="rmBaseCapability" parent="declarativeCapability">
class="org.alfresco.module.org_alfresco_module_rm.capability.impl.DeleteLinksCapability">
<property name="name" value="DeleteLinks"/> <property name="name" value="DeleteLinks"/>
<property name="permission" value="DeleteLinks"/> <property name="permission" value="DeleteLinks"/>
<property name="kinds"> <property name="kinds">

View File

@@ -848,7 +848,7 @@
<!-- Unlink Record --> <!-- Unlink Record -->
<bean id="unlinkFrom_proxy" parent="rmProxyAction"> <bean id="unlinkFrom_proxy" parent="rmProxyAction">
<property name="target" ref="linkTo"/> <property name="target" ref="unlinkFrom"/>
<property name="interceptorNames"> <property name="interceptorNames">
<list> <list>
<idref bean="unlinkFrom_security"/> <idref bean="unlinkFrom_security"/>
@@ -867,7 +867,6 @@
</bean> </bean>
<bean id="unlinkFrom" class="org.alfresco.module.org_alfresco_module_rm.action.impl.UnlinkFromAction" parent="rmAction"> <bean id="unlinkFrom" class="org.alfresco.module.org_alfresco_module_rm.action.impl.UnlinkFromAction" parent="rmAction">
<property name="publicAction" value="false"/>
</bean> </bean>
<!-- RequestInfo action --> <!-- RequestInfo action -->

View File

@@ -363,6 +363,17 @@
<property name="capability" value="LinkToRecords" /> <property name="capability" value="LinkToRecords" />
</bean> </bean>
<bean id="jsonConversionComponent.unlinkFromAction"
parent="jsonConversionComponent.baseAction">
<property name="name" value="unlinkFrom"/>
<property name="kinds">
<set>
<value>RECORD</value>
</set>
</property>
<property name="capability" value="DeleteLinks" />
</bean>
<bean id="jsonConversionComponent.fileToAction" <bean id="jsonConversionComponent.fileToAction"
parent="jsonConversionComponent.baseAction"> parent="jsonConversionComponent.baseAction">
<property name="name" value="fileTo"/> <property name="name" value="fileTo"/>

View File

@@ -384,6 +384,13 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
rmNodeValues.put("kind", kind.toString()); rmNodeValues.put("kind", kind.toString());
// set the primary parent node reference
ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef);
if (assoc != null)
{
rmNodeValues.put("primaryParentNodeRef", assoc.getParentRef().toString());
}
Map<String, Object> values = AuthenticationUtil.runAsSystem(new RunAsWork<Map<String, Object>>() Map<String, Object> values = AuthenticationUtil.runAsSystem(new RunAsWork<Map<String, Object>>()
{ {
public Map<String, Object> doWork() throws Exception public Map<String, Object> doWork() throws Exception

View File

@@ -32,27 +32,34 @@ import org.alfresco.service.namespace.RegexQNamePattern;
* Determines whether a node has multiple parents within a file plan * Determines whether a node has multiple parents within a file plan
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.0
*/ */
public class MultiParentEvaluator extends BaseEvaluator public class MultiParentEvaluator extends BaseEvaluator
{ {
/**
* @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override @Override
protected boolean evaluateImpl(final NodeRef nodeRef) protected boolean evaluateImpl(final NodeRef nodeRef)
{ {
return AuthenticationUtil.runAsSystem(new RunAsWork<Boolean>() return AuthenticationUtil.runAsSystem(new RunAsWork<Boolean>()
{ {
@Override
public Boolean doWork() public Boolean doWork()
{ {
// get parent associations
List<ChildAssociationRef> parents = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef> parents = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
int count = 0; int count = 0;
for (ChildAssociationRef parent : parents) for (ChildAssociationRef parent : parents)
{ {
// count file plan component parents
if (nodeService.hasAspect(parent.getParentRef(), ASPECT_FILE_PLAN_COMPONENT)) if (nodeService.hasAspect(parent.getParentRef(), ASPECT_FILE_PLAN_COMPONENT))
{ {
count++; count++;
} }
} }
// return true if more than one
return (count > 1); return (count > 1);
} }
}); });