使用 AftExport 事件

使用 EPM 整合代理程式寫回時,請在將資料插入表格後,使用 AftExport 進行所有後處理清除作業。

下列指令碼範例顯示如何呼叫在寫回後執行的外部 API。

此範例中的 AftExport 事件:

  • 列印 agentContextParams 對映的內容
  • 將資訊訊息列印到代理程式的程序日誌中。此項目會記錄在 EPM_APP_DATA_HOME\logs 的程序日誌中。
  • 將所有嚴重錯誤訊息列印到代理程式的程序日誌中。此項目會記錄在 EPM_APP_DATA_HOME\logs 的程序日誌中。

如需 EPM 整合代理程式環境定義函數的相關資訊,請參閱 EPM 整合代理程式的環境定義函數

請注意,這個指令碼只是個範例,我們無法保證它毫無缺點,因此請勿向 Oracle 客戶服務部提出關於該指令碼之任何相關疑問或問題的服務要求。

import sys

'''
After export custom script. This script will be called after the writeback finishes execution.
'''
#print "Begin: AftExport.py"

#print 'Event Type is: ' + event

'''
Print the contents of the agentContextParams map which is an unmodifiable map. 
'''
#print 'JOBTYPE: ' + agentContext["JOBTYPE"]
#print 'EPM_APP_DATA_HOME: ' + agentContext["EPM_APP_DATA_HOME"]
#print 'WRITEBACK_DATA_FILE: ' + agentContext["WRITEBACK_DATA_FILE"]
#print 'JOBID: ' + str(agentContext["JOBID"])
#print 'INTEGRATION: ' + agentContext["INTEGRATION"]
#print 'LOCATION: ' + agentContext["LOCATION"]
#print 'SOURCE_APPLICATION: ' + agentContext["SOURCE_APPLICATION"]
#print 'TARGET_APPLICATION: ' + agentContext["TARGET_APPLICATION"]



'''
Log an info message to the agent process log. This entry will be logged only to the process log in EPM_APP_DATA_HOME\logs
folder and not to epmagent.log. The log entry will be created at INFO log level.
'''
#agentAPI.logInfo("SAMPLE: INFO log message from script")


'''
Log an severe message to the agent process log. This entry will be logged into the process log in EPM_APP_DATA_HOME\logs
folder and also into epmagent.log. The log entry will be created at SEVERE log level.
'''
#agentAPI.logError("SAMPLE: SEVERE log message from script")


'''
Return false in case of error, which will throw an exception in the agent.
'''
returnValue = 'true'

#print "End: AftExport.py"