1
|
package eu.dnetlib.msro.worker;
|
2
|
|
3
|
import java.util.Map;
|
4
|
|
5
|
import org.springframework.beans.factory.annotation.Required;
|
6
|
|
7
|
import com.google.common.collect.Maps;
|
8
|
|
9
|
import eu.dnetlib.common.ifaces.BlackboardExecutionCallback;
|
10
|
import eu.dnetlib.common.services.BlackboardAction;
|
11
|
import eu.dnetlib.rmi.blackboard.LaunchWorkflowMessage;
|
12
|
|
13
|
public class LaunchWorkflowAction extends BlackboardAction<LaunchWorkflowMessage> {
|
14
|
|
15
|
private WorkflowLauncher launcher;
|
16
|
|
17
|
@Override
|
18
|
protected void doExecute(final LaunchWorkflowMessage message, final BlackboardExecutionCallback<LaunchWorkflowMessage> callback)
|
19
|
throws Exception {
|
20
|
final Map<String, String> params = Maps.newHashMap();
|
21
|
params.putAll(message.getWfParams());
|
22
|
params.put(WorkflowConstants.SYSTEM_METAWF_ID, message.getMetaWfId());
|
23
|
params.put(WorkflowConstants.SYSTEM_WF_PROFILE_NAME, message.getWfName());
|
24
|
params.put(WorkflowConstants.SYSTEM_WF_PROFILE_FAMILY, message.getWfType());
|
25
|
|
26
|
launcher.enqueueWf(message, params, callback);
|
27
|
}
|
28
|
|
29
|
public WorkflowLauncher getLauncher() {
|
30
|
return launcher;
|
31
|
}
|
32
|
|
33
|
@Required
|
34
|
public void setLauncher(final WorkflowLauncher launcher) {
|
35
|
this.launcher = launcher;
|
36
|
}
|
37
|
|
38
|
}
|