Sunday, September 16, 2012

Extending the Privacy Preference Entity Table

At my current client we are tasked with extending the PPREFENTITY table.   I encountered some challenges and have recorded the solutions in this article.


You can see the extended entity is the EntityPrivPref, which corresponds to the to the TCRMEntityPrivPrefBObj.  Since we are working with the TCRMPersonBObj (and thus, desire to have the extended entity privacy preference object included in the request & response for the TCRMPersonBObj), we expect the TCRMPartyPrivPrefBObj to be the working object.

I included our extended object in the request XML for TCRMPersonBObj, including the XPartyPrivPrefBObj in the TCRMExtensionBObj for TCRMPartyPrivPrefBObj, and got the following error:

DWLDocumentHandlerHelper ... com.td.mdms.extensions.component.XPersonBObjExt; method = setObject; class = com.td.mdms.extensions.component.XPartyPrivPrefBObjExt

Above is a portion of the error message.  So it turns out that the generated object is not suitable and needs to be modified.

This is the class diagram of the key classes.

We extend the Entity Privacy Pref via the workbench (middle class) but want the Party Privacy Preference (Bottom Class).
I turns out that since TCRMPartyPrivPrefBObj (desired) is a child of the extended entity, we can easily move our object to extend it.

1.  Properties files.  Change them to refer to TCRMPartyPrivPrefBObj as in the below image.



NOTE: I had to copy the properties entries to both term_extension.properties & DWLCommon_extension.properties.

2. Modify the extension class itself (*.component.* package) to extend TCRMPartyPrivPrefBObj instead of TCRMEntityPrivPrefBObj.



And that's it - rebuild, restart, republish.  You will be able to include the extended entity in your XML.  Apparently there are a number of classes that require similar intervention - generally those that utilize an "ENTITY_NAME" field such as CONTACT, etc.