What for?
CascadingMainEntries is an abstract class which is used for modules with a hierarchical mainentry/entry tree.
For example the Forum has
- MainEntries - these are the forums
- Entries - these are the postings
MainEntries could have other Mainentries and/or Entries as childs. Each child has one parent! Other examples for using the CascadingMainEntries are Modules using Categories, Trees, Directory-like data,... For example: Categories - Subcategories - Items
Since for all this cases how to work with the MainEntries (create/delete etc.) is more or less the same, there is the abstract class CascadingMainEntries. This class should be used as a Superclass for all modules which have a layout like described above. The module-class itself covers the Handling of the Entries as well as the implementation of some abstract functions from CascadingMainEntries.
How to use it
CascadingMainEntries covers the handling of mainentries (delete, create etc), counting subentries to be listed (e.g. how many postings does a forum have), provides functions for checking the path (Path to a certain entry/mainentry),..
Since CascadingMainEntries doesn't know everything about the module to be implemented there are certain things to do and a few abstract functions to be implemented. The most important of which are:
- First of all in the init() method of your module, you have to set the mainEntriesView to the mainEntriesView of the module
- Implementing the abstract setGetMainEntryFieldValues, setModifyMainEntryFieldValues, setCreateMainEntryFieldValues: In these methods the concrete values are set. Since this differs from module to module (each module has different fields, a different return tree etc.) - this can't be done in CascadingMainEntries
- Implementing deleteEntries: This method deletes all entries for a MainEntry?. Since CascadingMainEntries doesn't handle Entries this has to be done in the module-class. The method is necessary because when deleting a MainEntry? - also its subentries have to be deleted. It returns the number of Entries which were deleted.
- getConditions / createConditions: These methods were used to do additional module-specific things when getting or creating MainEntries - such as Parameter checking, etc. In the case of the forum it checks for example if the forum isn't locked (no subforum could be created in a locked forum)
For more details check the javadoc Info in CascadingMainEntries!
