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, November 9, 2011

Current KIM Refactoring Documentation

Overview

There are 2 ways to add objects to KIM.
  • Rice User Interface
  • SQL insert statements when building the application
. Since Kuali is venturing into the use of liquibase, I have put together custom refactorings that simplify adding objects to KIM and other Rice modules.

Using SQL

This is how one would normally create an attribute, create a responsibility, add the responsibility to a role, and add an attribute to a responsibility.

Example

-- International Travel Reviewer Node
insert into krim_rsp_t (rsp_id, nmspc_cd, nm, actv_ind, rsp_tmpl_id, ver_nbr, obj_id)
values(krim_rsp_id_s.nextval, 'KFS-TEM', 'Review', 'Y', 1, 1, sys_guid());


insert into krim_role_t (role_id, obj_id, ver_nbr, nmspc_cd, role_nm, kim_typ_id, actv_ind, last_updt_dt)
   values (krim_role_id_s.nextval, sys_guid(), 1, 'KFS-TEM', 'International Travel Reviewer',
   (select kim_typ_id from krim_typ_t where nm = 'Default' and nmspc_cd = 'KUALI' and actv_ind = 'Y'),
    'Y', SYSDATE);

insert into krim_rsp_attr_data_t (attr_data_id, obj_id, ver_nbr, rsp_id, kim_typ_id, kim_attr_defn_id, attr_val)
values(krim_rsp_rqrd_attr_id_s.nextval, sys_guid(), 1, krim_rsp_id_s.currval, 7, 16, 'InternationalTravelReviewer');

insert into krim_rsp_attr_data_t (attr_data_id, obj_id, ver_nbr, rsp_id, kim_typ_id, kim_attr_defn_id, attr_val)
values(krim_rsp_rqrd_attr_id_s.nextval, sys_guid(), 1, krim_rsp_id_s.currval, 7, 13, 'TA');

insert into krim_rsp_attr_data_t (attr_data_id, obj_id, ver_nbr, rsp_id, kim_typ_id, kim_attr_defn_id, attr_val)
values(krim_rsp_rqrd_attr_id_s.nextval, sys_guid(), 1, krim_rsp_id_s.currval, 7, 41, 'false');

insert into krim_rsp_attr_data_t (attr_data_id, obj_id, ver_nbr, rsp_id, kim_typ_id, kim_attr_defn_id, attr_val)
values(krim_rsp_rqrd_attr_id_s.nextval, sys_guid(), 1, krim_rsp_id_s.currval, 7, 40, 'false');

insert into krim_role_rsp_t (role_rsp_id, obj_id, ver_nbr, role_id, rsp_id, actv_ind)
values (krim_role_rsp_id_s.nextval, sys_guid(), 1, (select role_id from krim_role_t where role_nm = 'International Travel Reviewer' and nmspc_cd= 'KFS-TEM'), krim_rsp_id_s.currval, 'Y');

insert into krim_role_rsp_actn_t (role_rsp_actn_id, obj_id, ver_nbr, actn_typ_cd, priority_nbr, actn_plcy_cd, role_mbr_id, role_rsp_id, frc_actn)
   values (krim_role_rsp_actn_id_s.nextval, sys_guid(), 1, 'A', 1, 'F', '*',
   (select role_rsp_id from krim_role_rsp_t where role_id = (select role_id from krim_role_t where role_nm = 'International Travel Reviewer' and nmspc_cd = 'KFS-TEM')),
    'N');

New Liquibase Refactoring Method

I have documented a better way on the Rice Liquibase Extensions page.


No comments:

Post a Comment