How can i disable the option: Skip Version Increment?

I am trying to make it impossible to skip the version update. So that every time when a document has been modified, it wil create atleast a minor of major version increment…?

0 votes

1 answers

2069 views

ANSWER



Hi,

Here's a typical definition of a contribution to the versioning service that controls available options:

<extension target="org.nuxeo.ecm.core.versioning.VersioningService" point="versioningRules">
  <versioningRule typeName="MyDoc">
    <initialState major="0" minor="0"/>
    <options lifeCycleState="*">
      <none default="true"/>
      <minor/>
      <major/>
    </options>
  </versioningRule>
</extension>

You can define your own for your document type, and remove the “none” option if you'd like to force version increment.

This cannot be used in an XML extension in Studio waiting for https://jira.nuxeo.com/browse/NXS-1259 issue to be fixed, but as a workaround, you can put this contribution in a another jar and make it require the Studio bundle (to make sure it's deployed afterwards).

1 votes



Could you please mention the required bundle to use that extension point ? If there are no dependencies, how I can t use it with a custom type ? Thanks
10/08/2012

if you are using studio, you will need no requirement as deployed at the end. If you like produce XML yourself, you can search in explorer.nuxeo.com. You have all contributions of Nuxeo distributions.

Regards

10/08/2012

First, i would like to thank u for the answer, it looked pretty simple. But when i try it on nuxeo Studio on the document type: File. I dont seem to get it to work. Im a missing something?

I have added to following extension:

&lt;extension target=&quot;org.nuxeo.ecm.core.versioning.VersioningService&quot; point=&quot;versioningRules&quot;&gt;
  &lt;versioningRule enabled=&quot;true&quot; typeName=&quot;File&quot;&gt;
    &lt;initialState major=&quot;0&quot; minor=&quot;0&quot;/&gt;
    &lt;options lifeCycleState=&quot;*&quot;&gt;
      &lt;major default=&quot;true&quot;/&gt;
    &lt;/options&gt;
  &lt;/versioningRule&gt;
&lt;/extension&gt;
10/08/2012

Did you have it to Advanced Settings > XML Extensions ?
10/08/2012

I ve tried both ways :

in an xml file in the templates/custom directory

in the xml extensions of studio

I ve also tried to define a defaultVersioningRule : it seems to work for all default types, but not my overriden File Document type.

10/08/2012

For me the same as pibou. I have made some of it work with defaultVersioningRule. Everything is now always creating major versions (document types like 'picture'), but for the document type File and any other document type that i have created that extends file or has the facet is versionable activated, doesnt work and de 3 default options are still available…
10/08/2012

hi, i'm updating my answer to reflect the issue you're facing
10/09/2012

Hi, thnx for your help so far. Ive used your tip for the workaround, so when its fixed, ill see the change in the documents.
10/10/2012

Ok for the fix :

a new extension depending on my studio bundle works fine

10/10/2012

Uhmm could u specify how u did it?
10/12/2012

Hi, I see the bug is fixed, but it still doesnt work for me.. Any help pls.

I have a extension via XML extensions:

<extension target="org.nuxeo.ecm.core.versioning.VersioningService" point="versioningRules"> <versioningRule typeName="MyFile">

&lt;initialState major=&quot;0&quot; minor=&quot;0&quot;/&gt;
&lt;options lifeCycleState=&quot;*&quot;&gt;
  &lt;major/&gt;
&lt;/options&gt;

</versioningRule> </extension>

After installing the nuxeo package im still able to use all 3 options for versioning.

I hope u guys can help me. What im a doing wrong?

10/19/2012

fix is not online yet, update should be done sometime next week
10/19/2012

In the extensions.xml generated in studio, extract the name of the component

&lt;component name=&quot;studio.extensions.XXXX&quot; version=&quot;1.0.0&quot;&gt;

In your component extending the Versioning Service :

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;component name=&quot;custom.versioningRules&quot; version=&quot;1.0.0&quot;&gt;
  &lt;require&gt;studio.extensions.XXXX&lt;/require&gt;
  &lt;extension target=&quot;org.nuxeo.ecm.core.versioning.VersioningService&quot; point=&quot;versioningRules&quot;&gt;       
  &lt;versioningRule typeName=&quot;File&quot; enabled=&quot;true&quot;&gt;
    &lt;initialState major=&quot;2&quot; minor=&quot;0&quot;/&gt;
    &lt;options lifeCycleState=&quot;*&quot;&gt;
     &lt;none/&gt;
      &lt;minor default=&quot;true&quot; /&gt;
      &lt;major/&gt;
    &lt;/options&gt;
  &lt;/versioningRule&gt;
&lt;/extension&gt;
&lt;/component&gt; 

this extension creates the file in V2.0, and the default selected item in the versionning form is "minor version".

If you want to make the minor version compulsory, get rid of the "none" and "major" entry in the rule definition.

10/19/2012

Oke im srry but this is very helpfull i only dont know where to put it.

Do i put it all in Nuxeo Studio, Advanced Settings - XML Extensions?

I know that this is probably very stupid of me to ask, pls dont hate me :)

10/19/2012

You can put your contribution in

 templates/custom/config/ 

After the server restart, it will copied to

  nxserver/config
10/22/2012

after restarting the server i get the message:

= Component Loading Status: Pending: 1 / Unstarted: 0 / Total: 656

  • service:custom.versioningRules requires

I dont know how to extract the component name in my nuxeo studio bundle?

If u can find it in your hart to take the a moment to help me out:

Pls give a step by step guide to configure this like u have pibou.

10/26/2012

Download the jar, open it, the name of the component can be found in OSGI-INF\extensions.xml

<component name="studio.extensions.my_studio_project" version="1.0.0">

In the component you wrote :

<component name="My.versioningRules" version="1.0.0">

<require>studio.extensions.my_studio_project</require>

10/26/2012

pibou, you are my super hero :)
10/27/2012