use of org.finra.herd.model.api.xml.JobCreateRequest in project herd by FINRAOS.
the class StorageUnitStatusChangeNotificationJobActionServiceImpl method performNotificationAction.
@Override
public Object performNotificationAction(NotificationEventParamsDto notificationEventParams) throws Exception {
if (notificationEventParams instanceof StorageUnitNotificationEventParamsDto) {
StorageUnitNotificationEventParamsDto storageUnitNotificationEventParams = (StorageUnitNotificationEventParamsDto) notificationEventParams;
JobCreateRequest request = new JobCreateRequest();
JobDefinitionEntity jobDefinitionEntity = storageUnitNotificationEventParams.getNotificationJobAction().getJobDefinition();
request.setNamespace(jobDefinitionEntity.getNamespace().getCode());
request.setJobName(jobDefinitionEntity.getName());
request.setParameters(buildJobParameters(storageUnitNotificationEventParams));
/*
* Log enough information so we can trace back what notification registration triggered what workflow.
* This also allows us to reproduce the workflow execution if needed by logging the entire jobCreateRequest in JSON format.
*/
if (LOGGER.isInfoEnabled()) {
StorageUnitNotificationRegistrationEntity storageUnitNotificationRegistration = storageUnitNotificationEventParams.getStorageUnitNotificationRegistration();
LOGGER.info("Starting a job due to a notification. notificationRegistrationKey={} jobCreateRequest={}", jsonHelper.objectToJson(notificationRegistrationHelper.getNotificationRegistrationKey(storageUnitNotificationRegistration)), jsonHelper.objectToJson(request));
}
return jobService.createAndStartJob(request);
} else {
throw new IllegalStateException("Notification event parameters DTO passed to the method must be an instance of StorageUnitNotificationEventParamsDto.");
}
}
Aggregations