use of org.finra.herd.model.api.xml.Parameter in project herd by FINRAOS.
the class JobServiceImpl method signalJob.
@Override
public Job signalJob(JobSignalRequest request) throws Exception {
// Perform the validation.
validateJobSignalRequest(request);
Execution execution = activitiService.getExecutionByProcessInstanceIdAndActivitiId(request.getId(), request.getReceiveTaskId());
if (execution == null) {
throw new ObjectNotFoundException(String.format("No job found for matching job id: \"%s\" and receive task id: \"%s\".", request.getId(), request.getReceiveTaskId()));
}
String processDefinitionKey = activitiService.getProcessInstanceById(execution.getProcessInstanceId()).getProcessDefinitionKey();
checkPermissions(processDefinitionKey, new NamespacePermissionEnum[] { NamespacePermissionEnum.EXECUTE });
// Retrieve the job before signaling.
Job job = getJob(request.getId(), false, false);
// Build the parameters map
Map<String, Object> signalParameters = getParameters(request);
// Signal the workflow.
activitiService.signal(execution.getId(), signalParameters);
// Build the parameters map merged with job and signal parameters.
Map<String, Object> mergedParameters = new HashMap<>();
for (Parameter jobParam : job.getParameters()) {
mergedParameters.put(jobParam.getName(), jobParam.getValue());
}
mergedParameters.putAll(signalParameters);
// Update the parameters in job
populateWorkflowParameters(job, mergedParameters);
return job;
}
use of org.finra.herd.model.api.xml.Parameter in project herd by FINRAOS.
the class BusinessObjectDataNotificationJobActionServiceImpl method buildJobParameters.
private List<Parameter> buildJobParameters(BusinessObjectDataNotificationEventParamsDto businessObjectDataNotificationEventParams) throws IOException {
List<Parameter> parameters = new ArrayList<>();
BusinessObjectData businessObjectData = businessObjectDataNotificationEventParams.getBusinessObjectData();
NotificationJobActionEntity notificationJobActionEntity = businessObjectDataNotificationEventParams.getNotificationJobAction();
parameters.add(new Parameter(PARAM_NAMESPACE, businessObjectDataNotificationEventParams.getBusinessObjectDataNotificationRegistration().getNamespace().getCode()));
parameters.add(new Parameter(PARAM_NOTIFICATION_NAME, businessObjectDataNotificationEventParams.getBusinessObjectDataNotificationRegistration().getName()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA_EVENT_TYPE, businessObjectDataNotificationEventParams.getEventType()));
parameters.add(new Parameter(PARAM_CORRELATION_DATA, notificationJobActionEntity.getCorrelationData()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA, jsonHelper.objectToJson(businessObjectData)));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DEFINITION_NAMESPACE, businessObjectData.getNamespace()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DEFINITION_NAME, businessObjectData.getBusinessObjectDefinitionName()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_USAGE, businessObjectData.getBusinessObjectFormatUsage()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_FILE_TYPE, businessObjectData.getBusinessObjectFormatFileType()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_VERSION, Integer.toString(businessObjectData.getBusinessObjectFormatVersion())));
parameters.add(new Parameter(PARAM_PARTITION_COLUMN_NAMES, herdStringHelper.buildStringWithDefaultDelimiter(businessObjectDataNotificationEventParams.getPartitionColumnNames())));
parameters.add(new Parameter(PARAM_PARTITION_VALUES, herdStringHelper.buildStringWithDefaultDelimiter(businessObjectDataNotificationEventParams.getPartitionValues())));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA_VERSION, Integer.toString(businessObjectData.getVersion())));
parameters.add(new Parameter(PARAM_NEW_BUSINESS_OBJECT_DATA_STATUS, businessObjectDataNotificationEventParams.getNewBusinessObjectDataStatus()));
parameters.add(new Parameter(PARAM_OLD_BUSINESS_OBJECT_DATA_STATUS, businessObjectDataNotificationEventParams.getOldBusinessObjectDataStatus()));
return parameters;
}
use of org.finra.herd.model.api.xml.Parameter in project herd by FINRAOS.
the class EmrHelper method getParameterList.
/**
* Returns parameter list
*
* @param properties properties
*
* @return list of parameters
*/
protected List<Parameter> getParameterList(Map<String, String> properties) {
List<Parameter> parameters = null;
if (!CollectionUtils.isEmpty(properties)) {
parameters = new ArrayList<>();
for (Map.Entry<String, String> entry : properties.entrySet()) {
Parameter parameter = new Parameter(entry.getKey(), entry.getValue());
parameters.add(parameter);
}
}
return parameters;
}
use of org.finra.herd.model.api.xml.Parameter in project herd by FINRAOS.
the class EmrDaoImpl method addDaemonBootstrapActionConfig.
private void addDaemonBootstrapActionConfig(EmrClusterDefinition emrClusterDefinition, ArrayList<BootstrapActionConfig> bootstrapActions) {
// Add daemon Configuration support if needed
if (!CollectionUtils.isEmpty(emrClusterDefinition.getDaemonConfigurations())) {
BootstrapActionConfig daemonBootstrapActionConfig = getBootstrapActionConfig(ConfigurationValue.EMR_CONFIGURE_DAEMON.getKey(), configurationHelper.getProperty(ConfigurationValue.EMR_CONFIGURE_DAEMON));
// Add arguments to the bootstrap script
ArrayList<String> argList = new ArrayList<>();
for (Parameter daemonConfig : emrClusterDefinition.getDaemonConfigurations()) {
argList.add(daemonConfig.getName() + "=" + daemonConfig.getValue());
}
// Add the bootstrap action with arguments
daemonBootstrapActionConfig.getScriptBootstrapAction().setArgs(argList);
bootstrapActions.add(daemonBootstrapActionConfig);
}
}
use of org.finra.herd.model.api.xml.Parameter in project herd by FINRAOS.
the class SystemJobServiceTest method testRunSystemJobBusinessObjectDataFinalizeRestoreUpperCaseParameters.
@Test
public void testRunSystemJobBusinessObjectDataFinalizeRestoreUpperCaseParameters() throws Exception {
// Create a system job run request using upper case input parameters (except for case-sensitive job name).
SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(BusinessObjectDataFinalizeRestoreJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.BDATA_FINALIZE_RESTORE_JOB_MAX_BDATA_INSTANCES.getKey().toUpperCase(), String.valueOf(INTEGER_VALUE))));
// Request to run the system job.
SystemJobRunResponse resultSystemJobRunResponse = systemJobService.runSystemJob(systemJobRunRequest);
// Validate the returned object.
assertEquals(new SystemJobRunResponse(BusinessObjectDataFinalizeRestoreJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.BDATA_FINALIZE_RESTORE_JOB_MAX_BDATA_INSTANCES.getKey().toUpperCase(), String.valueOf(INTEGER_VALUE)))), resultSystemJobRunResponse);
}
Aggregations