Search in sources :

Example 1 with GenericNodeConnector

use of org.talend.designer.core.generic.model.GenericNodeConnector in project tdi-studio-se by Talend.

the class SchemaUtils method updateComponentSchema.

public static void updateComponentSchema(INode node, IMetadataTable metadataTable, Boolean askPropagate) {
    if (node == null || metadataTable == null || node.getComponentProperties() == null) {
        return;
    }
    Schema schema = convertTalendSchemaIntoComponentSchema(ConvertionHelper.convert(metadataTable));
    INodeConnector connector = node.getConnectorFromName(metadataTable.getAttachedConnector());
    if (connector != null) {
        if (connector instanceof GenericNodeConnector) {
            node.getComponentProperties().setConnectedSchema(((GenericNodeConnector) connector).getComponentConnector(), schema, true);
        }
        for (IElementParameter param : new ArrayList<IElementParameter>(node.getElementParameters())) {
            if (EParameterFieldType.SCHEMA_REFERENCE.equals(param.getFieldType()) && connector.getName().equals(param.getContext())) {
                if (param instanceof GenericElementParameter) {
                    ((GenericElementParameter) param).setAskPropagate(askPropagate);
                }
                param.setValue(schema);
            }
        }
    }
}
Also used : GenericNodeConnector(org.talend.designer.core.generic.model.GenericNodeConnector) Schema(org.apache.avro.Schema) ArrayList(java.util.ArrayList) GenericElementParameter(org.talend.designer.core.generic.model.GenericElementParameter) IElementParameter(org.talend.core.model.process.IElementParameter) INodeConnector(org.talend.core.model.process.INodeConnector)

Aggregations

ArrayList (java.util.ArrayList)1 Schema (org.apache.avro.Schema)1 IElementParameter (org.talend.core.model.process.IElementParameter)1 INodeConnector (org.talend.core.model.process.INodeConnector)1 GenericElementParameter (org.talend.designer.core.generic.model.GenericElementParameter)1 GenericNodeConnector (org.talend.designer.core.generic.model.GenericNodeConnector)1