Alfresco 3 Cookbook
上QQ阅读APP看书,第一时间看更新

Making a document versionable

As a software developer, you must be aware of version control of your code. Controlling, managing, and maintaining the history of document versions is equally important in the context of a document management system.

Imagine that you are writing the requirement document on the newest project you are working on. A number of people will probably be involved in writing and validating this; and thus a number of iterations will be taking place for constructing the document and before the document is ultimately finalized. So how will you be able to manage all the versions of the document? Obviously, it is quite difficult to name the document as per the version and change the name every time the version is changed. What happens if you have reached version number 100? You need a version control-enabled document management system. Alfresco provides exactly that and much more beyond that!

How to do it...

  1. We once again take the About InfoAxon.html document to apply and enable versions.
  2. In the details page, the last section is Version History. Expanding this will show that the document has no version history. You need to click on Allow Versioning for this.
  3. As soon as you allow the versioning on the document, Alfresco displays its initial version history.
  4. Here there is only one version displayed—version 1.0

How it works...

Now, let's try to work on versioning further on this document.

We click on Edit Online from the Action list. Alfresco opens the online HTML editor to enable you to edit the document.

Note the name of the document you are editing. It is About InfoAxon (Working Copy).html. This is because Alfresco has automatically checked out the document, and made it ready for you to modify. However, we add a new line in this content and click Save.

Now notice that you have got a working copy of the document where you can edit the content. Your original document is safe and read-only. Nobody can do anything on the original document until you check-in the working copy.

So you click on the Check In/Done Editing icon. Alfresco asks about the details of your modification—whether it is a minor change or a major change. You should also put some comments on changes done. Click OK after that.

You can now see the working copy document is gone and the original document has come up with all the operations again activated.

Let's check what happened during this process.

Go to the details page again, and expand the Version History section of the document.

You will see that you have got both the versions of this document. Clicking on the version number will download that version of the document. You can also see the properties values of the document, as per the particular version.

Note that Alfresco also remembers the values of the properties in Version History.