Page 1 of 1

Make Version start from 0 ?

PostPosted:Wed Mar 13, 2019 12:30 pm
by mamad
Hi guys,
I'm using openkm6.3.7-DEV community edition
I want to know is it possible to make versions of a document starting from 0 not 1?
It means when i upload a document the first version become 0.0
I have the openkm development environment and there is no problem to change source code if it need any change.
Thanks in advance

Re: Make Version start from 0 ?

PostPosted:Fri Mar 15, 2019 7:20 am
by jllort
You should build your own Version Number Adapter, take a look at:
https://docs.openkm.com/kcenter/view/ok ... apter.html
https://github.com/openkm/document-mana ... apter.java

My suggestion is clone the class MajorMinorReleaseVersionNumerationAdapter and apply into the modifications
Finally should change the value of the configuration parameter named version.numeration.adapter ( Administration > Configuration parameters )
https://docs.openkm.com/kcenter/view/ok ... ation.html
And restart OpenKM to take effect.

Remember you have our Personal OpenKM development environment ( VM based ) what you can download to get a rapid development scenario, ready to be used https://www.openkm.com/en/download.html ( there's a video what explains how to configure ).

Re: Make Version start from 0 ?

PostPosted:Mon Mar 25, 2019 8:10 am
by mamad
Thanks for your hint.
I simply change the starting version from 1.0 to 0.0 by changing getInitialVersionNumber() method inside MajorMinorReleaseVersionNumerationAdapter class :
Code: Select all
@Override
public String getInitialVersionNumber() {
        return "0.0";
	}
}
it was easy right ?:D

Re: Make Version start from 0 ?

PostPosted:Wed Mar 27, 2019 10:36 pm
by jllort
Yes, should not be difficult a change. I suggest you create a new class either modifying existing one.