There is very little that needs to be done by application developers to create a basic business
entity. In addition to the setup of the CI_MD_* tables describing the entity and its
constraints, only an implementation class (or Impl
) needs to be added.
In this case, a developer added Person_Impl
. The following is a simple
example of an Impl
class for the Person
entity.
/**
* @BusinessEntity
* (tableName = CI_PER,
* oneToManyCollections = { @Child( collectionName = names,
* childTableName = CI_PER_NAME,
* orderByColumnNames = { SEQ_NUM } )
* }
* )
*/
public class Person_Impl
extends Person_Gen {
/**
* @return the UI Display "info" for this person
*/
public String getInfo() {
return "PrimaryName: " + getPrimaryName().getInfo();
}
}
Important parts of the implementation class are described below:
_Impl
. For example, if the entity has a person
name, then the implementation class name would be
some.package.Person_Impl
. This also means that the generated
business interface will be named as some.package.Person
.BusinessEntityAnnotation
class for more details. _Gen
. Continuing the example of an entity with a
person
name, the implementation class would extend a
not-yet-created abstract superclass named some.package.Person_Gen
.
This superclass is created by the artifact generator based on metadata about the
table and contains: getDTO()
and setDTO(...)
methods that
allow for properties to be changed.createQuery(...)
.
some.package.Person
). Client code can then access the added
business method as follows:
Person aPerson = some logic retrieving a person instance
String thePersonsInfo = aPerson.getInfo();