Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It currently exists for a whole five business object classes in Chart of Accounts: Accounts, Object Codes, Account Delegates, Sub-Object Codes, and Organization Reversions. While largely similar to most other maintenance documents, there are a couple of differences to look at: global business objects must implement the GlobalBusinessObject method, they all have one or more collections of "details" (this is what makes them batch updates), and they must define a custom Maintainable.

Implementing org.kuali.

...

kfs.kns.bo.GlobalBusinessObject
Anchor
global_business_object
global_business_object

A global business object is, much like a transactional document class, a business object - it has references that can be refreshed, it can be persisted to a datastore - but it also shares qualities with documents. Unlike a regular maintenance document, which wraps a business object in the MaintenanceDocument class, the global business object is itself a document. It must declare a documentNumber, and tables for it and any associated "detail" objects must be created in the database along with OJB mappings. ojb-coa.xml has the OJB mapping for org.kuali.kfs.coa.businessobject.AccountGlobal, and that provides an excellent example of what a table mapping for a global business object will look like.

...

Global business objects must implement the org.kuali.ricekfs.kns.bo.GlobalBusinessObject interface. Let's take a tour of the methods we must implement:

...

First, we have to create a class that extends org.kuali.ricekfs.kns.bo.GlobalBusinessObjectDetailBase. This class doesn't have much - just a document number, which acts as a foreign key to the global business object. The detail class can then have whatever methods it needs, typically getter/setter properties for the attributes that the user needs to enter. We also must create a database table to hold records of each type of detail business object and we have to set up the OJB mappings for the detail table.

...

The collection is named after the property, and it uses the detail class as its business object class.

Extending org.kuali.

...

kfs.kns.maintenance.KualiGlobalMaintainableImpl
Anchor
global_maintainable
global_maintainable

Global maintenance documents have a special maintainable implementation to extend, called KualiGlobalMaintainableImpl. It has a lot of utility methods for the maintenance of the global object, and we'll take a look at those in a second. However, it has one abstract method, which requires that we create an implementation for it: generateMaintenanceLocks(). Just as for non-global maintenance documents, this method creates a String representation of a business object to lock, so that no other user can edit that business object while the maintenance document is in workflow. While KualiMaintainableImpl can use an algorithm to generate those locks correctly most of the time, there's no way to do that for the global maintenance document, because the global maintenance document needs to generate a lock for every single business object that could be updated, inserted, or deactivated by the document. There, this method must be created. For examples of use, check out the existing global maintenance documents; for instance, org.kuali.kfs.coa.document.ObjectCodeGlobalMaintainableImpl has a very straightforward lock generation algorithm that can be adapted to the needs of different global maintenance documents.

...