Search in sources :

Example 1 with JavaGenerationManager

use of org.talend.designer.mapper.language.generation.JavaGenerationManager in project tdi-studio-se by Talend.

the class OutputTable method initFromExternalData.

public void initFromExternalData(ExternalMapperTable externalMapperTable) {
    super.initFromExternalData(externalMapperTable);
    if (externalMapperTable != null) {
        this.reject = externalMapperTable.isReject();
        this.rejectInnerJoin = externalMapperTable.isRejectInnerJoin();
        this.isJoinTableOf = externalMapperTable.getIsJoinTableOf();
        this.isErrorRejectTable = externalMapperTable.isErrorRejectTable();
        List<ExternalMapperTableEntry> externalConstraintTableEntries = externalMapperTable.getConstraintTableEntries();
        if (externalConstraintTableEntries != null) {
            if (!mapperManager.isAdvancedMap()) {
                for (ExternalMapperTableEntry entry : externalConstraintTableEntries) {
                    FilterTableEntry filterTableEntry = new FilterTableEntry(this, entry.getName(), entry.getExpression());
                    // mapperManager.getProblemsManager().checkProblemsForTableEntry(filterTableEntry, false);
                    addFilterEntry(filterTableEntry);
                }
            } else {
                ILanguage currentLanguage = LanguageProvider.getCurrentLanguage();
                JavaGenerationManager javaGenerationManager = new JavaGenerationManager(currentLanguage);
                DataMapExpressionParser expressionParser = new DataMapExpressionParser(currentLanguage);
                String expressionFilter = javaGenerationManager.buildConditions(externalConstraintTableEntries, expressionParser);
                if (!expressionFilter.trim().equals("")) {
                    //$NON-NLS-1$
                    this.getExpressionFilter().setExpression(expressionFilter);
                    this.setActivateExpressionFilter(true);
                }
            }
        }
    }
}
Also used : ILanguage(org.talend.designer.mapper.language.ILanguage) JavaGenerationManager(org.talend.designer.mapper.language.generation.JavaGenerationManager) ExternalMapperTableEntry(org.talend.designer.mapper.external.data.ExternalMapperTableEntry) DataMapExpressionParser(org.talend.designer.mapper.utils.DataMapExpressionParser) FilterTableEntry(org.talend.designer.mapper.model.tableentry.FilterTableEntry)

Aggregations

ExternalMapperTableEntry (org.talend.designer.mapper.external.data.ExternalMapperTableEntry)1 ILanguage (org.talend.designer.mapper.language.ILanguage)1 JavaGenerationManager (org.talend.designer.mapper.language.generation.JavaGenerationManager)1 FilterTableEntry (org.talend.designer.mapper.model.tableentry.FilterTableEntry)1 DataMapExpressionParser (org.talend.designer.mapper.utils.DataMapExpressionParser)1