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.Callback;
|
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 LaunchWorkflowMessage doProcess(final LaunchWorkflowMessage message, final Callback<LaunchWorkflowMessage> updateOnGoing) throws Exception {
|
19
|
final Map<String, String> params = Maps.newHashMap();
|
20
|
params.putAll(message.getParams());
|
21
|
params.put(WorkflowConstants.SYSTEM_WF_PROFILE_ID, message.getId());
|
22
|
params.put(WorkflowConstants.SYSTEM_WF_PROFILE_NAME, message.getName());
|
23
|
params.put(WorkflowConstants.SYSTEM_WF_PROFILE_FAMILY, message.getType());
|
24
|
|
25
|
final String procId = launcher.enqueueWf(message.getId(), message.getWorkflowXml(), message.getPriority(), params);
|
26
|
message.setProcId(procId);
|
27
|
|
28
|
return message;
|
29
|
}
|
30
|
|
31
|
public WorkflowLauncher getLauncher() {
|
32
|
return launcher;
|
33
|
}
|
34
|
|
35
|
@Required
|
36
|
public void setLauncher(final WorkflowLauncher launcher) {
|
37
|
this.launcher = launcher;
|
38
|
}
|
39
|
|
40
|
}
|