__IF_EXISTS__
SELECT 1
  FROM CI_UT_INSTL_DTL
WHERE SCRIPT_FILE_NAME = 'FW45001_APDATA_UGBUPD-1555.SQL'
   AND END_DTTM IS NOT NULL
/
__THEN__
__EXIT__
__ENDIF__


UPDATE CI_XAI_FORMAT SET OWNER_FLG = 'CM' WHERE XAI_FORMAT_ID IN ('BasePhone', 'European Date', 'LocalDateTime', 
'LowerCase', 'OracleDate', 'OracleTime', 'ProperCase', 'Siebel Date', 'Siebel DateTime', 'US Currency', 'US Date', 'US Phone', 'UpperCase')
/
UPDATE CI_XAI_FORMAT_L SET OWNER_FLG = 'CM' WHERE XAI_FORMAT_ID IN ('BasePhone', 'European Date', 'LocalDateTime', 
'LowerCase', 'OracleDate', 'OracleTime', 'ProperCase', 'Siebel Date', 'Siebel DateTime', 'US Currency', 'US Date', 'US Phone', 'UpperCase')
/

UPDATE CI_XAI_CLASS SET OWNER_FLG = 'CM' WHERE XAI_CLASS_ID IN ('DWNSTGRCVR', 'DWNSTGSNDR', 'FILESCANRCVR', 'JMSRCVR',
'OUTMSGRCVR', 'SIEBELADA', 'STGCTLRCVR', 'STGRCVR', 'STGSENDER', 'STGUPADA', 'TPCRCVR', 'UPLDERRHNDLR', 'XAICMNDADA', 
'XAIURLEXEC', 'XMLFILERCVR')
/

UPDATE CI_XAI_CLASS_L SET OWNER_FLG = 'CM' WHERE XAI_CLASS_ID IN ('DWNSTGRCVR', 'DWNSTGSNDR', 'FILESCANRCVR', 'JMSRCVR',
'OUTMSGRCVR', 'SIEBELADA', 'STGCTLRCVR', 'STGRCVR', 'STGSENDER', 'STGUPADA', 'TPCRCVR', 'UPLDERRHNDLR', 'XAICMNDADA', 
'XAIURLEXEC', 'XMLFILERCVR')
/

UPDATE CI_XAI_ADAPTER SET OWNER_FLG = 'CM' WHERE XAI_ADAPTER_ID IN ('CISStagingUpload', 'CorDaptix', 'SiebelXMLGateway')
/

UPDATE CI_XAI_ADAPTER_L SET OWNER_FLG = 'CM' WHERE XAI_ADAPTER_ID IN ('CISStagingUpload', 'CorDaptix', 'SiebelXMLGateway')
/

__IF_EXISTS__
select 1 from CI_BATCH_RUN where BATCH_CD = 'F1-XMLPG'
/

__THEN__
update CI_BATCH_CTRL set OWNER_FLG = 'CM', APP_SVC_ID = 'F1-DFLTS' where BATCH_CD = 'F1-XMLPG'
/
update CI_BATCH_CTRL_L set OWNER_FLG = 'CM' where BATCH_CD = 'F1-XMLPG'
/
UPDATE CI_BATCH_CTRL_L SET DESCR = DESCR || ' (Deprecated)', DESCRLONG = 'This Batch Control is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCRLONG WHERE BATCH_CD = 'F1-XMLPG' AND LANGUAGE_CD = 'ENG'
/
update CI_BATCH_CTRL_P set OWNER_FLG = 'CM' where BATCH_CD = 'F1-XMLPG'
/
update CI_BATCH_CTRL_P_L set OWNER_FLG = 'CM' where BATCH_CD = 'F1-XMLPG'
/
__ELSE__
__ENDIF__

__IF_EXISTS__
select 1 from CI_BATCH_RUN where BATCH_CD = 'F1-DTDOM'
/

__THEN__
update CI_BATCH_CTRL set OWNER_FLG = 'CM', APP_SVC_ID = 'F1-DFLTS' where BATCH_CD = 'F1-DTDOM'
/
update CI_BATCH_CTRL_L set OWNER_FLG = 'CM' where BATCH_CD = 'F1-DTDOM'
/
UPDATE CI_BATCH_CTRL_L SET DESCR = DESCR || ' (Deprecated)', DESCRLONG = 'This Batch Control is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCRLONG WHERE BATCH_CD = 'F1-DTDOM' AND LANGUAGE_CD = 'ENG'
/
update CI_BATCH_CTRL_P set OWNER_FLG = 'CM' where BATCH_CD = 'F1-DTDOM'
/
update CI_BATCH_CTRL_P_L set OWNER_FLG = 'CM' where BATCH_CD = 'F1-DTDOM'
/
__ELSE__
__ENDIF__

__IF_EXISTS__
select 1 from CI_TD_ENTRY where TD_TYPE_CD = 'F1-INJMS'
/

__THEN__
update CI_TD_TYPE set OWNER_FLG = 'CM', NAV_OPT_CD = 'toDoEntryMaint' where TD_TYPE_CD = 'F1-INJMS'
/
update CI_TD_DRLKEY_TY set OWNER_FLG = 'CM' where TD_TYPE_CD = 'F1-INJMS'
/
update CI_TD_SRTKEY_TY set OWNER_FLG = 'CM' where TD_TYPE_CD = 'F1-INJMS'
/
update CI_TD_SRTKEY_TY_L set OWNER_FLG = 'CM' where TD_TYPE_CD = 'F1-INJMS'
/
update CI_TD_TYPE_L set OWNER_FLG = 'CM' where TD_TYPE_CD = 'F1-INJMS'
/
update CI_TD_TYPE_L set DESCR = DESCR || ' (Deprecated)', DESCRLONG = 'This To Do Type is no longer supported.  It is retained for backward compatibility reasons only.  Its navigation option refers to To Do Entry as the original navigation option is no longer supported. ' || DESCRLONG WHERE TD_TYPE_CD = 'F1-INJMS' AND LANGUAGE_CD = 'ENG'
/
__ELSE__

Delete from CI_CHTY_TDTY where TD_TYPE_CD = 'F1-INJMS'
/
Delete from CI_TD_EX_LIST where TD_TYPE_CD = 'F1-INJMS'
/
Delete from CI_TD_TYPE_ALG where TD_TYPE_CD = 'F1-INJMS'
/
Delete from CI_TD_TYPE_CHAR where TD_TYPE_CD = 'F1-INJMS'
/
Delete from CI_TD_VAL_ROLE where TD_TYPE_CD = 'F1-INJMS'
/
__ENDIF__

__IF_EXISTS__
select 1 from CI_TD_ENTRY where TD_TYPE_CD = 'F1-OUTMS'
/

__THEN__
update CI_TD_TYPE set OWNER_FLG = 'CM' where TD_TYPE_CD = 'F1-OUTMS'
/
update CI_TD_DRLKEY_TY set OWNER_FLG = 'CM' where TD_TYPE_CD = 'F1-OUTMS'
/
update CI_TD_SRTKEY_TY set OWNER_FLG = 'CM' where TD_TYPE_CD = 'F1-OUTMS'
/
update CI_TD_SRTKEY_TY_L set OWNER_FLG = 'CM' where TD_TYPE_CD = 'F1-OUTMS'
/
update CI_TD_TYPE_L set OWNER_FLG = 'CM' where TD_TYPE_CD = 'F1-OUTMS'
/
update CI_TD_TYPE_L set DESCR = DESCR || ' (Deprecated)', DESCRLONG = 'This To Do Type is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCRLONG WHERE TD_TYPE_CD = 'F1-OUTMS' AND LANGUAGE_CD = 'ENG'
/
__ELSE__

Delete from CI_CHTY_TDTY where TD_TYPE_CD = 'F1-OUTMS'
/
Delete from CI_TD_EX_LIST where TD_TYPE_CD = 'F1-OUTMS'
/
Delete from CI_TD_TYPE_ALG where TD_TYPE_CD = 'F1-OUTMS'
/
Delete from CI_TD_TYPE_CHAR where TD_TYPE_CD = 'F1-OUTMS'
/
Delete from CI_TD_VAL_ROLE where TD_TYPE_CD = 'F1-OUTMS'
/
__ENDIF__


__IF_EXISTS__
select 1 from F1_MIGR_DATA_ST where MIGR_REQ_CD = 'F1-XAI-Admin'
union
select 1 from F1_MIGR_REQ_INCL_REQ where INCL_MIGR_REQ_CD = 'F1-XAI-Admin'
/

__THEN__
update F1_MIGR_REQ set OWNER_FLG = 'CM' where MIGR_REQ_CD = 'F1-XAI-Admin'
/
update F1_MIGR_REQ_INCL_REQ set OWNER_FLG = 'CM' where MIGR_REQ_CD = 'F1-XAI-Admin'
/
update F1_MIGR_REQ_INSTR set OWNER_FLG = 'CM' where MIGR_REQ_CD = 'F1-XAI-Admin'
/
update F1_MIGR_REQ_INSTR_ENTITY set OWNER_FLG = 'CM' where MIGR_REQ_CD = 'F1-XAI-Admin'
/
update F1_MIGR_REQ_INSTR_L set OWNER_FLG = 'CM' where MIGR_REQ_CD = 'F1-XAI-Admin'
/
update F1_MIGR_REQ_L set OWNER_FLG = 'CM' where MIGR_REQ_CD = 'F1-XAI-Admin'
/
update F1_MIGR_REQ_L set DESCR = DESCR || ' (Deprecated)', DESCRLONG = 'This Migration Request is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCRLONG where MIGR_REQ_CD = 'F1-XAI-Admin' and LANGUAGE_CD = 'ENG'
/
__ELSE__
__ENDIF__

__IF_EXISTS__
select 1 from F1_MIGR_REQ_INSTR where MIGR_PLAN_CD = 'F1-XAI-Receiver'
union
select 1 from F1_MIGR_TRANS where MIGR_PLAN_CD = 'F1-XAI-Receiver'
/

__THEN__
update F1_MIGR_PLAN set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-Receiver'
/
update F1_MIGR_PLAN_INSTR set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-Receiver'
/
update F1_MIGR_PLAN_INSTR_ALG set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-Receiver'
/
update F1_MIGR_PLAN_INSTR_L set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-Receiver'
/
update F1_MIGR_PLAN_L set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-Receiver' 
/
update F1_MIGR_PLAN_L set DESCR = DESCR || ' (Deprecated)', DESCRLONG = 'This Migration Plan is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCRLONG where MIGR_PLAN_CD = 'F1-XAI-Receiver' and LANGUAGE_CD = 'ENG'
/
update CI_MD_MO_OPT set OWNER_FLG = 'CM' where MAINT_OBJ_OPT_FLG = 'F1DM' and MAINT_OBJ_OPT_VAL = 'F1-XAI-Receiver'
/

__ELSE__
__ENDIF__

__IF_EXISTS__
select 1 from F1_MIGR_REQ_INSTR where MIGR_PLAN_CD = 'F1-XAI-RouteType'
union
select 1 from F1_MIGR_TRANS where MIGR_PLAN_CD = 'F1-XAI-RouteType'
/

__THEN__
update F1_MIGR_PLAN set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-RouteType'
/
update F1_MIGR_PLAN_INSTR set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-RouteType'
/
update F1_MIGR_PLAN_INSTR_ALG set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-RouteType'
/
update F1_MIGR_PLAN_INSTR_L set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-RouteType'
/
update F1_MIGR_PLAN_L set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-RouteType'
/
update F1_MIGR_PLAN_L set DESCR = DESCR || ' (Deprecated)', DESCRLONG = 'This Migration Plan is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCRLONG where MIGR_PLAN_CD = 'F1-XAI-RouteType' and LANGUAGE_CD = 'ENG'
/
update CI_MD_MO_OPT set OWNER_FLG = 'CM' where MAINT_OBJ_OPT_FLG = 'F1DM' and MAINT_OBJ_OPT_VAL = 'F1-XAI-RouteType'
/

__ELSE__
__ENDIF__

__IF_EXISTS__
select 1 from F1_MIGR_REQ_INSTR where MIGR_PLAN_CD = 'F1-XAI-Rule' and NOT (MIGR_REQ_CD = 'F1-XAI-Admin' and OWNER_FLG = 'F1')
union
select 1 from F1_MIGR_TRANS where MIGR_PLAN_CD = 'F1-XAI-Rule'
/

__THEN__
update F1_MIGR_PLAN set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-Rule'
/
update F1_MIGR_PLAN_INSTR set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-Rule'
/
update F1_MIGR_PLAN_INSTR_ALG set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-Rule'
/
update F1_MIGR_PLAN_INSTR_L set OWNER_FLG = 'CM' where MIGR_PLAN_CD = 'F1-XAI-Rule'
/
update F1_MIGR_PLAN_L set OWNER_FLG = 'CM', DESCR = DESCR || ' (Deprecated)', DESCRLONG = 'This Migration Plan is no longer supported.  It is retained for backward compatibility reasons only. ' || DESCRLONG where MIGR_PLAN_CD = 'F1-XAI-Rule' and LANGUAGE_CD = 'ENG'
/
update CI_MD_MO_OPT set OWNER_FLG = 'CM' where MAINT_OBJ_OPT_FLG = 'F1DM' and MAINT_OBJ_OPT_VAL = 'F1-XAI-Rule'
/

__ELSE__
__ENDIF__
