Create an answer container for the entity
About this task
The first step in defining a question set in another entity is to create a new answer container entity of the corresponding type.
Procedure
-
Create a new entity that has a
foreign key to the target entity and implements
PCAnswerDelegate.For example, to configure an answer container for an account-level question set, create an entity named AccountAnswer_Ext.eti with a foreign key to
Accountthat implementsPCAnswerDelegate.For guidance, examine one of the three base product answer containers, such as LocationAnswer.eti.
-
Add an answer array to the base entity
in which you are creating an answer container.
For example, to add an answer array for account-level answers, add an array named
AccountAnswersto Account.etx. In the array, setownertotrue.Account.etx <array arrayentity="AccountAnswer_Ext" cascadeDelete="true" desc="Set of answers for this account." name="AccountAnswers" owner="true"/>For guidance, examine one of the three base product entities that implements answer containers, such as PolicyLocation.eti.
-
Define an answer container adapter in the
gw.questionpackage that implements theAnswerContainerAdapterinterface.For example, to define an answer container adapter for an account-level question set, create a new class file: gw.question.AccountAnswerContainerAdapter.gs that implementsgw.api.domain.AnswerContainerAdapterand overrides appropriate methods and properties. For more guidance, examine one of the base product entities that implements answer containers, such as PolicyLocationAnswerContainerAdapter.gs. -
Update the definition of your entity to implement the answer container using the answer container adapter
class you just defined.
For example, if you are defining an account-level question set and your answer container class is named
AccountAnswerContainerAdapter:<implementsEntity name="AnswerContainer" adapter="gw.question.AccountAnswerContainerAdapter"/> name="AnswerContainer" />
