Load KIM Entities

After the IAM/KIM matching process we had 3 general groups; 1) new entities with principal information, 2) new entities without principal information, and 3) new principals that are added to existing entities.

The third group allows us to add principals to entities that might have originally been added without principal information. It also allows us to add new principal information when someone has change their UserId and Uuid.

It has been our assumption that KFS can handle an entity with multiple principals but it appears that TRS has difficulty with these so occasionally one of the principals must be manually deleted for TRS to work.

 

The process for loading a KIM entity that has principal information is this:

INSERT INTO KRIM_ENTITY_T ("ENTITY_ID", "OBJ_ID", "VER_NBR", "ACTV_IND", "LAST_UPDT_DT")
VALUES ($EntityId, SYS_GUID(), 1, $ActvEntityInd, CURRENT_DATE);
INSERT INTO KRIM_PRNCPL_T ("PRNCPL_ID", "OBJ_ID", "VER_NBR", "PRNCPL_NM", "ENTITY_ID", "PRNCPL_PSWD", "ACTV_IND", "LAST_UPDT_DT")
VALUES ($PrincipalId, SYS_GUID(), 1, $PrincipalName, $EntityId, NULL, $ActvPrincipalInd, CURRENT_DATE);
INSERT INTO KRIM_ENTITY_NM_T ("ENTITY_NM_ID", "OBJ_ID", "VER_NBR", "ENTITY_ID", "NM_TYP_CD", "FIRST_NM", "MIDDLE_NM", "LAST_NM", "SUFFIX_NM", "PREFIX_NM", 
"DFLT_IND", "ACTV_IND", "LAST_UPDT_DT", "NOTE_MSG", "NM_CHNG_DT", "TITLE_NM")
VALUES (KRIM_ENTITY_NM_ID_S.NEXTVAL, SYS_GUID(), 1, $EntityId, 'PRFR', $FirstName, $MiddleName, $LastName, NULL, NULL, 'Y', 'Y', CURRENT_DATE, NULL, NULL, NULL);
INSERT INTO KRIM_ENTITY_ENT_TYP_T ("ENT_TYP_CD", "ENTITY_ID", "OBJ_ID", "VER_NBR", "ACTV_IND", "LAST_UPDT_DT")
VALUES ('PERSON', $EntityId, SYS_GUID(), 1, 'Y', CURRENT_DATE);

The process for loading a KIM entity that has no principal information is this:

INSERT INTO KRIM_ENTITY_T ("ENTITY_ID", "OBJ_ID", "VER_NBR", "ACTV_IND", "LAST_UPDT_DT")
VALUES ($EntityId, SYS_GUID(), 1, $ActvEntityInd, CURRENT_DATE);
INSERT INTO KRIM_ENTITY_NM_T ("ENTITY_NM_ID", "OBJ_ID", "VER_NBR", "ENTITY_ID", "NM_TYP_CD", "FIRST_NM", "MIDDLE_NM", "LAST_NM", "SUFFIX_NM", "PREFIX_NM", 
"DFLT_IND", "ACTV_IND", "LAST_UPDT_DT", "NOTE_MSG", "NM_CHNG_DT", "TITLE_NM")
VALUES (KRIM_ENTITY_NM_ID_S.NEXTVAL, SYS_GUID(), 1, $EntityId, 'PRFR', $FirstName, $MiddleName, $LastName, NULL, NULL, 'Y', 'Y', CURRENT_DATE, NULL, NULL, NULL);
INSERT INTO KRIM_ENTITY_ENT_TYP_T ("ENT_TYP_CD", "ENTITY_ID", "OBJ_ID", "VER_NBR", "ACTV_IND", "LAST_UPDT_DT")
VALUES ('PERSON', $EntityId, SYS_GUID(), 1, 'Y', CURRENT_DATE);

The process for loading an additional principal for an existing entity is this:

INSERT INTO KRIM_PRNCPL_T ("PRNCPL_ID", "OBJ_ID", "VER_NBR", "PRNCPL_NM", "ENTITY_ID", "PRNCPL_PSWD", "ACTV_IND", "LAST_UPDT_DT")
VALUES ($PrincipalId, SYS_GUID(), 1, $PrincipalName, $EntityId, NULL, $ActvPrincipalInd, CURRENT_DATE);