Uso de un evento BefExport

Si realiza la reescritura mediante el agente de integración de EPM, utilice el evento BefExport para realizar cualquier acción antes de insertar datos en la tabla, o bien puede reemplazar el procesamiento de inserción predeterminado.

El siguiente ejemplo de script muestra cómo llamar a una API externa que se ejecuta antes de la reescritura.

El evento BefExport en este ejemplo:

  • imprime el contenido del mapa agentContextParams
  • recupera e imprime el nombre de la tabla en la que los datos se insertan.
  • recupera e imprime la consulta de inserción
  • imprime un mensaje de información en el log de proceso de agente. Esta entrada se registra en el log de proceso en EPM_APP_DATA_HOME\logs y epmagent.log.

Para obtener más información sobre las funciones de contexto del agente de integración de EPM, consulte Funciones de contexto del Agente de integración de EPM.

Tenga en cuenta que este script solo se proporciona como ejemplo y que no está garantizado frente a defectos, y que los usuarios no pueden registrar ninguna solicitud de servicio en el soporte de Oracle en relación con preguntas o problemas sobre el script.

import sys
import java

'''
Before export custom script. This script will be called before the writeback begins execution.
'''
#print Begin: BefExport.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"]



'''
getTable() Method to fetch the table name into which the data will be inserted. This is 
passed from cloud to the agent during the writeback execution call.
'''
#print "Printing Table Name: " + agentAPI.getTable()


'''
getInsertQuery() Method to fetch the insert query. This is the query which is
passed from cloud to the agent during the writeback execution call.
'''
#print "Printing Query: " + agentAPI.getInsertQuery()


'''
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")


'''
Uncomment to skip the export data execution. The writeback execution can be skipped only during the
BEFORE_EXPORT event. This will skip the execution of the insert statements. The cloud process will be marked as failed in the Export data step. 
'''
#agentAPI.skipAction('true')


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

#print "End: BefExport.py"