1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package com.c2kernel.lifecycle.instance.predefined;
//Java
import com.c2kernel.common.InvalidDataException;
import com.c2kernel.graph.model.GraphPoint;
import com.c2kernel.lifecycle.instance.CompositeActivity;
import com.c2kernel.lifecycle.instance.Workflow;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;
public class ReplaceDomainWorkflow extends PredefinedStep
{
public ReplaceDomainWorkflow()
{
super();
}
@Override
protected String runActivityLogic(AgentPath agent, int itemSysKey,
int transitionID, String requestData) throws InvalidDataException {
Workflow lifeCycle = getWf();
Logger.msg(1, "ReplaceDomainWorkflow::request() - Starting ");
try
{
Logger.msg(8, "ReplaceDomainWorkflow::request() - data:" + getDataList(requestData)[0]);
lifeCycle.getChildGraphModel().removeVertex(lifeCycle.search("workflow/domain"));
CompositeActivity domain = (CompositeActivity) Gateway.getMarshaller().unmarshall(getDataList(requestData)[0]);
domain.setName("domain");
lifeCycle.initChild(domain, true, new GraphPoint(150, 100));
// if new workflow, activate it, otherwise refresh the jobs
if (!domain.active) lifeCycle.run(agent, itemSysKey);
else lifeCycle.refreshJobs(itemSysKey);
// store new wf
Gateway.getStorage().put(itemSysKey, lifeCycle, null);
Logger.msg(1, "ReplaceDomainWorkflow::request() - DONE.");
return requestData;
}
catch (Exception ex)
{
Logger.error("ReplaceDomainWorkflow::request() - during unmarshall.");
Logger.error(ex);
throw new InvalidDataException("ReplaceDomainWorkflow::request() - during unmarshall.", null);
}
}
}
|