Search in sources :

Example 66 with ComponentProperties

use of org.talend.components.api.properties.ComponentProperties in project components by Talend.

the class AbstractComponentDefinition method createProperties.

@Deprecated
@Override
public ComponentProperties createProperties() {
    ComponentProperties compProp = PropertiesImpl.createNewInstance(getPropertiesClass(), "root");
    compProp.init();
    return compProp;
}
Also used : ComponentProperties(org.talend.components.api.properties.ComponentProperties)

Example 67 with ComponentProperties

use of org.talend.components.api.properties.ComponentProperties in project components by Talend.

the class AbstractComponentDefinition method supportsProperties.

@Override
public boolean supportsProperties(ComponentProperties... properties) {
    // compute all supported classes
    Class<? extends ComponentProperties>[] supportedNestedClasses = getNestedCompatibleComponentPropertiesClass();
    List<Class<? extends ComponentProperties>> supportedClasses = new ArrayList(supportedNestedClasses.length);
    Collections.addAll(supportedClasses, supportedNestedClasses);
    supportedClasses.add(getPropertyClass());
    // create a list of Classes to check.
    List<Class<? extends ComponentProperties>> classesToCheck = new ArrayList<>(properties.length);
    for (ComponentProperties cp : properties) {
        classesToCheck.add(cp.getClass());
    }
    return supportedClasses.containsAll(classesToCheck);
}
Also used : ComponentProperties(org.talend.components.api.properties.ComponentProperties) ArrayList(java.util.ArrayList)

Example 68 with ComponentProperties

use of org.talend.components.api.properties.ComponentProperties in project components by Talend.

the class ComponentServiceTest method testSupportsProps.

@Test
public void testSupportsProps() throws Throwable {
    ComponentProperties props = getComponentService().getComponentProperties(TestComponentDefinition.COMPONENT_NAME);
    ComponentPropertiesWithDefinedI18N anotherProp = (ComponentPropertiesWithDefinedI18N) new ComponentPropertiesWithDefinedI18N("foo").init();
    List<ComponentDefinition> comps = getComponentService().getPossibleComponents(props, anotherProp);
    assertEquals("TestComponent", comps.get(0).getName());
    comps = getComponentService().getPossibleComponents(new NestedComponentProperties("props"), new NotExistingComponentProperties());
    assertEquals(0, comps.size());
}
Also used : NestedComponentProperties(org.talend.components.api.service.common.testcomponent.nestedprop.NestedComponentProperties) NestedComponentProperties(org.talend.components.api.service.common.testcomponent.nestedprop.NestedComponentProperties) TestComponentProperties(org.talend.components.api.service.common.testcomponent.TestComponentProperties) ComponentProperties(org.talend.components.api.properties.ComponentProperties) ComponentPropertiesWithDefinedI18N(org.talend.components.api.service.common.testcomponent.ComponentPropertiesWithDefinedI18N) TestComponentDefinition(org.talend.components.api.service.common.testcomponent.TestComponentDefinition) ComponentDefinition(org.talend.components.api.component.ComponentDefinition) Test(org.junit.Test) AbstractComponentTest(org.talend.components.api.test.AbstractComponentTest)

Example 69 with ComponentProperties

use of org.talend.components.api.properties.ComponentProperties in project components by Talend.

the class ComponentServiceTest method testGetWizardWithProps.

@Test
public void testGetWizardWithProps() {
    TestComponentWizard wizard = (TestComponentWizard) getComponentService().getComponentWizard(TestComponentWizardDefinition.COMPONENT_WIZARD_NAME, "userdata");
    wizard.props = new TestComponentProperties("props").init();
    ComponentProperties props = (ComponentProperties) wizard.props;
    List<ComponentWizard> wizards = getComponentService().getComponentWizardsForProperties(props, "userdata");
    assertTrue(props == ((TestComponentWizard) wizards.get(0)).props);
}
Also used : NestedComponentProperties(org.talend.components.api.service.common.testcomponent.nestedprop.NestedComponentProperties) TestComponentProperties(org.talend.components.api.service.common.testcomponent.TestComponentProperties) ComponentProperties(org.talend.components.api.properties.ComponentProperties) TestComponentWizard(org.talend.components.api.service.common.testcomponent.TestComponentWizard) ComponentWizard(org.talend.components.api.wizard.ComponentWizard) TestComponentProperties(org.talend.components.api.service.common.testcomponent.TestComponentProperties) TestComponentWizard(org.talend.components.api.service.common.testcomponent.TestComponentWizard) Test(org.junit.Test) AbstractComponentTest(org.talend.components.api.test.AbstractComponentTest)

Example 70 with ComponentProperties

use of org.talend.components.api.properties.ComponentProperties in project components by Talend.

the class ConnectorDto method createConnectorList.

/**
 * Return a list of all connectors for that component definition.
 *
 * @param origin The component definition to investigate.
 * @return A list of all connectors for that component definition.
 */
public static List<ConnectorDto> createConnectorList(ComponentDefinition origin) {
    // Get the list of possible connectors.
    ComponentProperties properties = PropertiesImpl.createNewInstance(origin.getPropertiesClass(), "properties");
    List<ConnectorDto> connections = new ArrayList<>();
    for (Connector incoming : properties.getPossibleConnectors(false)) {
        connections.add(new ConnectorDto(ConnectorTypology.SINK, incoming));
    }
    for (Connector outgoing : properties.getPossibleConnectors(true)) {
        connections.add(new ConnectorDto(ConnectorTypology.SOURCE, outgoing));
    }
    return connections;
}
Also used : Connector(org.talend.components.api.component.Connector) ComponentProperties(org.talend.components.api.properties.ComponentProperties) ArrayList(java.util.ArrayList)

Aggregations

ComponentProperties (org.talend.components.api.properties.ComponentProperties)76 Test (org.junit.Test)22 Form (org.talend.daikon.properties.presentation.Form)17 Property (org.talend.daikon.properties.property.Property)17 ArrayList (java.util.ArrayList)16 NamedThing (org.talend.daikon.NamedThing)13 GenericConnection (org.talend.repository.generic.model.genericMetadata.GenericConnection)13 Properties (org.talend.daikon.properties.Properties)10 List (java.util.List)9 IElementParameter (org.talend.core.model.process.IElementParameter)9 INode (org.talend.core.model.process.INode)9 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)8 Schema (org.apache.avro.Schema)7 ComponentDefinition (org.talend.components.api.component.ComponentDefinition)7 ComponentService (org.talend.components.api.service.ComponentService)7 ComponentWizard (org.talend.components.api.wizard.ComponentWizard)7 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)7 ConnectionItem (org.talend.core.model.properties.ConnectionItem)7 GenericElementParameter (org.talend.designer.core.generic.model.GenericElementParameter)7 ElementParameter (org.talend.designer.core.model.components.ElementParameter)7