use of org.talend.designer.hl7.ui.header.HL7Parse in project tdi-studio-se by Talend.
the class ImportHL7StructureAction method treeNodeAdapt.
private List treeNodeAdapt() {
List<HL7TreeNode> treeData = new ArrayList<HL7TreeNode>();
FileDialog f = null;
if (hl7ui != null) {
f = new FileDialog(hl7ui.getHl7UIParent().getShell());
} else if (form != null) {
f = new FileDialog(form.getShell());
}
String file = f.open();
if (file == null) {
return treeData;
}
HL7Parse hl7Parse = new HL7Parse();
List<String> msgContentList = new ArrayList<String>();
List<Message> messageList = hl7Parse.doParse(file, "'\\u000b'", "'\\u001c'");
List<HL7TreeNode> nodeList = hl7Util.getHL7TreeNodes(messageList);
if (!nodeList.isEmpty()) {
HL7TreeNode hl7TreeNode = nodeList.get(0);
List<HL7FileNode> table = new ArrayList<HL7FileNode>();
if (hl7Connection != null) {
EList root = hl7Connection.getRoot();
root.clear();
if (hl7TreeNode != null) {
hl7Util.initNodeOrder(hl7TreeNode, orderMap);
hl7Util.tableLoader((Element) hl7TreeNode, "", root, hl7TreeNode.getDefaultValue(), orderMap);
}
table.addAll(root);
} else {
if (hl7TreeNode != null) {
hl7Util.initNodeOrder(hl7TreeNode, orderMap);
hl7Util.tableLoader((Element) hl7TreeNode, "", table, hl7TreeNode.getDefaultValue(), orderMap);
}
}
List<String> schemaList = new ArrayList<String>();
for (HL7FileNode node : table) {
String columnName = node.getRelatedColumn();
if (columnName.contains(":")) {
columnName = columnName.substring(0, columnName.indexOf(":"));
}
if (!schemaList.contains(columnName) && !"".equals(columnName)) {
schemaList.add(columnName);
}
}
initXmlTreeData(schemaList, table, treeData);
}
return treeData;
}
use of org.talend.designer.hl7.ui.header.HL7Parse in project tdi-studio-se by Talend.
the class HL7UI method initMessageTree.
public void initMessageTree() {
HL7Parse hl7Parse = new HL7Parse();
List<Message> messageList = new ArrayList<Message>();
if (initMsgContentList != null && initMsgContentList.size() > 0) {
messageList = hl7Parse.doParse(initMsgContentList);
if (messageList != null && messageList.size() > 0) {
messageViewer.setInput(messageList.toArray());
} else {
messageViewer.setInput(null);
}
} else {
filePath = externalNode.getElementParameter(EParameterName.FILENAME.getName()).getValue().toString();
String filePathNoQuotes = TalendTextUtils.removeQuotes(filePath);
File file = Path.fromOSString(filePathNoQuotes).toFile();
if (file.exists()) {
messageList = hl7Parse.doParse(filePath, startChar, endChar);
if (messageList != null && messageList.size() > 0) {
messageViewer.setInput(messageList.toArray());
} else {
messageViewer.setInput(null);
}
}
}
}
Aggregations