Sounded interesting to use the command configuration feature. So I had a look at the configuration of the website tree, and how activate and deactivate workflow actions are integrated. It looks like I'd still have to extend the command handling in my subclass of the AdminTreeMVCHandler. I don't see a practical way around the fact that getCommand returns COMMAND_SHOW_TREE when
it can find anything else.

No:

        if (StringUtils.isNotEmpty(super.getCommand())) {
            return super.getCommand();
        }

This means if you pass a parameter command to the url this will return the command value. The property is set using the bean utils:

class MVCServletHandlerImpl

    public void init() {
        ...
Map parameters = new HashMap(); // needed, can't directly modify the map returned by request.getParameterMap()
        parameters.putAll(requestFormUtil.getParameters());
parameters.putAll(requestFormUtil.getDocuments()); // handle uploaded files too

        try {
            BeanUtils.populate(this, parameters);
        }
        ...

If you have a look at the servlet, it will look first for command in the catalog and then it will call the method with the name. You may check CommandBasedMVCServletHandler.

The tricky thing to understand is that we introduced the hole mechanism after the old tree handler was already existing (the one not using commands).

Conclution:
- if you introduce a new own commands use ?command=mycommand in the url (tree, page, ...) - if you wanna change the behavior of one of the current trees methods, define the command in the config, which will overstrear the old behavior - keep in mind that a command itself can be a chain of commands which makes it very flexible



I am not sure but I think I need the subclass anyhow in order to have a hook for my Tree Configuration. At least that is the way it is done for the other
Tree Handlers.  Or is there something I am missing?

I will fix it, so that you can define a configClass property on the tree definition node.

Thanks

Philipp

----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------

Reply via email to