mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-880: Cannot upload file into RM site over FTP/NFS file protocols
* if record has NO_CONTENT when assoc is created, postpone filling untill NO_CONTENT is removed git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@56006 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -56,6 +56,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
|||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService;
|
import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService;
|
||||||
|
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
||||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
@@ -97,7 +98,9 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
RecordsManagementCustomModel,
|
RecordsManagementCustomModel,
|
||||||
NodeServicePolicies.OnCreateChildAssociationPolicy,
|
NodeServicePolicies.OnCreateChildAssociationPolicy,
|
||||||
NodeServicePolicies.OnUpdatePropertiesPolicy,
|
NodeServicePolicies.OnUpdatePropertiesPolicy,
|
||||||
ApplicationContextAware
|
ApplicationContextAware,
|
||||||
|
NodeServicePolicies.OnAddAspectPolicy,
|
||||||
|
NodeServicePolicies.OnRemoveAspectPolicy
|
||||||
{
|
{
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static Log logger = LogFactory.getLog(RecordServiceImpl.class);
|
private static Log logger = LogFactory.getLog(RecordServiceImpl.class);
|
||||||
@@ -355,21 +358,43 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
policyComponent.bindClassBehaviour(
|
policyComponent.bindClassBehaviour(
|
||||||
NodeServicePolicies.OnAddAspectPolicy.QNAME,
|
NodeServicePolicies.OnAddAspectPolicy.QNAME,
|
||||||
ContentModel.ASPECT_NO_CONTENT,
|
ContentModel.ASPECT_NO_CONTENT,
|
||||||
new JavaBehaviour(this, "processNoContentAspect", NotificationFrequency.EVERY_EVENT));
|
new JavaBehaviour(this, "onAddAspect", NotificationFrequency.EVERY_EVENT));
|
||||||
policyComponent.bindClassBehaviour(
|
policyComponent.bindClassBehaviour(
|
||||||
NodeServicePolicies.OnRemoveAspectPolicy.QNAME,
|
NodeServicePolicies.OnRemoveAspectPolicy.QNAME,
|
||||||
ContentModel.ASPECT_NO_CONTENT,
|
ContentModel.ASPECT_NO_CONTENT,
|
||||||
new JavaBehaviour(this, "processNoContentAspect", NotificationFrequency.EVERY_EVENT));
|
new JavaBehaviour(this, "onRemoveAspect", NotificationFrequency.EVERY_EVENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onRemoveAspect(NodeRef nodeRef, QName aspect)
|
||||||
|
{
|
||||||
|
if (nodeService.hasAspect(nodeRef, ASPECT_RECORD) == true)
|
||||||
|
{
|
||||||
|
switchNames(nodeRef);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// check whether filling is pending aspect removal
|
||||||
|
Set<NodeRef> pendingFilling = TransactionalResourceHelper.getSet("pendingFilling");
|
||||||
|
if (pendingFilling.contains(nodeRef) == true)
|
||||||
|
{
|
||||||
|
file(nodeRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
||||||
*/
|
*/
|
||||||
public void processNoContentAspect(NodeRef nodeRef, QName aspectTypeQName)
|
@Override
|
||||||
|
public void onAddAspect(NodeRef nodeRef, QName aspect)
|
||||||
{
|
{
|
||||||
switchNames(nodeRef);
|
switchNames(nodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to switch the name of the record around. Used to support record creation via
|
* Helper method to switch the name of the record around. Used to support record creation via
|
||||||
* file protocols.
|
* file protocols.
|
||||||
@@ -393,15 +418,24 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
}
|
}
|
||||||
catch (FileExistsException e)
|
catch (FileExistsException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (InvalidNodeRefException e)
|
catch (InvalidNodeRefException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e)
|
catch (FileNotFoundException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
if (logger.isDebugEnabled() == true)
|
||||||
|
{
|
||||||
|
logger.debug(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,8 +458,17 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
nodeService.getType(nodeRef).equals(TYPE_RECORD_FOLDER) == false &&
|
nodeService.getType(nodeRef).equals(TYPE_RECORD_FOLDER) == false &&
|
||||||
nodeService.getType(nodeRef).equals(TYPE_RECORD_CATEGORY) == false)
|
nodeService.getType(nodeRef).equals(TYPE_RECORD_CATEGORY) == false)
|
||||||
{
|
{
|
||||||
// create and file the content as a record
|
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT) == true)
|
||||||
file(nodeRef);
|
{
|
||||||
|
// we need to postpone filling until the NO_CONTENT aspect is removed
|
||||||
|
Set<NodeRef> pendingFilling = TransactionalResourceHelper.getSet("pendingFilling");
|
||||||
|
pendingFilling.add(nodeRef);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create and file the content as a record
|
||||||
|
file(nodeRef);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
Reference in New Issue
Block a user