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