private void visitChildren(INode node) { List<INode> listOfChildren = node.getChildren(); if (listOfChildren != null) { for (INode child : listOfChildren) { child.accept(this); } } }
public static String generateCasting( VariablePathExpression attributePath, String columnName, MappingTask mappingTask) { INode attributeNode = new FindNode() .findNodeInSchema(attributePath.getAbsolutePath(), mappingTask.getTargetProxy()); String value = attributeNode.getChild(0).getLabel(); String castedColumnName = mappingTask.getDBMSHandler().forceCast(columnName, value); return castedColumnName; }
private void generateCorrespondences( List<INode> sourceAttributes, List<INode> targetAttributes, MappingTask mappingTask) { for (INode sourceAttribute : sourceAttributes) { for (INode targetAttribute : targetAttributes) { if (sourceAttribute.getLabel().equals(targetAttribute.getLabel())) { PathExpression sourcePath = new GeneratePathExpression().generatePathFromRoot(sourceAttribute); PathExpression targetPath = new GeneratePathExpression().generatePathFromRoot(targetAttribute); ValueCorrespondence correspondence = new ValueCorrespondence(sourcePath, targetPath); mappingTask.addCorrespondence(correspondence); break; } } } }
public void findCorrespondences(String inputFile, String outputFile) throws DAOException { DAOMappingTask daoMappingTask = new DAOMappingTask(); MappingTask mappingTask = daoMappingTask.loadMappingTask(5, inputFile, false); INode source = mappingTask.getSourceProxy().getSchema(); INode target = mappingTask.getTargetProxy().getSchema(); NodeExtractorVisitor visitorSource = new NodeExtractorVisitor(); source.accept(visitorSource); List<INode> sourceAttributes = visitorSource.getResult(); NodeExtractorVisitor visitorTarget = new NodeExtractorVisitor(); target.accept(visitorTarget); List<INode> targetAttributes = visitorTarget.getResult(); generateCorrespondences(sourceAttributes, targetAttributes, mappingTask); daoMappingTask.saveMappingTask(mappingTask, outputFile); }