本文整理了Java中io.takari.orchestra.plugins.yaml.YamlParser
类的一些代码示例,展示了YamlParser
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlParser
类的具体详情如下:
包路径:io.takari.orchestra.plugins.yaml.YamlParser
类名称:YamlParser
暂无
代码示例来源:origin: io.takari.orchestra.plugins/yaml
private static List<AbstractElement> toElements(IdGenerator idGenerator, Collection<Object> elements) throws ParserException {
List<Container> result = new ArrayList<>();
for (Object e : elements) {
if (!(e instanceof Map)) {
throw new ParserException("Unsupported element type: " + e);
}
Map<String, Object> m = (Map<String, Object>) e;
result.add(toElements(idGenerator, m));
}
return link(idGenerator, result);
}
代码示例来源:origin: io.takari.orchestra/agent
@Override
public Collection<ProcessDefinition> parse(InputStream in) throws ParserException {
return delegate.parse(in);
}
代码示例来源:origin: io.takari.orchestra/agent
@Override
public String toString() {
return delegate.toString();
}
};
代码示例来源:origin: io.takari.orchestra.plugins/yaml
private static Container toSubProcess(IdGenerator idGenerator, Map<String, Object> m) throws ParserException {
Object steps = m.get(STEPS_KEY);
if (steps == null) {
throw new ParserException("Mandatory 'steps' section missing in the subprocess: " + m);
}
if (!(steps instanceof List)) {
throw new ParserException("Unsupported element in the steps section of the subprocess: " + m);
}
List<Object> l = (List<Object>) steps;
if (l.isEmpty()) {
throw new ParserException("Empty 'steps' section in the subprocess: " + m);
}
List<AbstractElement> children = addEntryPoint(idGenerator, toElements(idGenerator, l));
String subId = idGenerator.nextId();
SubProcess sub = new SubProcess(subId, children);
return new Container(sub, sub, toBoundaryEvents(idGenerator, subId, m));
}
代码示例来源:origin: io.takari.orchestra.plugins/yaml
private static Container toElements(IdGenerator idGenerator, Map<String, Object> m) throws ParserException {
if (m.containsKey(SUBPROCESS_KEY)) {
return toSubProcess(idGenerator, m);
}
if (m.containsKey(EXPR_KEY)) {
ServiceTask t = new ServiceTask(idGenerator.nextId(), ExpressionType.SIMPLE, m.get("expr").toString());
return new Container(t, t);
}
if (m.containsKey(END_KEY)) {
String errorRef = (String) m.get(END_KEY);
EndEvent e = new EndEvent(idGenerator.nextId(), errorRef);
return new Container(e, e);
}
if (m.containsKey(CALL_KEY)) {
return toCallActivity(idGenerator, m);
}
if (m.containsKey(SWITCH_KEY)) {
return toSwitch(idGenerator, m);
}
throw new ParserException("Unsupported element type: " + m);
}
代码示例来源:origin: io.takari.orchestra.plugins/yaml
@Override
public Collection<ProcessDefinition> parse(InputStream in) throws ParserException {
YAMLMapper m = new YAMLMapper();
Map<String, Object> data;
try {
data = m.readValue(in, Map.class);
} catch (IOException e) {
throw new ParserException("Error while parsing the data", e);
}
log.debug("parse -> got: {}", data);
Collection<ProcessDefinition> result = new ArrayList<>();
for (Map.Entry<String, Object> entry : data.entrySet()) {
String id = entry.getKey();
Object v = entry.getValue();
if (!(v instanceof List)) {
throw new ParserException("Unsupported element type in the process '" + id + "': " + v);
}
List<Object> l = (List<Object>) v;
IdGenerator idGenerator = new IdGenerator();
ProcessDefinition pd = new ProcessDefinition(id, addEntryPoint(idGenerator, toElements(idGenerator, l)),
Collections.singletonMap(ProcessDefinition.SOURCE_TYPE_ATTRIBUTE, TYPE));
if (log.isDebugEnabled()) {
print(pd, 0);
}
result.add(pd);
}
return result;
}
代码示例来源:origin: io.takari.orchestra.plugins/yaml
private static void print(AbstractElement e, int level) {
if (e instanceof SequenceFlow) {
SequenceFlow f = (SequenceFlow) e;
System.out.println(ident(level) + e.getClass() + ": id=" + e.getId() + " // " + f.getFrom() + " -> " + f.getTo() + " // " + f.getExpression());
} else {
System.out.println(ident(level) + e.getClass() + ": id=" + e.getId());
}
if (e instanceof ProcessDefinition) {
ProcessDefinition pd = (ProcessDefinition) e;
for (AbstractElement c : pd.getChildren()) {
print(c, level + 1);
}
}
}
代码示例来源:origin: io.takari.orchestra.plugins/yaml
List<AbstractElement> es = toElements(idGenerator, (Collection<Object>) steps);
代码示例来源:origin: io.takari.orchestra.plugins/yaml
result.add(new BoundaryEvent(evId, attachedTo, ref));
Container a = toCallActivity(idGenerator, em);
内容来源于网络,如有侵权,请联系作者删除!