How to delete Compound Type

Dear experts,

if I have accidentally created a compound Type or document Type. How do I delete or remove them them?

These are the steps I took but are they any better way of doing it?

If anyone wish to follow PLEASE REMEMBER TO BACKUP YOUR HIPPO CMS folder

Assuming I wish to delete OrangCT (Compund Type) I created accidentally and have alreadt generated the REST API. Assuming your artifactid is xxxxxx

  1. Go to the HIPPO CMS folder (Assuming D:\HIPPOCMS\xxxxxx)
    At the terminal start the Hippo CMS (Assumming : mvn -Pcargo.run -Drepo.path=storage)

  2. Login to console (Assuming localhost:8080/cms)
    Remove all the Document that uses OrangCT, you will notice you cannot remove the Document Type and Compund Type.

  3. Login to console (Assuming localhost:8080/cms/console)

  4. Expand the nodes until you reach namespace (Assumming jcr:root/hippo:namespace/xxxxxx/)
    You will see the nodes you wish to delete,
    right click on the target node (OrangCT) and choose delete node
    check save immediately and OK

  5. At the terminal press Ctrl + C to end the HIPPO CMS

  6. Open Java Editor (Assumming Eclipse)
    create a workspace from D:\HIPPOCMS\xxxxx and call it HIPPOCMS123
    Import an existing Maven Project and select the POM file from D:\HIPPOCMS\xxxxx\pom.xml

  7. Search for the target node name (OrangCT), Your search will files found

7.1. D:\HIPPOCMS\xxxxxx\repository-data\application\src\main\resources\hcm-config\namespaces\ xxxxxx.cnd

For OrangCT details inside a cnd files, be careful to only delete the LINE WITH OrangCT

7.2.
D:\HIPPOCMS\xxxxxx\repository-data\application\src\main\resources\hcm-content\content\documents\xxxxxx\category.yaml (Thanks @dhughes-xumak)

For OrangCT inside the YAML file, be careful to only delete the SET OF YAML related to OrangCT. (I used notepad++ with the language set to YAML)

  1. Go to beans folder to view the java file (Assuming D:\HIPPOCMS\xxxxxx\site\src\main\java\org\aaaaa\xxxxxx\beans and delete the OrangCT.java )

  2. Go to rest folder to view the java file (Assuming D:\HIPPOCMS\xxxxxx\site\src\main\java\org\aaaaa\xxxxxx\rest and delete the OrangCTResource.java )

  3. In the terminal recompile and restart the Hippo CMS
    (Assumming : mvn clean verify) to clean off and recompile
    (Assumming : mvn c-Pcargo.run -Drepo.path=storage) to run the HIPPO CMS

Login to cms (Assuming localhost:8080/cms) you will see OrangCT no longer in your Content -> Document Type

Login to essential (Assuming localhost:8080/essentials)

Try to generate the BeanWriter you should see that beans are up to date.
Try to generate the manual REST API you should NOT SEE the OrangCT in the list.

I hope some expert can suggest if they are any better way to do this.

Thank you
Sola Lee

Can you check if related record under /jcr:system/jcr:nodeTypes is being removed ?
Do you try to created new document type with the same name with the one you are trying to removed ?

@sola_lee Removing a node type is a backward-incompatible change.

Please have a look at this section of the documentation https://www.onehippo.org/about/upgrade/namespace-migration.html

Hope this will help.

Kind regards,
Lef

1 Like

It is backwards incompatible wrt to the CND. You can delete everything except the cnd definition. There is no easy way to do this. You need to remove the namespace definition and nodes of this type, any relevant java code, etc… You cannot change the cnd, at least not simply.

If the error is limited to local development, you can delete your storage and then you will never have created the compound. This can work up to but not including production. Once your change hits production you have to live with it. You can remove all code, configuration and content but the cnd change will remain.

1 Like

Yes the nodes in /jcr:system/jcr:nodeTypes was removed too.

Sometimes when our brains are not in-syn or when are are drunk we may create redundant document type or compound type, Or if you suffer from OCD and cannot stand seeing an dead type Or when someone inexperience login and mess around with your document type :smiley:
The next morning you login and realize the bad mistake. :slight_smile:

Thank you @jasper.floor, @ThoLe and @Lef_Karamoulas. All your answered together help me reach a conclusion.

It is definitely NOT BACKWARD COMPATIBLE so please be very careful with doing this in the development environment, don’t even try doing this in the production environment.

I wish I could checked all the 3 post as a good fantastic solution but such is the limitation of this blog.

Just wanted to point out that this step referred to a file in the target directory. Since you performed a mvn clean in step 10, I’m pretty sure this should have been D:\HIPPOCMS\xxxxxx\repository-data\application\src\main\resources\hcm-content\content\documents\xxxxxx\category.yaml.

1 Like

Yes you are right, My bad. I will update my post. Thank you