Fork me on GitHub

n. Slang a rough lawless young Kuali developer.
[perhaps variant of Houlihan, Irish surname]
kualiganism n

Blog of an rSmart Java Developer. Full of code examples, solutions, best practices, et al.

Wednesday, August 21, 2013

Overriding KIM DataDictionary Beans


KIM includes beans that accommodates most scenarios. There are some special cases. That's what's so great about Rice is most anything can be customized and easily. You just need to know how to do it. In this case, my institution wants to use email addresses as a principalName. That means that the current validations need to be loosened to support an email address.


  1. Update your rice-config.xml

    We need to add a line to rice-config.xml allows us to import an additional configuration file into Spring. This spring file will include our module override for KIM.

    Why SpringOverrides.xml?

    The reason we do this instead of just modifying the original source code is to separate our institution's changes from the original rice code. This makes it more maintainable.

  2. Override kimModuleConfiguration

    In classpath:edu/myinstitution/kuali/rice/kim/config/SpringOverrides.xml, we override the kimModuleConfiguration with our own myInstitutionKimModuleConfiguration-parentBean.

  3. Create a myInstitutionKimModuleConfiguration-parentBean

    myInstitutionKimModuleConfiguration-parentBean has a parent of kimModuleConfiguration-parentBean. This allows it to inherit all of the original kimModuleConfiguration properties. All that we really want to change here is to add our DataDictionary override file, classpath:edu/myinstitution/kuali/rice/kim/bo/datadictionary/KimBaseBeans.xml. This is done by merging this into the list of dataDicationaryPackages.

  4. Create KimBaseBeans.xml

    classpath:edu/myinstitution/kuali/rice/kim/bo/datadictionary/KimBaseBeans.xml referred from the SpringOverrides.xml needs to be created.

    Why a KimBaseBeans.xml?

    This follows the same pattern as we were using for the SpringOverrides.xml. We want to make modifications and override a bean in KimBaseBeans.xml, but without replacing or overriding all the other beans; therefore, we need one specific to our institution.

  5. Override KimBaseBeans-principalName

    In classpath:edu/myinstitution/kuali/rice/kim/bo/datadictionary/KimBaseBeans.xml, we create a new KimBaseBeans-principalName that is overridden by a new myInstitutionKimBaseBeans-principalName-parentBean.

  6. Create a myInstitutionKimBaseBeans-principalName-parentBean

    myInstitutionKimBaseBeans-principalName-parentBean has a parent of KimBaseBeans-principalName-parentBean. Just like our myInstitutionKimModuleConfiguration-parentBean, our myInstitutionKimBaseBeans-principalName-parentBean will inherit properties from KimBaseBeans-principalName-parentBean. All we need to change is the validationPattern. We use the RegexValidationPattern for email addresses.


There are so many other things that you can override with this approach. Aside from overriding KIM DataDictionary beans, it's possible to override DataDictionary beans from other modules. The largest difference is step 1.