You could try using a ThreadLocal... they kind of worry me, but I've seen a lot of people use them for data passing when there isn't a more straightforward way.

Andrey Shulinsky wrote:

Hi there!

I have a problem with Macro events handling, wonder if anybody can suggest a
solution.

The case is rather simple. Every Webdav resource needs to have an unique ID.
So when a new resource is created this property is added to its descriptor.
Easily implemented using the Create content event listener.

OK, now when a resource is copied the destination resource should have its
ID property changed. At the same time when a resource is moved its ID
property's value should not be modified. And here's the problem - the Move
macro operation is performed as the combination of the Copy and Delete
operations. So a _Copy_ macro event is fired whenever a _Move_ action
happens. Therefore, the moved resource's ID property is changed by the Copy
event handler! So the first question is - is there any easy way to determine
if this Copy event is in fact issued by the Move action?

I've tried a couple of alternative approaches as well. First, I attempted to
restore the ID in the Move event handler. But the source's revision
descriptor isn't available directly at the MacroEvent and when I try to
retrieve it like this:

                NamespaceAccessToken nat = Domain.accessNamespace(
                        new SecurityToken(this),
                        event.getNamespace().getName());
                SlideToken token = event.getToken();
                token.setForceStoreEnlistment(true);
                try
                {
                        NodeRevisionDescriptors sourceNrds =
nat.getContentHelper().
                                retrieve(token, event.getSourceURI());
                        ...

I get the org.apache.slide.structure.ObjectNotFoundException.

I also tried to analyze event collections but wasn't able to figure out how
to catch the moment when the Move action is committed.

So I'm lost at the moment and would really appreciate any help. Thanks.

Yours sincerely,
Andrey.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




-- Robert r. Sanders Chief Technologist iPOV (334) 821-5412 www.ipov.net


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to