blob: 74570a0de6a8d796b7430928353966beca353781 (
plain)
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
50
51
|
package com.c2kernel.lifecycle.instance.predefined;
//Java
import java.util.Arrays;
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.lookup.ItemPath;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;
public class ReplaceDomainWorkflow extends PredefinedStep
{
public ReplaceDomainWorkflow()
{
super();
getProperties().put("Agent Role", "Admin");
}
@Override
protected String runActivityLogic(AgentPath agent, ItemPath item,
int transitionID, String requestData) throws InvalidDataException {
Workflow lifeCycle = getWf();
String[] params = getDataList(requestData);
if (Logger.doLog(3)) Logger.msg(3, "AddC2KObject: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params));
try
{
lifeCycle.getChildGraphModel().removeVertex(lifeCycle.search("workflow/domain"));
CompositeActivity domain = (CompositeActivity) Gateway.getMarshaller().unmarshall(params[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, item);
else lifeCycle.refreshJobs(item);
// store new wf
Gateway.getStorage().put(item, lifeCycle, null);
return requestData;
}
catch (Exception ex)
{
throw unknownException(ex);
}
}
}
|