Rich Platform project for Java web applications.
This project is maintained by aktion-hip
The following snippet shows an example of a use case controller:
@UseCaseController public class InputWidgetsController extends AbstractController { @Override protected String needsPermission() { return Constants.PERMISSION_INPUT_WIDGETS; } @Override protected Component runChecked() throws RiplaException { loadContextMenu(Constants.CONTEXT_MENU_SET_WIDGETS); return new InputWidgetsView(); } }
Because org.ripla.web.controllers.AbstractController implements org.ripla.web.interfaces.IPluggable, this controller implements the IPluggable interface implicitely and, therefore, is an eligible return value for IUseCase.getControllerClasses() and IUseCase.getControllerSet(). However, to be accepted as Ripla controller, the class has additionally to be annotated with @UseCaseController.
Before the controller returns the view, it checks the user's permissions. Permission checking is done by returning the permission (i.e. a String) the user needs in the method Controller.needsPermission(). If the application has a UserAmin installed, the controller can ask the UserAdmin’s authorization instance whether the actual user has the required permission. To allow an unrestricted access to the view, Controller.needsPermission() can return an empty string.
The controller's main method is Controller.runChecked(). In the example snippet, the context menu is loaded and the view is prepared and returned. This method is the place for the use case's business logic as well. For example, the controller may look up a data set and prepare the retrieved data for that it can be displayed in the view returned.