Search in sources :

Example 1 with AbstractMapComponent

use of org.talend.designer.abstractmap.AbstractMapComponent in project tdi-studio-se by Talend.

the class UIManager method removeUnsavedOutputsFromProcess.

private void removeUnsavedOutputsFromProcess() {
    AbstractMapComponent abstractMapComponent = getAbstractMapperManager().getAbstractMapComponent();
    IProcess process = abstractMapComponent.getProcess();
    List<OutputTable> currentOutputTablesList = mapperManager.getOutputTables();
    HashSet<String> currentTables = new HashSet<String>(currentOutputTablesList.size());
    for (OutputTable outputTable : currentOutputTablesList) {
        currentTables.add(outputTable.getName());
    }
    ExternalMapperData originalExternalData = (ExternalMapperData) mapperManager.getOriginalExternalData();
    HashSet<String> originalTableNames = new HashSet<String>();
    if (originalExternalData != null) {
        List<ExternalMapperTable> originalOutputTables = originalExternalData.getOutputTables();
        for (ExternalMapperTable outputTable : originalOutputTables) {
            originalTableNames.add(outputTable.getName());
        }
    }
    for (String currentTable : currentTables) {
        if (!originalTableNames.contains(currentTable)) {
            process.removeUniqueConnectionName(currentTable);
        }
    }
}
Also used : AbstractMapComponent(org.talend.designer.abstractmap.AbstractMapComponent) ExternalMapperTable(org.talend.designer.mapper.external.data.ExternalMapperTable) ExternalMapperData(org.talend.designer.mapper.external.data.ExternalMapperData) IProcess(org.talend.core.model.process.IProcess) OutputTable(org.talend.designer.mapper.model.table.OutputTable) HashSet(java.util.HashSet)

Example 2 with AbstractMapComponent

use of org.talend.designer.abstractmap.AbstractMapComponent in project tdi-studio-se by Talend.

the class MapperSettingsManager method saveCurrentSettings.

public void saveCurrentSettings() {
    AbstractMapComponent component = manager.getAbstractMapComponent();
    IElementParameter parameter = component.getElementParameter(REPLICATED_JOIN);
    if (parameter != null) {
        parameter.setValue(currentModel.isReplicatedJoin());
    }
    parameter = component.getElementParameter(DIE_ON_ERROR);
    if (parameter != null) {
        parameter.setValue(currentModel.isDieOnError());
    }
    parameter = component.getElementParameter(TEMPORARY_DATA_DIRECTORY);
    if (parameter != null) {
        parameter.setValue(currentModel.getTempDataDir());
    }
    parameter = component.getElementParameter(ROWS_BUFFER_SIZE);
    if (parameter != null) {
        parameter.setValue(currentModel.getRowBufferSize());
    }
    parameter = component.getElementParameter(LOOKUP_IN_PARALLEL);
    if (parameter != null) {
        parameter.setValue(currentModel.isLookInParallel());
    }
    parameter = component.getElementParameter(ENABLE_AUTO_CONVERT_TYPE);
    if (parameter != null) {
        parameter.setValue(currentModel.isEnableAutoConvertType());
    }
}
Also used : AbstractMapComponent(org.talend.designer.abstractmap.AbstractMapComponent) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 3 with AbstractMapComponent

use of org.talend.designer.abstractmap.AbstractMapComponent in project tdi-studio-se by Talend.

the class MapperSettingsManager method initCurrnentModel.

private void initCurrnentModel() {
    currentModel = new MapperSettingModel();
    // Ensure that the unmodified fields are the same as the default model.
    currentModel.setReplicatedJoin(defaultModel.isReplicatedJoin());
    currentModel.setDieOnError(defaultModel.isDieOnError());
    currentModel.setLookInParallel(defaultModel.isLookInParallel());
    currentModel.setEnableAutoConvertType(defaultModel.isEnableAutoConvertType());
    currentModel.setTempDataDir(defaultModel.getTempDataDir());
    currentModel.setRowBufferSize(defaultModel.getRowBufferSize());
    AbstractMapComponent component = manager.getAbstractMapComponent();
    IElementParameter parameter = component.getElementParameter(DIE_ON_ERROR);
    if (parameter != null && parameter.getValue() != null && parameter.getValue() instanceof Boolean) {
        currentModel.setDieOnError((Boolean) parameter.getValue());
    }
    parameter = component.getElementParameter(REPLICATED_JOIN);
    if (parameter != null && parameter.getValue() != null && parameter.getValue() instanceof Boolean) {
        currentModel.setReplicatedJoin((Boolean) parameter.getValue());
    }
    parameter = component.getElementParameter(TEMPORARY_DATA_DIRECTORY);
    if (parameter != null && parameter.getValue() != null) {
        currentModel.setTempDataDir(String.valueOf(parameter.getValue()));
    }
    parameter = component.getElementParameter(ROWS_BUFFER_SIZE);
    if (parameter != null && parameter.getValue() != null) {
        currentModel.setRowBufferSize(String.valueOf(parameter.getValue()));
    }
    boolean parallel = false;
    IElementParameter paraEle = component.getElementParameter(LOOKUP_IN_PARALLEL);
    if (paraEle != null) {
        parallel = (Boolean) paraEle.getValue();
    }
    currentModel.setLookInParallel(parallel);
    parameter = component.getElementParameter(ENABLE_AUTO_CONVERT_TYPE);
    if (parameter != null && parameter.getValue() != null && parameter.getValue() instanceof Boolean) {
        currentModel.setEnableAutoConvertType((Boolean) parameter.getValue());
    }
}
Also used : AbstractMapComponent(org.talend.designer.abstractmap.AbstractMapComponent) IElementParameter(org.talend.core.model.process.IElementParameter) MapperSettingModel(org.talend.designer.mapper.model.MapperSettingModel)

Example 4 with AbstractMapComponent

use of org.talend.designer.abstractmap.AbstractMapComponent in project tdi-studio-se by Talend.

the class UIManager method refreshVisualMapImage.

private void refreshVisualMapImage() {
    AbstractMapComponent mapCom = mapperManager.getAbstractMapComponent();
    if (mapCom == null) {
        return;
    }
    INode component = mapCom.getOriginalNode();
    if (component != null && component.getExternalNode() != null && component.getExternalNode().getScreenshot() != null) {
        byte[] saveImageToData = ImageUtils.saveImageToData(component.getExternalNode().getScreenshot());
        IProcess process = component.getProcess();
        if (process instanceof IProcess2) {
            IProcess2 processtmp = (IProcess2) process;
            Item item = processtmp.getProperty().getItem();
            if (item instanceof ProcessItem) {
                ProcessItem processItem = (ProcessItem) item;
                processItem.getProcess().getScreenshots().put(component.getUniqueName(), saveImageToData);
            } else if (item instanceof JobletProcessItem) {
                JobletProcessItem jobletItem = (JobletProcessItem) item;
                jobletItem.getJobletProcess().getScreenshots().put(component.getUniqueName(), saveImageToData);
            }
        }
    }
}
Also used : ToolItem(org.eclipse.swt.widgets.ToolItem) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) TableItem(org.eclipse.swt.widgets.TableItem) ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) INode(org.talend.core.model.process.INode) AbstractMapComponent(org.talend.designer.abstractmap.AbstractMapComponent) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) ProcessItem(org.talend.core.model.properties.ProcessItem) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) IProcess2(org.talend.core.model.process.IProcess2) IProcess(org.talend.core.model.process.IProcess)

Aggregations

AbstractMapComponent (org.talend.designer.abstractmap.AbstractMapComponent)4 IElementParameter (org.talend.core.model.process.IElementParameter)2 IProcess (org.talend.core.model.process.IProcess)2 HashSet (java.util.HashSet)1 TableItem (org.eclipse.swt.widgets.TableItem)1 ToolItem (org.eclipse.swt.widgets.ToolItem)1 INode (org.talend.core.model.process.INode)1 IProcess2 (org.talend.core.model.process.IProcess2)1 Item (org.talend.core.model.properties.Item)1 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 ExternalMapperData (org.talend.designer.mapper.external.data.ExternalMapperData)1 ExternalMapperTable (org.talend.designer.mapper.external.data.ExternalMapperTable)1 MapperSettingModel (org.talend.designer.mapper.model.MapperSettingModel)1 OutputTable (org.talend.designer.mapper.model.table.OutputTable)1