Re: [xwiki-users] How to trigger an event or method on page delete?

2017-03-22 Thread Francisco Barretto
Thank you Thomas, I'll try it!

Francisco Barretto
Laboratório de Arte e Tecnologia - LATE!
www.late.art.br

Laboratório de Pesquisa em Arte Computacional (Midialab)
Universidade de Brasília - UnB

2017-03-22 14:02 GMT-03:00 Thomas Mortagne :

> See http://extensions.xwiki.org/xwiki/bin/view/Extension/
> Observation+Module+Local.
>
> The event you want to listen to is org.xwiki.bridge.event.
> DocumentDeletedEvent.
>
> On Wed, Mar 22, 2017 at 5:55 PM, Francisco Barretto
>  wrote:
> > I have implemented a xwiki based application  in which there are two main
> > classes "A" and "B". Those classes have a one-to-many relationship where
> > one "A" can be associated with many "B"s. (Just like presented in
> > https://www.xwiki.org/xwiki/bin/view/FAQ/HowToCreateAOneToManyRelations
> hipInXWiki
> > )
> >
> > The main thing is that when I delete a page which contains and represents
> > an "A" object, associated with many "B"s, those "B" pages still contain
> the
> > reference to the no longer present "A" object. Therefore, I was hopping
> to
> > find some kind of "onDelete" event triggered when a page is deleted so I
> > could clean those dead references.
> >
> > Just to clarify: "B" objects have an attribute called "A-reference" where
> > the doc.fullName of an "A" page is stored. If I could trigger a method
> when
> > this "A" object is deleted I would be able to perform an HQL query in
> order
> > to list those pages associated with the deleted "A" page and set a null
> > value to the "A-reference" attribute.
> >
> > Would appreciate any thoughts and hints on how to solve this because I'm
> > out of ideas and found no documentation on such event/trigger/method.
> >
> > Thanks!
> >
> > Francisco Barretto
>
>
>
> --
> Thomas Mortagne
>


Re: [xwiki-users] How to trigger an event or method on page delete?

2017-03-22 Thread Thomas Mortagne
See 
http://extensions.xwiki.org/xwiki/bin/view/Extension/Observation+Module+Local.

The event you want to listen to is org.xwiki.bridge.event.DocumentDeletedEvent.

On Wed, Mar 22, 2017 at 5:55 PM, Francisco Barretto
 wrote:
> I have implemented a xwiki based application  in which there are two main
> classes "A" and "B". Those classes have a one-to-many relationship where
> one "A" can be associated with many "B"s. (Just like presented in
> https://www.xwiki.org/xwiki/bin/view/FAQ/HowToCreateAOneToManyRelationshipInXWiki
> )
>
> The main thing is that when I delete a page which contains and represents
> an "A" object, associated with many "B"s, those "B" pages still contain the
> reference to the no longer present "A" object. Therefore, I was hopping to
> find some kind of "onDelete" event triggered when a page is deleted so I
> could clean those dead references.
>
> Just to clarify: "B" objects have an attribute called "A-reference" where
> the doc.fullName of an "A" page is stored. If I could trigger a method when
> this "A" object is deleted I would be able to perform an HQL query in order
> to list those pages associated with the deleted "A" page and set a null
> value to the "A-reference" attribute.
>
> Would appreciate any thoughts and hints on how to solve this because I'm
> out of ideas and found no documentation on such event/trigger/method.
>
> Thanks!
>
> Francisco Barretto



-- 
Thomas Mortagne


[xwiki-users] How to trigger an event or method on page delete?

2017-03-22 Thread Francisco Barretto
I have implemented a xwiki based application  in which there are two main
classes "A" and "B". Those classes have a one-to-many relationship where
one "A" can be associated with many "B"s. (Just like presented in
https://www.xwiki.org/xwiki/bin/view/FAQ/HowToCreateAOneToManyRelationshipInXWiki
)

The main thing is that when I delete a page which contains and represents
an "A" object, associated with many "B"s, those "B" pages still contain the
reference to the no longer present "A" object. Therefore, I was hopping to
find some kind of "onDelete" event triggered when a page is deleted so I
could clean those dead references.

Just to clarify: "B" objects have an attribute called "A-reference" where
the doc.fullName of an "A" page is stored. If I could trigger a method when
this "A" object is deleted I would be able to perform an HQL query in order
to list those pages associated with the deleted "A" page and set a null
value to the "A-reference" attribute.

Would appreciate any thoughts and hints on how to solve this because I'm
out of ideas and found no documentation on such event/trigger/method.

Thanks!

Francisco Barretto