1 package org.rundeck.api.parser;
2
3 import org.apache.commons.lang.StringUtils;
4 import org.dom4j.Node;
5 import org.rundeck.api.domain.ArchiveImport;
6
7 import java.util.ArrayList;
8
9
10
11
12
13
14
15 public class ArchiveImportParser extends BaseXpathParser<ArchiveImport> {
16
17
18 @Override
19 public ArchiveImport parse(final Node importNode) {
20
21 boolean issuccess = "successful".equals(importNode.valueOf("/import/@status"));
22 final ArrayList<String> messages = new ArrayList<String>();
23 for (final Object o : importNode.selectNodes("/import/errors/error")) {
24 messages.add(((Node) o).getText());
25 }
26
27 return new ArchiveImport(issuccess, messages);
28 }
29 }