AnsweredAssumed Answered

Custom CalculateVersionLabelPolicy for custom type

Question asked by mendigou on Mar 17, 2014
Hi. I'm trying to override the default CalculateVersionLabelPolicy for a custom type. I am using a basic example, concretely the one created by Peter Monks in http://blogs.alfresco.com/wp/pmonks/2009/11/03/version-baselining/ and I'm using the <a href="https://code.google.com/p/alfresco-version-baselining/source/browse/trunk/src/main/java/org/alfresco/extension/version/baselining/LoggingVersionLabelsPolicy.java">LoggingVersionLabelsPolicy.java</a>, only with my custom type (which I of course changed in the TYPE_VERSION_BASELINED_CONTENT definition).

The type is just a descendant of cm:content, without any addition (simply a name change).

When I try to trigger the policy by uploading a new version (the content was already versionable), I get:
<blockquote>Caused by: org.alfresco.service.cmr.version.VersionServiceException: 02170012 More than one CalculateVersionLabelPolicy behaviour has been registered for the type {http://my.domain/custom/extension/version/externalcontent/1.0}document</blockquote>
EDIT See complete log in the edited part below using the example directly /EDIT

I thought this could resemble https://issues.alfresco.com/jira/browse/ALF-2568, but that bug refers to overriding the policy of the cm:content type, and says it works fine when defining a custom type. Other forum posts (https://forums.alfresco.com/forum/developer-discussions/repository-services/more-one-calculateversionlabelpolicy-behaviour-has) suggest modifying the default alfresco files, which is something I would rather avoid.

I'm sure this is possible, but there's something I'm missing. Any idea why this might be happening?

EDIT
I tried this morning again with a fresh standalone linux alfresco installation, with the following simple steps (as in http://blogs.alfresco.com/wp/pmonks/2009/11/03/version-baselining/):
- Add the AMP with the example code as provided by Peter Monk. This means that <a href="https://code.google.com/p/alfresco-version-baselining/source/browse/trunk/src/main/java/org/alfresco/extension/version/baselining/BaselinedVersionLabelsPolicy.java">BaselinedVersionLabelsPolicy.java</a> is used, not the simple Logging one.
- Upload new content and assign the Baseline Version.
- Make that content versionable.
- The mentioned exception appears (see complete log below)

Complete log: http://paste2.org/H4ZxY3nw

What is done in the example makes sense to me, but I don't see why it does not work. Is alfresco forcing the serialVersionPolicy?

Outcomes