mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge feature/RM-4373_SpecialContainersEditable into feature/RM-4357_and_RM_4373
This commit is contained in:
@@ -94,4 +94,20 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="rmEditTransferCapability"
|
||||
parent="declarativeCapability">
|
||||
<property name="name" value="EditTransfer"/>
|
||||
<property name="private" value="true"/>
|
||||
<property name="kinds">
|
||||
<list>
|
||||
<value>TRANSFER_CONTAINER</value>
|
||||
<value>TRANSFER</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="conditions">
|
||||
<map>
|
||||
<entry key="capabilityCondition.filling" value="true"/>
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
@@ -30,6 +30,7 @@
|
||||
<property name="permission" value="EditHold"/>
|
||||
<property name="kinds">
|
||||
<list>
|
||||
<value>HOLD_CONTAINER</value>
|
||||
<value>HOLD</value>
|
||||
</list>
|
||||
</property>
|
||||
|
@@ -44,6 +44,7 @@
|
||||
<ref bean="rmEditRecordMetadataCapability"/>
|
||||
<ref bean="rmModifyUnfiledRecordsContainerFolderCapability"/>
|
||||
<ref bean="rmEditHoldCapability"/>
|
||||
<ref bean="rmEditTransferCapability"/>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
@@ -62,6 +63,7 @@
|
||||
<ref bean="rmEditRecordMetadataCapability"/>
|
||||
<ref bean="rmModifyUnfiledRecordsContainerFolderCapability"/>
|
||||
<ref bean="rmEditHoldCapability"/>
|
||||
<ref bean="rmEditTransferCapability"/>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
@@ -44,4 +44,5 @@ rm.action.multiple.children.type-error-message=Operation failed. Children of typ
|
||||
rm.action.create.transfer.container.child-error-message=Operation failed. Creation is not allowed in Transfer Container.
|
||||
rm.action.create.transfer.child-error-message=Operation failed. Creation is not allowed in Transfer Folders.
|
||||
rm.action.create.record.folder.child-error-message=Only records can be created in record folders but it was {0}
|
||||
rm.action.transfer-non-editable=The metadata of transfer nodes is not editable.
|
||||
|
||||
|
@@ -129,7 +129,7 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
|
||||
)
|
||||
public void onUpdateProperties(final NodeRef nodeRef, final Map<QName, Serializable> before, final Map<QName, Serializable> after)
|
||||
{
|
||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void doWork()
|
||||
@@ -141,7 +141,7 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
|
||||
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getAdminUserName());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,6 +27,9 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||
@@ -34,6 +37,8 @@ import org.alfresco.repo.policy.annotation.Behaviour;
|
||||
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
@@ -43,10 +48,15 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
* @since 2.6
|
||||
*/
|
||||
@BehaviourBean(defaultType = "rma:transfer")
|
||||
public class TransferType extends BaseBehaviourBean implements NodeServicePolicies.OnCreateChildAssociationPolicy
|
||||
public class TransferType extends BaseBehaviourBean
|
||||
implements NodeServicePolicies.OnCreateChildAssociationPolicy,
|
||||
NodeServicePolicies.OnUpdatePropertiesPolicy
|
||||
{
|
||||
private final static String MSG_ERROR_ADD_CHILD_TO_TRANSFER = "rm.action.create.transfer.child-error-message";
|
||||
private static final String BEHAVIOUR_NAME = "onCreateChildAssocsForTransferType";
|
||||
private final static String MSG_ERROR_EDIT_TRANSFER_PROPERTIES = "rm.action.transfer-non-editable";
|
||||
|
||||
private static final String CREATE_CHILD_BEHAVIOUR_NAME = "onCreateChildAssocsForTransferType";
|
||||
private static final String EDIT_PROPERTIES_BEHAVIOUR_NAME = "onEditTransferProperties";
|
||||
|
||||
/**
|
||||
* Disable the behaviours for this transaction
|
||||
@@ -54,7 +64,8 @@ public class TransferType extends BaseBehaviourBean implements NodeServicePolici
|
||||
*/
|
||||
public void disable()
|
||||
{
|
||||
getBehaviour(BEHAVIOUR_NAME).disable();
|
||||
getBehaviour(CREATE_CHILD_BEHAVIOUR_NAME).disable();
|
||||
getBehaviour(EDIT_PROPERTIES_BEHAVIOUR_NAME).disable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +74,8 @@ public class TransferType extends BaseBehaviourBean implements NodeServicePolici
|
||||
*/
|
||||
public void enable()
|
||||
{
|
||||
getBehaviour(BEHAVIOUR_NAME).enable();
|
||||
getBehaviour(CREATE_CHILD_BEHAVIOUR_NAME).enable();
|
||||
getBehaviour(EDIT_PROPERTIES_BEHAVIOUR_NAME).enable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,10 +85,24 @@ public class TransferType extends BaseBehaviourBean implements NodeServicePolici
|
||||
@Behaviour
|
||||
(
|
||||
kind = BehaviourKind.ASSOCIATION,
|
||||
name = BEHAVIOUR_NAME
|
||||
name = CREATE_CHILD_BEHAVIOUR_NAME
|
||||
)
|
||||
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
|
||||
{
|
||||
throw new IntegrityException(I18NUtil.getMessage(MSG_ERROR_ADD_CHILD_TO_TRANSFER), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Behaviour
|
||||
(
|
||||
kind = BehaviourKind.CLASS,
|
||||
name = EDIT_PROPERTIES_BEHAVIOUR_NAME
|
||||
)
|
||||
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
|
||||
{
|
||||
if(!authenticationUtil.isRunAsUserTheSystemUser())
|
||||
{
|
||||
throw new IntegrityException(I18NUtil.getMessage(MSG_ERROR_EDIT_TRANSFER_PROPERTIES), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -182,6 +182,7 @@ public class TransferServiceImpl extends ServiceBaseImpl
|
||||
NodeRef transferContainer = filePlanService.getTransferContainer(root);
|
||||
|
||||
transferContainerType.disable();
|
||||
transferType.disable();
|
||||
try
|
||||
{
|
||||
transferNodeRef = nodeService.createNode(transferContainer,
|
||||
@@ -194,6 +195,7 @@ public class TransferServiceImpl extends ServiceBaseImpl
|
||||
finally
|
||||
{
|
||||
transferContainerType.enable();
|
||||
transferType.enable();
|
||||
}
|
||||
// Bind the hold node reference to the transaction
|
||||
AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF, transferNodeRef);
|
||||
|
Reference in New Issue
Block a user