Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Deleting nodes in JCR via Author dialog

Avatar

Level 4

I need to create a component (say componentA) whose aim is to allow a user to add a variable number of components (choosing from componentB and componentC). So componentA is like a parsys which contains others components.

I'm using a multifieldpanel to create a component's dialog with a user controlled number of field. Something like this:

1407115_pastedImage_0.png

The problem is when I try to eliminate one of the elements added directly from the dialog of componentA: the element is effectively eliminated from the dialog but it actually remains inside the CRX. My CRX is something like:

  • componentA
    • componentASon_0
    • componentASon_1

My question is how can I do this in a proper way. Is there a java service needed for this or is there a direct way to delete and manipulate nodes in the JCR from a Dialog.

Thanks and regards!

1 Accepted Solution

Avatar

Correct answer by
Level 10

To delete Nodes, you use the JCR AP, which is Java. You need a session with permission too that is able to delete that node. This is typically not handled at the dialog level.

Hiwever, one way i can see is creating a custom xtype. I see you are working in classic ui. From the JS, pass a request to a Servlet where you can use Java JCR API to delete a node,

View solution in original post

4 Replies

Avatar

Administrator

I would recommend you to see Template editor. This will is the recommended way of restricting the components to the page via policy configurations.

Whereas you can have a look at this article covering JCR API to do CURD operations on the JCR :- Adobe Experience Manager Help | Programmatically Accessing Adobe Experience Manager Content using th...

// JCR API:- Apache Jackrabbit - JCR API

-Kautuk

Avatar

Level 4

Hi, does this mean its not possible to do it directly via the dialog? AEM build-in functionality?

What I need is a function behind the deletion button (the red minus) that deletes the node with the according name from the multifield as shown in the picture above.

Avatar

Administrator

OOTB there is no component to do this. Where as you can create a custom component where dialog can select the node to be deleted and backed logic can delete that node.

Directly we can do it from CRX/de.

-Kautuk

Avatar

Correct answer by
Level 10

To delete Nodes, you use the JCR AP, which is Java. You need a session with permission too that is able to delete that node. This is typically not handled at the dialog level.

Hiwever, one way i can see is creating a custom xtype. I see you are working in classic ui. From the JS, pass a request to a Servlet where you can use Java JCR API to delete a node,