use of org.talend.designer.mapper.external.data.ExternalMapperTableEntry in project tdi-studio-se by Talend.
the class MapperComponentDocumentation method generateMapperTablesInfo.
/**
* This method used for generating all mapper tables information into xml file.
*
* @param externalNodeElement
* @param tables
* @param mapperTableType
*/
private void generateMapperTablesInfo(Element externalNodeElement, List<ExternalMapperTable> tables, String mapperTableType) {
//$NON-NLS-1$
Element mapperTableElement = externalNodeElement.addElement("mapperTable");
//$NON-NLS-1$
mapperTableElement.addAttribute("type", HTMLDocUtils.checkString(mapperTableType));
Element tableElement = null;
for (ExternalMapperTable table : tables) {
//$NON-NLS-1$
tableElement = mapperTableElement.addElement("table");
generateTableSummaryInfo(mapperTableElement, tableElement, table);
List<ExternalMapperTableEntry> globalMapKeysValuesEntries = table.getGlobalMapKeysValues();
if (HTMLDocUtils.checkList(globalMapKeysValuesEntries)) {
//$NON-NLS-1$
Element globalMapKeysValuesElement = tableElement.addElement("globalMapKeysValues");
for (ExternalMapperTableEntry entry : globalMapKeysValuesEntries) {
generateTablesEntriesInfo(globalMapKeysValuesElement, entry);
}
}
List<ExternalMapperTableEntry> metadataTableEntries = table.getMetadataTableEntries();
if (HTMLDocUtils.checkList(metadataTableEntries)) {
//$NON-NLS-1$
Element metadataTableEntriesElement = tableElement.addElement("metadataTableEntries");
for (ExternalMapperTableEntry entry : metadataTableEntries) {
generateTablesEntriesInfo(metadataTableEntriesElement, entry);
}
}
List<ExternalMapperTableEntry> constraintTableEntries = table.getConstraintTableEntries();
if (HTMLDocUtils.checkList(constraintTableEntries)) {
//$NON-NLS-1$
Element constraintTableEntriesElement = tableElement.addElement("constraintTableEntries");
for (ExternalMapperTableEntry entry : constraintTableEntries) {
generateTablesEntriesInfo(constraintTableEntriesElement, entry);
}
}
}
}
use of org.talend.designer.mapper.external.data.ExternalMapperTableEntry in project tdi-studio-se by Talend.
the class ProblemsAnalyserTest method prepareExternalData.
private ExternalMapperTable prepareExternalData(IMetadataTable table) {
ExternalMapperTable externalMapperTable = new ExternalMapperTable();
ArrayList<ExternalMapperTableEntry> perTableEntries = new ArrayList<ExternalMapperTableEntry>();
for (IMetadataColumn column : table.getListColumns()) {
ExternalMapperTableEntry externalMapperTableEntry = new ExternalMapperTableEntry();
externalMapperTableEntry.setName(column.getLabel());
externalMapperTableEntry.setType(column.getTalendType());
externalMapperTableEntry.setNullable(column.isNullable());
perTableEntries.add(externalMapperTableEntry);
}
externalMapperTable.setMetadataTableEntries(perTableEntries);
return externalMapperTable;
}
use of org.talend.designer.mapper.external.data.ExternalMapperTableEntry in project tdi-studio-se by Talend.
the class ProblemsAnalyser method checkExpressionSyntaxProblems.
/**
* DOC amaumont Comment method "checkExpressionSyntaxProblems".
*
* @param tables
* @param codeChecker
*/
private void checkExpressionSyntaxProblems(List<ExternalMapperTable> tables, ICodeProblemsChecker codeChecker) {
ILanguage currentLanguage = LanguageProvider.getCurrentLanguage();
boolean keyLanguageCheckerIsUsed = currentLanguage.getCodeLanguage() == ECodeLanguage.JAVA;
for (ExternalMapperTable table : tables) {
List<ExternalMapperTableEntry> metadataTableEntries = table.getMetadataTableEntries();
// loop on all entries of current table
if (metadataTableEntries != null) {
checkExpressionSyntaxProblems(codeChecker, currentLanguage, keyLanguageCheckerIsUsed, table, metadataTableEntries, JavaGenerationManager.PROBLEM_KEY_FIELD.METADATA_COLUMN);
}
List<ExternalMapperTableEntry> globalMapKeysValues = table.getGlobalMapKeysValues();
// loop on all entries of current table
if (globalMapKeysValues != null) {
checkExpressionSyntaxProblems(codeChecker, currentLanguage, keyLanguageCheckerIsUsed, table, globalMapKeysValues, JavaGenerationManager.PROBLEM_KEY_FIELD.GLOBAL_MAP);
}
if (table.getConstraintTableEntries() != null || table.isActivateExpressionFilter() && table.getExpressionFilter() != null && !table.getExpressionFilter().trim().equals("")) {
//$NON-NLS-1$
//$NON-NLS-1$ //$NON-NLS-2$
String prefix = "Filter invalid in table " + table.getName() + " : ";
if (table.getConstraintTableEntries() != null) {
for (ExternalMapperTableEntry entry : table.getConstraintTableEntries()) {
checkFilterEntry(codeChecker, keyLanguageCheckerIsUsed, table, prefix, entry.getExpression());
}
}
if (table.isActivateExpressionFilter() && table.getExpressionFilter() != null && !table.getExpressionFilter().trim().equals("")) {
//$NON-NLS-1$
checkFilterEntry(codeChecker, keyLanguageCheckerIsUsed, table, prefix, table.getExpressionFilter());
}
}
}
// for (ExternalMapperTable table : tables) {
}
use of org.talend.designer.mapper.external.data.ExternalMapperTableEntry in project tdi-studio-se by Talend.
the class MapperHelper method isGeneratedAsVirtualComponent.
/**
*
* DOC YeXiaowei Comment method "isGeneratedAsVirtualComponent".
*
* @param mapperNode
* @return
*/
public static boolean isGeneratedAsVirtualComponent(final INode mapperNode) {
if (isMapperOnBigDataProcess(mapperNode.getComponent().getPaletteType())) {
return false;
}
boolean hasPersistentSortedLookup = false;
List<IConnection> incomingConnections = (List<IConnection>) mapperNode.getIncomingConnections();
ExternalMapperData internalExternalData = (ExternalMapperData) mapperNode.getExternalNode().getExternalData();
if (internalExternalData != null && incomingConnections.size() > 0) {
List<ExternalMapperTable> inputTables = internalExternalData.getInputTables();
int sizeInputTables = inputTables.size();
HashMap<String, IConnection> hNameToConnection = new HashMap<String, IConnection>();
for (IConnection connection : incomingConnections) {
hNameToConnection.put(connection.getName(), connection);
}
for (int iInputTable = 1; iInputTable < sizeInputTables; iInputTable++) {
// T_TM_M_241
ExternalMapperTable inputTable = inputTables.get(iInputTable);
String tableName = inputTable.getName();
IConnection connection = hNameToConnection.get(tableName);
if (connection == null) {
continue;
}
if (inputTable != null) {
// T_TM_M_245
List<ExternalMapperTableEntry> metadataTableEntries = inputTable.getMetadataTableEntries();
if (metadataTableEntries == null) {
continue;
}
if (inputTable.isPersistent() && !"ALL_ROWS".equals(inputTable.getMatchingMode()) && !"DYNAMIC".equals(inputTable.getLookupMode())) {
//$NON-NLS-1$ //$NON-NLS-2$
hasPersistentSortedLookup = true;
}
}
// T_TM_M_245
}
// T_TM_M_241
}
return hasPersistentSortedLookup;
}
use of org.talend.designer.mapper.external.data.ExternalMapperTableEntry in project tdi-studio-se by Talend.
the class AbstractInOutTable method updateTableEntries.
private void updateTableEntries(List<IMetadataColumn> columns, Map<String, ExternalMapperTableEntry> nameToPerTabEntry) {
for (IMetadataColumn column : columns) {
AbstractInOutTableEntry columnEntry = getNewTableEntry(column);
ExternalMapperTableEntry externalMapperTableEntry = nameToPerTabEntry.get(columnEntry.getMetadataColumn().getLabel());
if (externalMapperTableEntry != null) {
columnEntry.setExpression(externalMapperTableEntry.getExpression());
if (columnEntry instanceof InputColumnTableEntry) {
InputColumnTableEntry entry = (InputColumnTableEntry) columnEntry;
entry.setOperator(externalMapperTableEntry.getOperator());
}
// mapperManager.getProblemsManager().checkProblemsForTableEntry(columnEntry, false);
}
dataMapTableEntries.add(columnEntry);
}
}
Aggregations