For the purposes of simplicity, the term "entity" means an object mapped to the database using XML if talking about OJB and means an entity mapped to the database with JPA if we are talking about JPA.
- A user clicks on the "Create New" button for a business object being maintained
- KRAD+Spring framework will create a new MaintenanceForm which will create a new instance of MaintenanceDocumentBase
- MaintenanceDocumentBase is an entity which is mapped to the KRNS_MAINT_DOC_T table in OJB
- Mapping is defined below
- When MaintenanceDocumentBase is created, it creates an instance of the "new" and "old" maintainables by doing Class.newInstance() for the business or data object class (as defined in the data dictionary).
- This MaintenanceDocumentBase is stored on the form which is stored in the HttpSession
- This will then forward the request for processing to MaintenanceDocumentController
- This maintenance document will be associated with a DocumentHeader which is mapped to KRNS_DOC_HDR_T
- The form is returned to the view for rendering which will access properties of the document and the related business object being maintained (based on data dictionary configuration of the maintenance document)
- If any of the properties being accessed are lazy, then OJB will just-in-time start a JTA transaction and fetch the lazy relationship, committing the transaction at the end
- The rendered HTML will be returned to the browser
- Once the initial form is displayed to the user in the browser, they can fill in values on the form as desired.
- Any time the form is POST-ed to the server, the Spring MVC framework will take incoming post parameters and apply them to the document and it's related business objects by calling the appropriate "setter" methods.
- When the "save" or "submit" buttons are clicked, the following happens:
- The business objects for the maintenance documents are serialized to XML using XStream and that XML is set on MaintenanceDocumentBase.xmlDocumentContents
- The Document and DocumentHeader (currently stored on the form in the Session) are saved using PersistenceBroker.store, inserting records into KRNS_MAINT_DOC_T (including serialized XML) and KRNS_DOC_HDR_T
- The appropriate KEW action is executed
Opening an Enroute Document
- Once the document is enroute, a user will open the doc back up to take action against it by clicking on the document id from their Action List
- This will trigger the "docHandler" for this document.
- The MaintenanceDocumentController will load the existing Document and DocumentHeader using OJB
- As with create new, the document will be stored on the form, which is also stored in the HttpSession
- The business object will be deserialized from the XML representation stored in KRNS_DOC_HDR_T using XStream and set on the maintenance document
- The form is returned to the view for rendering of the form (the data may or may not be editable based on permissions on the document)
After Final Approval
Once all approvals have been gathered against the document, the workflow engine will switch it's status to "PROCESSED". This happens in a background thread so is not the direct result of using interaction (except that user interaction such as "approving" the document is what triggers the asynchronous background processing to happen). This triggers processing in KualiPostProcessor.doRouteStatusChange, the process of which is outlined below:
- Loads the document using DocumentService.getByDocumentHeaderId
- This will load the document from the database using OJB as well as deserializing the business objects from the XML content stored on KRNS_MAINT_DOC_T using XStream
- Invokes doRouteStatusChange on the document passing the status change event
- Since the document is processed, will save the business object via MaintainableImpl.saveDataObject
- This method will call BusinessObjectService.linkAndSave which will call PersistenceService.linkObjects and ultimately BusinessObjectDaoOjb.save
- The BusinessObjectDaoOjb.save method will do some things to "link in" collections and then call PersistenceBroker.store using OJB
- At this point the new business object is inserted into the database!