use of org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData in project tdi-studio-se by Talend.
the class XMLMapperHelper method hasDocumentInMainInput.
private static boolean hasDocumentInMainInput(final INode xmlMapperNode) {
boolean hasDocumentInMainInput = false;
List<? extends IConnection> inConnections = (List<? extends IConnection>) xmlMapperNode.getIncomingConnections();
XmlMapData xmlMapData = (XmlMapData) ElementParameterParser.getObjectValueXMLTree(xmlMapperNode);
if (xmlMapData != null && inConnections != null && inConnections.size() > 0) {
List<InputXmlTree> inputTables = xmlMapData.getInputTrees();
HashMap<String, IConnection> hNameToConnection = new HashMap<String, IConnection>();
for (IConnection connection : inConnections) {
hNameToConnection.put(connection.getName(), connection);
}
for (InputXmlTree inputTable : inputTables) {
String tableName = inputTable.getName();
IConnection connection = hNameToConnection.get(tableName);
if (connection == null) {
continue;
}
if (!(inputTable.isLookup())) {
for (TreeNode node : inputTable.getNodes()) {
if ("id_Document".equals(node.getType())) {
hasDocumentInMainInput = true;
break;
}
}
}
}
}
return hasDocumentInMainInput;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData in project tdi-studio-se by Talend.
the class ProblemsAnalyser method checkProblems.
public List<Problem> checkProblems() {
treeAndProblems.clear();
final XmlMapData copyOfMapData = mapperManager.getExternalData();
if (copyOfMapData != null) {
// check problems for InputLoopTable in output
InputXmlTree mainInputTree = mapperManager.getMainInputTree();
for (OutputXmlTree outputTree : copyOfMapData.getOutputTrees()) {
checkInputLoopTablesProblem(outputTree, mainInputTree);
}
for (InputXmlTree inputTree : copyOfMapData.getInputTrees()) {
isMultipleDocType = false;
checkTreeNodesProblem(inputTree, inputTree.getNodes());
}
for (OutputXmlTree outputTree : copyOfMapData.getOutputTrees()) {
isMultipleDocType = false;
checkTreeNodesProblem(outputTree, outputTree.getNodes());
}
}
return getProblems();
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData in project tdi-studio-se by Talend.
the class ExpressionProposalProvider method init.
public void init(Object source) {
XmlMapData mapData = mapperManager.getExternalData();
int index = 0;
boolean needVar = false;
if (source instanceof OutputTreeNode || source instanceof OutputXmlTree) {
needVar = true;
index = mapData.getInputTrees().size();
} else if (source instanceof TreeNode) {
AbstractInOutTree abstractTree = XmlMapUtil.getAbstractInOutTree((TreeNode) source);
index = mapData.getInputTrees().indexOf(abstractTree);
if (index == -1) {
index = 0;
}
} else if (source instanceof VarNode) {
index = mapData.getInputTrees().size();
} else if (source instanceof InputXmlTree) {
index = mapData.getInputTrees().indexOf(source) + 1;
}
for (int i = 0; i < index; i++) {
InputXmlTree inputTree = mapData.getInputTrees().get(i);
getProposalsInside(inputTree.getNodes(), proposalsInside);
}
if (needVar) {
getProposalsInside(mapData.getVarTables().get(0).getNodes(), proposalsInside);
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData in project tdi-studio-se by Talend.
the class TXMLMapChangeAllInOneValueMigrationTask method execute.
/*
* (non-Javadoc)
*
* @see
* org.talend.core.model.migration.TXMLMapChangeAllInOneValueMigrationTask
* (org .talend.core.model.properties.Item)
*/
@Override
public ExecutionResult execute(Item item) {
IProxyRepositoryFactory factory = CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
ProcessType processType = getProcessType(item);
boolean modified = false;
if (processType != null) {
for (Object obj : processType.getNode()) {
NodeType nodeType = (NodeType) obj;
if (nodeType.getComponentName().startsWith("tXMLMap")) {
XmlMapData xmlMapdata = (XmlMapData) nodeType.getNodeData();
EList<OutputXmlTree> outputTables = xmlMapdata.getOutputTrees();
EList<InputXmlTree> inputTables = xmlMapdata.getInputTrees();
boolean hasDocumentInTheMainInputTable = false;
for (InputXmlTree inputTable : inputTables) {
if (!(inputTable.isLookup())) {
for (TreeNode inputEntry : inputTable.getNodes()) {
if ("id_Document".equals(inputEntry.getType())) {
hasDocumentInTheMainInputTable = true;
}
}
}
}
if (hasDocumentInTheMainInputTable) {
for (OutputXmlTree outputTable : outputTables) {
for (TreeNode outputEntry : outputTable.getNodes()) {
if ("id_Document".equals(outputEntry.getType())) {
if (!outputTable.isAllInOne()) {
outputTable.setAllInOne(true);
modified = true;
break;
}
}
}
}
}
}
}
}
try {
if (modified) {
factory.save(item, true);
return ExecutionResult.SUCCESS_WITH_ALERT;
} else {
return ExecutionResult.SUCCESS_NO_ALERT;
}
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData in project tdi-studio-se by Talend.
the class XmlMapComponent method isRunRefSubProcessAtStart.
@Override
public boolean isRunRefSubProcessAtStart(String connectionName) {
XmlMapData externalEmfData = (XmlMapData) getExternalEmfData();
List<InputXmlTree> inputTrees = new ArrayList<InputXmlTree>(externalEmfData.getInputTrees());
for (InputXmlTree table : inputTrees) {
if (table.getName().equals(connectionName)) {
String lookupMode = table.getLookupMode();
if (XML_MAP_LOOKUP_MODE.RELOAD.name().equals(lookupMode) || XML_MAP_LOOKUP_MODE.CACHE_OR_RELOAD.name().equals(lookupMode)) {
return false;
}
}
}
return true;
}
Aggregations