AnsweredAssumed Answered

OnCopyNodePolicy produces ERROR in log

Question asked by jsauer on Dec 10, 2009
Hi,
I just implemented a OnCopyNodePolicy using
bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI,"getCopyCallback"), ContentModel.TYPE_CONTENT, this.getCopyCallback);

It works fine as it prevents the node to be copied if a certain aspect is set and one of it's properties holds a certain value.

I use

public CopyBehaviourCallback getCopyCallback(QName classRef,CopyDetails copyDetails)
{

    return DoNothingCopyBehaviourCallback.getInstance();

}
to prevent copying.
So far so good.

But if the behaviour triggers the user gets an message of
Unable to paste item due to system error:A bound policy denied copy: CopyDetails [source=workspace://SpacesStore/f6318b00-60af-4063-bcfe-c7afe2d78b26, targetParent=workspace://SpacesStore/4c3767d1-8487-4f35-89ba-e3976509fb64, targetNode=workspace://SpacesStore/0745a627-2989-4f2c-ba1e-5055384fb31f, targetNodeIsNew=true, assocTypeQName={http://www.alfresco.org/model/content/1.0}contains, assocQName={http://www.alfresco.org/model/content/1.0}restricted_access.jpg]

Is there a way to change the message? (other than to implement my own DoNotCopyBehaviourCallback and throwing an exeption with a message)

I also get an ERROR message in the log files which states:
15:05:20,859 ERROR [org.alfresco.web.ui.common.Utils] Unable to paste item due to system error:A bound policy denied copy:
   CopyDetails [source=workspace://SpacesStore/f6318b00-60af-4063-bcfe-c7afe2d78b26, targetParent=workspace://SpacesStore/4c3767d1-8487-4f35-89ba-e3976509fb64, targetNode=workspace://SpacesStore/0745a627-2989-4f2c-ba1e-5055384fb31f, targetNodeIsNew=true, assocTypeQName={http://www.alfresco.org/model/content/1.0}contains, assocQName={http://www.alfresco.org/model/content/1.0}restricted_access.jpg]
org.alfresco.service.cmr.repository.CopyServiceException: A bound policy denied copy:
   CopyDetails [source=workspace://SpacesStore/f6318b00-60af-4063-bcfe-c7afe2d78b26, targetParent=workspace://SpacesStore/4c3767d1-8487-4f35-89ba-e3976509fb64, targetNode=workspace://SpacesStore/0745a627-2989-4f2c-ba1e-5055384fb31f, targetNodeIsNew=true, assocTypeQName={http://www.alfresco.org/model/content/1.0}contains, assocQName={http://www.alfresco.org/model/content/1.0}restricted_access.jpg]
   at org.alfresco.repo.copy.CopyServiceImpl.copy(CopyServiceImpl.java:255)

I feel that this is kind of a bug. As I do not want the content to be copied volitional and create a behaviour for this there should be no ERROR showing up in the logs with all the stack trace lines!

Any resolution to prevent this from happening?

Thanks
Jörg

Outcomes