use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.
the class HL7OutputManager method addElement.
protected HL7TreeNode addElement(HL7TreeNode current, String currentPath, String newPath, String defaultValue, Map<String, HL7TreeNode> mapNodes) {
HL7TreeNode temp = mapNodes.get(newPath);
if (temp == null) {
// if node is not existing, create it.
//$NON-NLS-1$
String name = newPath.substring(newPath.lastIndexOf("/") + 1);
temp = new Element(name, defaultValue);
if (current == null) {
// root node
mapNodes.put(newPath, temp);
return temp;
}
mapNodes.put(newPath, temp);
//$NON-NLS-1$
String parentPath = newPath.substring(0, newPath.lastIndexOf("/"));
HL7TreeNode parentNode = mapNodes.get(parentPath);
if (parentNode != null) {
parentNode.addChild(temp);
} else {
ExceptionHandler.log("Error when parsing the HL7 data, parent not existing for:" + parentPath);
}
}
return temp;
}
use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.
the class HL7OutputManager method getRootTable.
public List<Map<String, String>> getRootTable() {
List<Map<String, String>> result = new ArrayList<Map<String, String>>();
for (HL7TreeNode rootNode : this.getOriginalNodes()) {
// if (!(rootNode instanceof HL7Root)) {
initNodeOrder(rootNode);
order = 1;
// }
//$NON-NLS-1$
tableLoader((Element) rootNode, "", result, rootNode.getDefaultValue());
}
return result;
}
use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.
the class HL7OutputManager method initNodeOrder.
public void initNodeOrder(HL7TreeNode node) {
if (node == null) {
return;
}
HL7TreeNode parent = node.getParent();
if (parent == null) {
node.setOrder(1);
String path = getPath(node);
orderMap.put(path, order);
order++;
}
List<HL7TreeNode> childNode = node.getChildren();
for (HL7TreeNode child : childNode) {
child.setOrder(order);
String path = getPath(child);
orderMap.put(path, order);
order++;
if (child.getChildren().size() > 0) {
initNodeOrder(child);
}
}
}
use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.
the class HL7OutputManager method getLoopTable.
public List<Map<String, String>> getLoopTable() {
List<Map<String, String>> result = new ArrayList<Map<String, String>>();
for (HL7TreeNode rootNode : this.getOriginalNodes()) {
Element loopNode = (Element) getLoopNode(rootNode);
if (loopNode != null) {
String path = getPath(loopNode);
//$NON-NLS-1$
tableLoader(loopNode, path.substring(0, path.lastIndexOf("/")), result, loopNode.getDefaultValue());
}
}
return result;
}
use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.
the class UIManager method autoMap.
/**
*
* DOC xzhang Comment method "autoMap".
*/
public void autoMap(String currentSchema) {
if (this.hl7Manager instanceof HL7OutputManager) {
List<HL7TreeNode> roots = this.hl7Manager.getTreeData("");
List<HL7TreeNode> mappableNodes = new ArrayList<HL7TreeNode>();
for (HL7TreeNode root : roots) {
getMappableNode((Element) root, mappableNodes);
}
List<IMetadataColumn> schemaData = this.hl7Manager.getSchemaData(currentSchema);
for (HL7TreeNode node : mappableNodes) {
for (IMetadataColumn column : schemaData) {
if (node.getLabel().equals(column.getLabel())) {
node.setDefaultValue(null);
node.setColumn(column);
break;
}
// String[] splits = node.getColumnLabel().split(":");
// for (String s : splits) {
// if (s.equals(column.getLabel())) {
// node.setDefaultValue(null);
// node.setColumn(column);
// break;
// }
// }
}
}
// this.hl7UI.refreshXMLViewer(root);
this.hl7UI.redrawLinkers();
return;
}
this.hl7UI.autoMap();
}
Aggregations