Project

General

Profile

« Previous | Next » 

Revision 37518

wf dependencies

View differences:

modules/dnet-manager-service/trunk/src/main/java/eu/dnetlib/msro/dispatcher/WorkflowDispatcher.java
37 37

  
38 38
	private static final Log log = LogFactory.getLog(WorkflowDispatcher.class);
39 39

  
40
	public String dispatchMetaWorkFlow(final String metaWfId) throws ManagerServiceException {
40
	public void dispatchMetaWorkFlow(final String metaWfId) throws ManagerServiceException {
41 41
		try {
42 42
			final MetaWorkflow metaWf = isClient.getResourceByCode(metaWfId, MetaWorkflow.class);
43 43
			final WorkflowInstance wfi = metaWf.getRootWorkflowInstance();
44
			return dispatchWorkFlow(metaWf, wfi.getWfName(), DEFAULT_PRIORITY);
44
			dispatchWorkFlow(metaWf, wfi.getWfName(), DEFAULT_PRIORITY);
45 45
		} catch (Throwable e) {
46 46
			log.error("Error dispatching wf", e);
47 47
			throw new ManagerServiceException("Error dispatching wf", e);
48 48
		}
49 49
	}
50 50

  
51
	public String dispatchWorkFlow(final String metaWfId, final String wfName) throws ManagerServiceException {
51
	public void dispatchWorkFlow(final String metaWfId, final String wfName) throws ManagerServiceException {
52 52
		try {
53 53
			final MetaWorkflow metaWf = isClient.getResourceByCode(metaWfId, MetaWorkflow.class);
54
			return dispatchWorkFlow(metaWf, wfName, DEFAULT_PRIORITY);
54
			dispatchWorkFlow(metaWf, wfName, DEFAULT_PRIORITY);
55 55
		} catch (Throwable e) {
56 56
			log.error("Error dispatching wf", e);
57 57
			throw new ManagerServiceException("Error dispatching wf", e);
58 58
		}
59 59
	}
60 60

  
61
	public String dispatchWorkFlow(final MetaWorkflow metaWf, final String wfName,
61
	public void dispatchWorkFlow(final MetaWorkflow metaWf, final String wfName,
62 62
			final int priority) throws ManagerServiceException {
63
		final WorkflowInstance wfi = metaWf.findWorkflowInstanceByName(wfName);
64
		dispatchWorkFlow(metaWf, wfi, priority);
65
	}
66

  
67
	private void dispatchWorkFlow(final MetaWorkflow metaWf, final WorkflowInstance wfi, final int priority) throws ManagerServiceException {
63 68
		try {
64
			final WorkflowInstance wfi = metaWf.findWorkflowInstanceByName(wfName);
69
			final String wfName = wfi.getWfName();
65 70

  
66 71
			final String xml = isClient.getXmlResourceByCode(wfi.getWfCode(), Workflow.class);
67 72

  
......
93 98
							info.setLastActivityDate(now);
94 99
							updateMetaWf(metaWf.getCode(), wfName, LastExecutionStatus.SUCCESS, now);
95 100
							System.out.println("***** SUCCESS: " + m.getProcId() + " - " + m.getCurrentNode());
101

  
102
							for (WorkflowInstance nextWfi : wfi.getChildren()) {
103
								try {
104
									dispatchWorkFlow(metaWf, nextWfi, priority);
105
								} catch (ManagerServiceException e) {
106
									log.error("Child Workflow not launched", e);
107
								}
108
							}
96 109
						}
97 110

  
98 111
						@Override
......
116 129
					});
117 130
			info.setWorkerId(workerId);
118 131

  
119
			return info.getProcId();
132
			// return info.getProcId();
120 133
		} catch (Throwable e) {
121 134
			log.error("Error dispatching wf", e);
122 135
			throw new ManagerServiceException("Error dispatching wf", e);
modules/dnet-modular-workflows-ui/branches/newManagerService/src/main/java/eu/dnetlib/functionality/modular/ui/workflows/controllers/WorkflowsController.java
190 190

  
191 191
	@RequestMapping("/ui/wf.start")
192 192
	public @ResponseBody
193
	String startWorkflow(@RequestParam(value = "metaWf", required = true) final String metaWfId,
193
	boolean startWorkflow(@RequestParam(value = "metaWf", required = true) final String metaWfId,
194 194
			@RequestParam(value = "wf", required = true) final String wfName) throws Exception {
195
		return dispatcher.dispatchWorkFlow(metaWfId, wfName);
195
		dispatcher.dispatchWorkFlow(metaWfId, wfName);
196
		return true;
196 197
	}
197 198

  
198 199
	@RequestMapping("/ui/metawf.start")
199 200
	public @ResponseBody
200
	String startMetaWorkflow(@RequestParam(value = "metaWf", required = true) final String metaWfId) throws Exception {
201
		return dispatcher.dispatchMetaWorkFlow(metaWfId);
201
	boolean startMetaWorkflow(@RequestParam(value = "metaWf", required = true) final String metaWfId) throws Exception {
202
		dispatcher.dispatchMetaWorkFlow(metaWfId);
203
		return true;
202 204
	}
203 205

  
204 206
	@RequestMapping("/ui/wf_workflow_node.json")

Also available in: Unified diff