1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.rundeck.api.parser;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.dom4j.Node;
20 import org.rundeck.api.domain.RundeckAbort;
21 import org.rundeck.api.domain.RundeckExecution;
22 import org.rundeck.api.domain.RundeckAbort.AbortStatus;
23
24
25
26
27
28
29 public class AbortParser extends BaseXpathParser<RundeckAbort> {
30
31 public AbortParser(final String xpath) {
32 super(xpath);
33 }
34
35 @Override
36 public RundeckAbort parse(Node abortNode) {
37 RundeckAbort abort = new RundeckAbort();
38
39 try {
40 abort.setStatus(AbortStatus.valueOf(StringUtils.upperCase(abortNode.valueOf("@status"))));
41 } catch (IllegalArgumentException e) {
42 abort.setStatus(null);
43 }
44
45 Node execNode = abortNode.selectSingleNode("execution");
46 if (execNode != null) {
47 RundeckExecution execution = new ExecutionParser().parseXmlNode(execNode);
48 abort.setExecution(execution);
49 }
50
51 return abort;
52 }
53
54 }