Developing model classes

For each view object defined in the SLIS configuration file, an interface is generated by SEAF that defines the required methods of the model class that will realize the business logic for the view object. For each model interface generated by SEAF in package seaf.generated.logic within directory generatedsrc a class has to be coded that implements the interface.

Model class interface

A model class must fulfill the following: Each business logic method of the model class is passed in the request values as java.util.Map and a seaf.common.RequestContext object containing various context data to assist in fulfilling the action in the model method.

Model class environment

The model class implementation can use the following aids provided by SEAF to achieve the target behavior.

1. Method parameters :

2. The SEAF Data Objects for manipulation with single instance of an entity.

SEAF provides the following 2 interfaces in package seaf.dos:

See the Javadoc documentation for more details.

For each entity defined in the SLIS configuration file, SEAF generates a class implementing the DOHome interface and a class implementing the DO interface. The classes are generated in package seaf.generated.dos in directory generatedsrc.

The business logic implementation should use the DOHome and DO interfaces to work with an instance of entity. This way the business logic implementation is shielded from any direct dependencies on Entity EJBs.

3. The SEAF Loader for retrieving multiple instances of an entity.

The seaf.sql.Loader class provides the following methods:

The Loader interprets the search criteria as follows: 4. The standard model implementation classes.

The seaf.logic package contains the SimpleModel, SimpleDependentModel and SimpleSlaveModel classes that can serve as example implementation of a model class, and when subclassed can provide a solid base for a model class implementation.

Rules for coding model classes

No exceptions should be thrown from business logic methods, if possible. On error conditions, return a ProcessingContext of type message with the appropriate error message to be displayed to the user.

Back to SEAF home page…