Change default supertype in a project (hipposysedit:supertype)

Hi Community,

I am trying to change the supertype of all our document types. Normally, ‘myproject:basedocument’ as the default supertype in a project. The supertype that we have in our project is ‘myproject:baseDocument’ (notice the captial ‘D’, renamed from ‘myproject:basedocument’). Due to this change the creation of a new document type using the cms interface is not possible. Attempting to do so results in the following error

An error has occurred, sorry for that.
java.lang.IllegalStateException: Could not resolve type myproject:basedocument
Failed to instantiate plugin class 'org.hippoecm.frontend.editor.builder.TemplateTypeEditorPlugin' for wicket id 'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.defaultEditorFactory.cluster.cms-preview0.plugin.viewerPlugin.cluster._default_.form' in plugin 'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.defaultEditorFactory.cluster.cms-preview0.plugin.viewerPlugin.cluster._default_.plugin.preview' (JcrPluginConfig:/hippo:namespaces/hipposysedit/templatetype/editor:templates/_default_/preview)

I have tried to fix this problem by introducing a new supertype ‘myproject:basedocument’ and manually replacing the supertypes in CND to the newly introduced supertype and running an updater on the existing content to effect the change. It works partially as I am now able to create new document types using the cms interface but at the server startup I get the this exception.

javax.jcr.RepositoryException: The following node type change contains non-trivial changes.Up until now only trivial changes are supported. (see javadoc for org.apache.jackrabbit.spi.commons.nodetype.NodeTypeDefDiff):
org.hippoecm.repository.jackrabbit.HippoNodeTypeRegistry$CustomNodeTypeDefDiff[
	nodeTypeName={http://www.onehippo.org/myproject/nt/1.0}XYZ,
	mixinFlagDiff=NONE,
	supertypesDiff=MAJOR,
	propertyDifferences=[
	],
	childNodeDifferences=[
	]
]

Here XYZ is our internal document which extends from ‘myproject:baseDocument’. Due to this error the CND in the repository is not affected with the changes in CND file.

Is there a better and cleaner way of achieving this? Maybe adding ‘myproject:baseDocument’ as a default super type?

Any help is appreciated.

Kind Regards
Mehul Parmar

PS: If I throw away the repository and start afresh then the server starts as expected and no errors are encountered during the startup.

Dear @machak @jasper.floor

Did you have a chance to look at my query?

Kind Regards
Mehul Parmar

What you are doing is making a backward incompatible change. Basically anytime you delete or rename a node or property in the cnd that is backwards incompatible. For data integrity reasons this is not allowed by JCR, at least not without special handling. If this code is already deployed to a server environment then you have to keep the old definitions and just add new definitions. If you are local, or if you can afford to delete your database, then you can just delete your local storage and start fresh. On a server environment you generally don’t want to delete your database. There is a process to do this called namespace migration. I suggest just putting the incorrect definitions back in the cnd and forget they are there.

However, I don’t see any reason why myproject:baseDocument wouldn’t work. There is no restriction on using capital letters in type names. I suspect you renamed the cnd definition but not the supertype in the namespace definition.

Thanks for the reply.

With namespace migration there’s bit of logistics involved as I would have to run the migrator on prod db while the server instances are down and as a result is the least desirable option.

Ideally, I would want ‘myproject:baseDocument’ to just work. I did change the supertype both in cnd and namespace (hipposysedit:supertype). If what you say is correct then why does the TemplateTypeEditorPlugin look for a ‘basedocument’ when the supertype in our project is ‘baseDocument’ and all other documents in our namespace it as a supertype.

Also, I saw in the code that org.hippoecm.frontend.editor.workflow.action.NewDocumentTypeAction#superType is by default ‘basedocument’ which is used to create a new document type and that is why I decided to reintroduce '‘basedocument’ to fix the problem.

Our production cnd look something like this.

[myproject:baseDocument] > hippo:document, hippostd:publishableSummary, hippostdpubwf:document
  orderable

[myproject:XYZ] > myproject:baseDocument, hippostd:relaxed, hippotranslation:translated
  orderable

[myproject:ABC] > myproject:baseDocument, hippostd:relaxed, hippotranslation:translated
  orderable
1 Like