OUAF Release 24.1.0.0.0
Enhanced Composite ID Class Generation to Output Optional ID Constructors
Oracle Utilities Application Framework 24.1 implemented a new BusinessEntity annotation -> generateOptionalIdConstructors=true
which will work with any nullableKeyFields to generate extra public ID Constructors which will only require the non nullable key fields as input and default the nullable fields to null.
Note this flag will only make sense if there exists some nullableKeyFields defined.
With both of these annotations defined the Code generation for an ID class will change as follows
1. A new static collection optionalFields will be generated containing a list of strings representing the nullable keys.
2. New public ID constructor(s) will be generated with only the non nullable keys as parameters which internally will set each nullable key field to null
3. Within the existing public constructor which accepts a Map<String, Object> valuePairs parameter, call a new method to augment the valuePairs with any missing nullable key entries setting them to null prior to calling the super(valuePairs) constructor method.
4. Add new static method optionallyAddDefaultKeys(...) to add any missing nullable key entries setting them to null
This will enable any existing references to new MasterConfiguration_Id(BusinessObject) or new MasterConfiguration_Id(BusinessObjectId)
To continue to work after the new CONFIG_PART_NAME column is added as an optional primary key to the table/entity.
Also changes to the table java classed need to handle the style of nullable key entities when retrieving FK References.
These changes are
1. When constructing construct a collection of the optionalKey fields and a count of the number of required key fields
2. When performing the validation "Too few PK Values for table " only check if the number of keys provided satisfys the required key count
3. Prior to attempting to construct the ID, If there are some optional fields and the key collection is less that the full key size then pad the collection out with blank entries