Where to use key Resolver
Key Helper is nothing but a java expression which can be added as a custom property on attribute level or VO def level. At runtime we invokes this expression to resolve attributes with the provided inputs in this expression.
It can be used to resolve -
- Primary key attribute
- Parent Attribute
- Foreign key attribute
- Lookup attribute
How to write a Key Helper Expression
Once we finalized the attribute which need to be resolve, we have to find out the dependency and the resolving VO for them.
Input required to write a key helper expression :-
1. Resolver VO or Resolver Helper Class Name
2. Bind attributes(dependent attributes)
3. Return attributes
There could be two type of VO we will use in expression writing
1. ResolvingVO is the VO for which we are resolving attributes. Like if we are resolving EmployeeId for EmployeeVO then EmployeeVO is a ResolvingVO.
2. ResolverVO is the VO from the VO we are resolving attribute. Like DeptId for EmployeeVO we are resolving DeptId from DepartmentVO so DepartmentVO is ResolverVO.
Here is the format to write a key helper expression :-
keyContextHelper.resolve("Resolver_VO_Name", "Resolving_VO_Bind_Attribute1:Resolver_VO_Bind_Attribute1;Resolving_VO_Bind_Attribute2:Resolver_VO_Bind_Attribute2;........", "Resolving_VO_Return_Attribute:Resolver_VO_Return_Attribute");
If we have more than one Bind attributes then we can add them using semi colon separated ( ; ) , Resolving and resolver bind attribute names can be separated with colon ( : ) .
Lets take an example of parent key (DeptId) of EmployeeVO -
Resolving attribute - DeptId
ResolvingVO - EmployeeVO
ResolverVO - DepartmentVO ("oracle.apps.hcm.common.core.publicModel.view.DepartmentVO")
Bind attributes - DeptName, LocationId
Return attribute - DeptmentId from DepartmentVO --> DeptId of EmployeeVO
keyContextHelper.resolve("oracle.apps.hcm.common.core.publicModel.view.DepartmentVO", "DeptName:DepartmentName;LocationId:LocationId", "DeptId:DepartmentId" );
Where to add Key Helper Expression
Steps to add a key helper expression :-
1. Go to attribute Def
2. click on add custom properties
3. Select non-transient property
4 write Property --> KeyHelper , value -> (Expression)
![]() | Property name must be KeyHelper, otherwise it will not be considered as a key helper expression property. |
How Key Resolver works
Key resolver basically works in to two modes -
1. Forward :- To resolve Id's from the user provided attributes or user key attributes. (Import Case)
- DepartmentName and LocationId from Employee, will be provided as a input for Department.
- Query to get DepartmentId will be execute with the provided input value.
- DepartmentId from the query result will be passed to the Employee's DeptId.
2. Backward (Reverse) :- To resolve user key attributes form the Id's. (Export Case)
Same key expression used to resolve attributes in backward case.
- DeptId from Employee will be provided as a input to execute a query.
- Query will return DepartmentName and LocationId from Department.
- DepartmentName and LocationId will be returned to Employee.