use of org.motechproject.tasks.domain.mds.channel.TriggerEvent in project motech by motech.
the class TasksTestBase method setTriggerEvent.
protected void setTriggerEvent() {
List<EventParameter> triggerEventParameters = new ArrayList<>();
triggerEventParameters.add(new EventParameter("ExternalID", "externalId"));
triggerEventParameters.add(new EventParameter("StartDate", "startDate", DATE));
triggerEventParameters.add(new EventParameter("EndDate", "endDate", DATE));
triggerEventParameters.add(new EventParameter("FacilityId", "facilityId"));
triggerEventParameters.add(new EventParameter("EventName", "eventName"));
triggerEventParameters.add(new EventParameter("List", "list", LIST));
triggerEventParameters.add(new EventParameter("Map", "map", MAP));
triggerEvent = new TriggerEvent();
triggerEvent.setSubject(TRIGGER_SUBJECT);
triggerEvent.setEventParameters(triggerEventParameters);
}
use of org.motechproject.tasks.domain.mds.channel.TriggerEvent in project motech by motech.
the class TaskServiceImpl method validateAction.
private Set<TaskError> validateAction(Task task, Channel channel, TaskActionInformation action) {
LOGGER.debug("Validating task action: {} from task: {} with ID: {}", action.getName(), task.getName(), task.getId());
Set<TaskError> errors = new HashSet<>();
if (channel == null) {
errors.add(new TaskError("task.validation.error.actionChannelNotRegistered"));
return errors;
}
if (channel.getModuleName().equalsIgnoreCase(action.getModuleName())) {
errors.addAll(taskValidator.validateAction(action, channel));
TriggerEvent trigger = triggerEventService.getTrigger(task.getTrigger());
Map<Long, TaskDataProvider> providers = getProviders(task);
ActionEvent actionEvent = channel.getAction(action);
if (actionEvent != null) {
errors.addAll(taskValidator.validateActionFields(action, actionEvent, trigger, providers));
}
}
logResultOfValidation("task action", task.getName(), errors);
return errors;
}
use of org.motechproject.tasks.domain.mds.channel.TriggerEvent in project motech by motech.
the class SchedulerChannelProviderBundleIT method getExpectedTrigger.
private TriggerEvent getExpectedTrigger() {
List<EventParameter> parameters = new ArrayList<>();
parameters.add(new EventParameter("scheduler.jobId", "JobID"));
return new TriggerEvent("Job: test-event-job_id", "test-event-job_id", null, parameters, TEST_EVENT);
}
use of org.motechproject.tasks.domain.mds.channel.TriggerEvent in project motech by motech.
the class AbstractTaskBundleIT method findTriggerEventBySubject.
protected TriggerEvent findTriggerEventBySubject(List<TriggerEvent> triggerEvents, String subject) {
TaskEvent taskEvent = findTaskEventBySubject(triggerEvents, subject);
assertTrue(taskEvent instanceof TriggerEvent);
return (TriggerEvent) taskEvent;
}
use of org.motechproject.tasks.domain.mds.channel.TriggerEvent in project motech by motech.
the class DynamicChannelLoaderImplTest method prepareTriggerEvents.
private List<TriggerEvent> prepareTriggerEvents() {
List<TriggerEvent> triggers = new ArrayList<>();
triggers.add(prepareTriggerEvent());
triggers.add(new TriggerEvent("subjectTwo", "subject.two", DESCRIPTION, null, null));
return triggers;
}
Aggregations