Talk:Example Actionclass

From OpenCms Wiki
Jump to: navigation, search

A little trap I see in this code (although it was very helpful):

lockResource triggers the EVENT_RESOURCE_MODIFIED too, so you might end up in loop here that ultimately ends in stack overflow. Not sure if there are scenarios where a modified resource isn't already locked. Maybe the unlocking shoots this event too, but I guess most changes occur before that. Anyway, I solved my problem by not locking anything before manipulating the resource. If you manipulate another resource than the that shoots the initial event, think about some control structures.

EP 14:24, 3 December 2009 (CET)

edit: you can catch the lock events with the following: event.getData().get("change"). the key "change" holds an Integer that tells you which kind of event you just got. the values can be looked up in the fields of CmsDriverManager. if it is zero, that is the lock event you may want to exclude from the following code.

that worked fine for me inside the switch: int change = (Integer)m_eventData.get("change"); if (change != 16) { break; }

EP 17:31, 16 December 2009 (CET)

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox