use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class MissingSettingsMultiThreadDynamicComposite method afterCreateMessagesComposite.
@Override
public void afterCreateMessagesComposite(MessagesComposite messComposite) {
final Element ele = this.getElement();
if (ele instanceof Node && isVisibleTopMessages()) {
final IComponent component = ((Node) ele).getComponent();
messComposite.updateTopMessages(//$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"MissingSettingsMultiThreadDynamicComposite_missingModulesMessages", component.getName()), IStatus.WARNING);
if (messComposite instanceof MessagesWithActionComposite) {
MessagesWithActionComposite messWithActionComposite = (MessagesWithActionComposite) messComposite;
messWithActionComposite.updateActionButton(//$NON-NLS-1$
Messages.getString("MissingSettingsMultiThreadDynamicComposite.installName") + "...", //$NON-NLS-1$
null);
messWithActionComposite.addActionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!missModulesNeeded.isEmpty()) {
ModulesInstallerUtil.forceInstallModules(getShell(), component, missModulesNeeded);
checkVisibleTopMessages();
}
}
});
}
}
super.afterCreateMessagesComposite(messComposite);
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class FixWrongDbTypesMigrationTask method execute.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
*/
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
if (processType == null) {
return ExecutionResult.NOTHING_TO_DO;
}
boolean modified = false;
for (Object nodeTypeObject : processType.getNode()) {
NodeType nodeType = (NodeType) nodeTypeObject;
IComponent component = ComponentsFactoryProvider.getInstance().get(nodeType.getComponentName(), ComponentCategory.CATEGORY_4_DI.getName());
if (component == null) {
// in case original component doesn't exist here
continue;
}
FakeNode fNode = new FakeNode(component);
IElementParameter mappingParameter = fNode.getElementParameterFromField(EParameterFieldType.MAPPING_TYPE);
if (mappingParameter != null && mappingParameter.getValue() != null) {
String mappingParameterValue = (String) mappingParameter.getValue();
MappingTypeRetriever mtr = MetadataTalendType.getMappingTypeRetriever(mappingParameterValue);
if (mtr == null) {
continue;
}
for (Object metadataObject : nodeType.getMetadata()) {
MetadataType metadataType = (MetadataType) metadataObject;
for (Object columnObject : metadataType.getColumn()) {
ColumnType columnType = (ColumnType) columnObject;
if (columnType.getSourceType() != null && !"".equals(columnType.getSourceType())) {
if (mtr.isAdvicedTalendToDbType(columnType.getType(), columnType.getSourceType())) {
// correct type already, no need to do anything
continue;
}
List<MappingType> advicedTalendToDbTypes = mtr.getAdvicedTalendToDbTypes(columnType.getType());
if (advicedTalendToDbTypes == null) {
continue;
}
String dbType = columnType.getSourceType();
for (MappingType type : advicedTalendToDbTypes) {
if (type.getDbType().equalsIgnoreCase(dbType)) {
columnType.setSourceType(type.getDbType());
modified = true;
break;
}
}
}
}
}
}
}
if (modified) {
try {
ProxyRepositoryFactory.getInstance().save(item, true);
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
return ExecutionResult.NOTHING_TO_DO;
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class StatsAndLogsManager method createLogsNode.
private static DataNode createLogsNode(boolean useFile, boolean console, String dbOutput) {
JobLogsComponent logsComponent = new JobLogsComponent(useFile, console, dbOutput);
DataNode logsNode = new DataNode(logsComponent, LOG_UNIQUE_NAME);
logsNode.setStart(true);
logsNode.setSubProcessStart(true);
logsNode.setActivate(true);
logsNode.getMetadataList().clear();
// load the tLogCatcher to get the schema.
IComponent tmpComponent = ComponentsFactoryProvider.getInstance().get("tLogCatcher", //$NON-NLS-1$
ComponentCategory.CATEGORY_4_DI.getName());
//$NON-NLS-1$
DataNode tmpNode = new DataNode(tmpComponent, "tmp");
boolean found = false;
for (int k = 0; k < tmpNode.getElementParameters().size() && !found; k++) {
IElementParameter currentParam = tmpNode.getElementParameters().get(k);
if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
Object value = currentParam.getValue();
if (value instanceof IMetadataTable) {
IMetadataTable table = ((IMetadataTable) value).clone();
table.setTableName(LOG_UNIQUE_NAME);
table.setAttachedConnector(currentParam.getContext());
logsNode.getMetadataList().add(table);
}
found = true;
}
}
return logsNode;
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class StatsAndLogsManager method createStatsNode.
private static DataNode createStatsNode(boolean useFile, boolean console, String dbOutput) {
JobStatsComponent statsComponent = new JobStatsComponent(useFile, console, dbOutput);
DataNode statsNode = new DataNode(statsComponent, STAT_UNIQUE_NAME);
statsNode.setStart(true);
statsNode.setSubProcessStart(true);
statsNode.setActivate(true);
statsNode.getMetadataList().clear();
// load the tStatCatcher to get the schema.
IComponent tmpComponent = ComponentsFactoryProvider.getInstance().get("tStatCatcher", //$NON-NLS-1$
ComponentCategory.CATEGORY_4_DI.getName());
//$NON-NLS-1$
DataNode tmpNode = new DataNode(tmpComponent, "tmp");
boolean found = false;
for (int k = 0; k < tmpNode.getElementParameters().size() && !found; k++) {
IElementParameter currentParam = tmpNode.getElementParameters().get(k);
if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
Object value = currentParam.getValue();
if (value instanceof IMetadataTable) {
IMetadataTable table = ((IMetadataTable) value).clone();
table.setTableName(STAT_UNIQUE_NAME);
table.setAttachedConnector(currentParam.getContext());
statsNode.getMetadataList().add(table);
}
found = true;
}
}
return statsNode;
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class Connection method createParallelizeParameters.
private void createParallelizeParameters() {
// flag for start the parlization or not for the inputs
ElementParameter tmpParam = new ElementParameter(this);
tmpParam.setName(EParameterName.PARTITIONER.getName());
tmpParam.setValue(Boolean.FALSE);
tmpParam.setDisplayName(EParameterName.PARTITIONER.getDisplayName());
tmpParam.setFieldType(EParameterFieldType.RADIO);
tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
tmpParam.setNumRow(1);
tmpParam.setReadOnly(false);
tmpParam.setRequired(false);
//$NON-NLS-1$
tmpParam.setGroup("TYPE");
tmpParam.setGroupDisplayName("Type");
tmpParam.setShowIf("(#NODE@OUT.END_OF_FLOW == 'false' OR #NODE@IN.SUBTREE_START == 'true')");
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
tmpParam = new ElementParameter(this);
tmpParam.setName(EParameterName.DEPARTITIONER.getName());
tmpParam.setValue(Boolean.FALSE);
tmpParam.setDisplayName(EParameterName.DEPARTITIONER.getDisplayName());
tmpParam.setFieldType(EParameterFieldType.RADIO);
tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
tmpParam.setNumRow(2);
tmpParam.setReadOnly(false);
tmpParam.setRequired(false);
tmpParam.setShowIf("#NODE@IN.SUBTREE_START == 'false'");
//$NON-NLS-1$
tmpParam.setGroup("TYPE");
tmpParam.setGroupDisplayName("Type");
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
tmpParam = new ElementParameter(this);
tmpParam.setName(EParameterName.REPARTITIONER.getName());
tmpParam.setValue(Boolean.FALSE);
tmpParam.setDisplayName(EParameterName.REPARTITIONER.getDisplayName());
tmpParam.setFieldType(EParameterFieldType.RADIO);
tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
tmpParam.setNumRow(3);
tmpParam.setReadOnly(false);
tmpParam.setRequired(false);
tmpParam.setShowIf("(#NODE@IN.SUBTREE_START == 'false' AND #NODE@OUT.END_OF_FLOW == 'false')");
//$NON-NLS-1$
tmpParam.setGroup("TYPE");
tmpParam.setGroupDisplayName("Type");
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
tmpParam = new ElementParameter(this);
tmpParam.setName(EParameterName.NONE.getName());
tmpParam.setValue(Boolean.TRUE);
tmpParam.setDisplayName(EParameterName.NONE.getDisplayName());
tmpParam.setFieldType(EParameterFieldType.RADIO);
tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
tmpParam.setNumRow(4);
tmpParam.setReadOnly(false);
tmpParam.setRequired(false);
tmpParam.setShow(true);
//$NON-NLS-1$
tmpParam.setGroup("TYPE");
tmpParam.setGroupDisplayName("Type");
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
IComponent componentPar = ComponentsFactoryProvider.getInstance().get("tPartitioner", ComponentCategory.CATEGORY_4_DI.getName());
INode tmpNode = new DataNode(componentPar, source.getUniqueName());
tmpParam = (ElementParameter) tmpNode.getElementParameter("NUM_PARTITIONS");
tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
tmpParam.setShowIf("(PARTITIONER == 'true' or REPARTITIONER=='true')");
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
tmpParam = new ElementParameter(this);
tmpParam.setName("PART_QUEUE_SIZE");
tmpParam.setValue("1000");
tmpParam.setDisplayName(EParameterName.QUEUE_SIZE.getDisplayName());
tmpParam.setFieldType(EParameterFieldType.TEXT);
tmpParam.setNumRow(45);
tmpParam.setReadOnly(false);
tmpParam.setRequired(false);
tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
tmpParam.setShowIf("(PARTITIONER == 'true' or REPARTITIONER=='true') and (DEPARTITIONER=='false')");
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
tmpParam = (ElementParameter) tmpNode.getElementParameter("HASH_PARTITION");
tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
tmpParam.setShowIf("(PARTITIONER == 'true' or REPARTITIONER=='true')");
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
tmpParam = (ElementParameter) tmpNode.getElementParameter("HASH_KEYS");
tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
tmpParam.setShowIf("(PARTITIONER == 'true' or REPARTITIONER=='true') and (HASH_PARTITION=='true')");
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
tmpParam = new ElementParameter(this);
tmpParam.setName("DEPART_QUEUE_SIZE");
tmpParam.setValue("1000");
tmpParam.setDisplayName(EParameterName.QUEUE_SIZE.getDisplayName());
tmpParam.setFieldType(EParameterFieldType.TEXT);
tmpParam.setNumRow(45);
tmpParam.setReadOnly(false);
tmpParam.setRequired(false);
tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
// "(DEPARTITIONER == 'true' or REPARTITIONER=='true')"
tmpParam.setShowIf("(DEPARTITIONER == 'true' or REPARTITIONER=='true') and (PARTITIONER=='false')");
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
IComponent componentCol = ComponentsFactoryProvider.getInstance().get("tRecollector", ComponentCategory.CATEGORY_4_DI.getName());
INode tmpNode1 = new DataNode(componentCol, source.getUniqueName());
tmpParam = (ElementParameter) tmpNode1.getElementParameter("IS_SORTING");
tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
tmpParam.setShowIf("(DEPARTITIONER == 'true' or REPARTITIONER=='true')");
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
}
Aggregations