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);
}
}
}
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());
}
}
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());
}
}
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);
}
}
}
}
Aggregations