The UI Model layer provides a "backend" for the UI within a Model - View - Control architecture. In many respects it is a surrogate for the SessionEJB layer, but it may also include, as shown in the example here, additional methods that are meaningful to the UI Control layer but do not require a separate method in the SessionEJB layer. But, perhaps its greatest contribution is pedagogical -- giving a convenient "resting place" for novice programmers to stub out the Model component of their UIs for testing without having to confront the complexity of the EJB Container and Session EJBs.
Generalization of UI Models is slimilar to generalization for the DomainMapper: both are built using conventional Java classes and both interact with an EJB. Whereas DomainMapper classes interact with Entity EJBs from within the same EJB Container and, hence, the same JVM, they do so using the EJB's Local interfaces and, hence, through JNDI lookup. By contrast, UIModel classes, since they reside in a Web Container, are in a different JVM from the Session EJBs. Consequently, they use the Session's Remote interface and, thus, can use Factory classes generated by the development environment. These are conventional Java classes and can be instantiated directly by the UIModel so long as they are available on the Model's classpath.
UI Model Interfaces
Two interfaces are shown: IModelOOC and IModelSet. The first shows the signatures for the five CRUDS methods for this layer -- -- add, delete, update, get, and search -- plus an additional method, bindObjectToSet, that is general at this layer but not in other layers. The second includes two methods that extend the generic OOC methods. These include a getSetMembers and a move method.
UI Model OOC
ModelOOC is the superclass that all UI Model subclasses extend. It includes the five core CRUDS methods and the sixth bind method. Abstract methods define all the type-specific resources required for actual implementation.
UI Model Set
ModelSet is a subclass that extends ModelOOC and implements the IModelSet interface. It provides two main sets of methods: those that provide additional function to the CRUDS methods of the OOC superclass and those that implement the abstract methods defined as part of the OOC superclass. The latter, of course, provide all of the type-specific function required for the subclass and for implementing the superclass.