Example skeleton implementation for a component
Creating a new component transaction in the hub module editor results in the MDM Workbench generating new methods in the relevant component class to implement the transaction.
For example:
- A new component transaction SampleTxn is created in the model: /SampleModule/SampleFolder/SampleTxn
- This results in extra methods being generated in the component .java file: /SampleModule/ejbModule/com.example.samplemodule.component/SampleFolderComponent.java
- If SampleTxn is a txn transaction, the new methods added to the SampleFolderComponent class are SampleTxn and handleSampleTxn.
- If SampleTxn is an inquiry transaction, then the additional method beforePreExecuteSampleTxn is also generated.
When the MDM Workbench generates code, it puts an @generated tag in the javadoc for each method to indicate that the method was generated by the MDM Workbench. When the workbench generates new code, it overwrites any methods which have the @generated tag. If you customize the generated methods, you must remove the @generated tag or change it to @generated NOT so that the MDM Workbench will not overwrite the changes you have made.
The MDM Workbench generates a stub for the beforePreExecuteSampleTxn, to which argument validation logic should be added.
The sampleTxn method includes some logging and input data preparation. Usually modifications to this method are not required.
The handleSampleTxn method implements the actual logic of the transaction. This method must be customized to add the desired business logic.
For an inquiry transaction, handleSampleTxn accepts the parameters to the transaction and a DWLControl object as arguments. For a txn transaction, handleSampleTxn accepts the input business object as its sole argument.
The transaction handleSampleTxn returns an output business object that will then be returned to the user in the transaction response.
The MDM Workbench will generate MDM_TODO comments throughout the generated code to indicate where changes or additions to the code should be made.
No comments:
Post a Comment