Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3299

Make "saveHandler" property properly overridable.

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Do
    • Major
    • None
    • 4.3.6
    • admininterface
    • Yes

    Description

      In the class DialogMVCHandler it's really hard to override the default saveHandler creation properly.
      The property is private (and this is right), but methods that should be delegated to initialize it just set/use it directly. I'm talking about getSaveHandler(), createSaveHandler() and configureSaveHandler():

      • configureSaveHandler() have the saveHandler passed as parameter, but internally just checks the private field and not the passed one.
      • createSaveHandler() does not returns the new SaveHandler but simply set it internally. The method is declared as protected but it's virtually impossible to override it without using reflections to set the initialized value.
      • getSaveHandler() relies on the fact that createSaveHandler() have already set the private field.

      Given the situation, it's hard to override any part of saveHandler initialization or retrieval mantaining a fallback on the original behaviour. You have either to use reflections or to override (copy&paste) all those three methods just to change one at most.

      The attached patch will make override easier.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                pbaerfuss Philipp Bärfuss
                dfghi Danilo Ghirardelli
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoD