cancel
Showing results for 
Search instead for 
Did you mean: 

Disable the AfterCreateVersionPolicy in Java is not Working

pmrreddy
Champ on-the-rise
Champ on-the-rise

Hi All,

I am facing  a issue not able to disable the afterCreateVersionPolicy in my custom service is not working.

In my project we are defined the policy afterCreateVersionPolicy and doing some bussiness logic, in my custom service i need to execute that policy when node is creating version so i am disabling it through behaviour filter that is not working code as below.

behaviourFilter.disableBehaviour(nodeRef,ContentModel.ASPECT_VERSIONABLE);
Map<QName, Serializable> versionProperties = new HashMap<QName, Serializable>();

versionProperties.put(ContentModel.PROP_INITIAL_VERSION, true);
versionProperties.put(ContentModel.PROP_AUTO_VERSION, false);

version=versionService.createVersion(nodeRef, versionProperties);

even though we disabled the version policy it is executing.

Thanks

Param

2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator

With your call to disableBehaviour you are only disabling behaviours for that particular node that have been bound on the aspect cm:versionable. You are not disabling afterCreateVersion itself - you are just disabling any behaviour using that aspect during the call to policyComponent.bindClassBehaviour(). If you want to disable a very specific behaviour, you can use the JavaBehaviour object to explicitly disable/re-enable it.

pmrreddy
Champ on-the-rise
Champ on-the-rise

Hi Axel Faust,

Thanks for your reply can give some reference or sample to disable that , I don't want disable 

AfterCreateVersionPolicy  i don't want to completly disable it.  I want to disable only in my service for that node upto that createversion , currently i disabled that it is not working.

Thanks

Param