use of org.talend.core.model.components.IMultipleComponentItem in project tdi-studio-se by Talend.
the class Component method createMultipleComponentManagers.
@Override
protected List<IMultipleComponentManager> createMultipleComponentManagers() {
List<IMultipleComponentManager> multipleComponentManagers = new ArrayList<>();
if (componentDefinition instanceof VirtualComponentDefinition) {
VirtualComponentDefinition definition = (VirtualComponentDefinition) componentDefinition;
String inputComponentName = null;
String outputComponentName = null;
ComponentDefinition inputComponentDefinition = definition.getInputComponentDefinition();
if (inputComponentDefinition != null) {
inputComponentName = inputComponentDefinition.getName();
}
ComponentDefinition outputComponentDefinition = definition.getOutputComponentDefinition();
if (outputComponentDefinition != null) {
outputComponentName = outputComponentDefinition.getName();
}
if (inputComponentName == null || outputComponentName == null) {
return multipleComponentManagers;
}
IMultipleComponentManager multipleComponentManager = new MultipleComponentManager(inputComponentName, outputComponentName);
IMultipleComponentItem inputItem = multipleComponentManager.addItem(inputComponentName, inputComponentName);
multipleComponentManager.setExistsLinkTo(true);
// FIXME: should get the connector type by other way.
String cType = EConnectionType.ON_ROWS_END.getName();
inputItem.getOutputConnections().add(new MultipleComponentConnection(cType, outputComponentName));
multipleComponentManager.addItem(outputComponentName, outputComponentName);
multipleComponentManager.validateItems();
multipleComponentManagers.add(multipleComponentManager);
}
return multipleComponentManagers;
}
use of org.talend.core.model.components.IMultipleComponentItem in project tdi-studio-se by Talend.
the class AbstractStatsLogsComponent method loadMultipleComponentManager.
protected void loadMultipleComponentManager() {
String lastComponent = null;
if (useConsole) {
//$NON-NLS-1$
lastComponent = "CONSOLE";
} else if (useDb) {
//$NON-NLS-1$
lastComponent = "DB";
} else {
//$NON-NLS-1$
lastComponent = "FILE";
}
// create base items
IMultipleComponentManager multipleComponentManager = new MultipleComponentManager(componentId, lastComponent);
IMultipleComponentItem currentItem = multipleComponentManager.addItem(componentId, subComponent);
if (useFile) {
//$NON-NLS-1$ //$NON-NLS-2$
currentItem.getOutputConnections().add(new MultipleComponentConnection("FLOW", "FILE"));
//$NON-NLS-1$ //$NON-NLS-2$
currentItem = multipleComponentManager.addItem("FILE", "tFileOutputDelimited");
}
if (useDb) {
//$NON-NLS-1$ //$NON-NLS-2$
currentItem.getOutputConnections().add(new MultipleComponentConnection("FLOW", "DB"));
//$NON-NLS-1$
currentItem = multipleComponentManager.addItem("DB", dbComponent);
}
if (useConsole) {
//$NON-NLS-1$ //$NON-NLS-2$
currentItem.getOutputConnections().add(new MultipleComponentConnection("FLOW", "CONSOLE"));
//$NON-NLS-1$ //$NON-NLS-2$
currentItem = multipleComponentManager.addItem("CONSOLE", "tLogRow");
}
multipleComponentManager.validateItems();
multipleComponentManagers.add(multipleComponentManager);
createMultipleComponentsParameters();
}
use of org.talend.core.model.components.IMultipleComponentItem in project tdi-studio-se by Talend.
the class JobContextLoadComponent method loadMultipleComponentManager.
protected void loadMultipleComponentManager() {
IMultipleComponentManager multipleComponentManager = null;
// create base items
if (isFile) {
multipleComponentManager = new MultipleComponentManager(FILE_INPUT_REGEX, CONTEXT_LOAD);
IMultipleComponentItem currentItem = multipleComponentManager.addItem(FILE_INPUT_REGEX, FILE_INPUT_COMPONENT);
currentItem.getOutputConnections().add(new MultipleComponentConnection(EConnectionType.FLOW_MAIN.getName(), CONTEXT_LOAD));
currentItem = multipleComponentManager.addItem(CONTEXT_LOAD, CONTEXTLOAD_COMPONENT);
} else {
if (dbComponent == null) {
return;
}
multipleComponentManager = new MultipleComponentManager(DB_INPUT, CONTEXT_LOAD);
IMultipleComponentItem currentItem = multipleComponentManager.addItem(DB_INPUT, dbComponent);
currentItem.getOutputConnections().add(new MultipleComponentConnection(EConnectionType.FLOW_MAIN.getName(), CONTEXT_LOAD));
currentItem = multipleComponentManager.addItem(CONTEXT_LOAD, CONTEXTLOAD_COMPONENT);
}
multipleComponentManager.validateItems();
multipleComponentManagers.add(multipleComponentManager);
createMultipleComponentsParameters();
}
use of org.talend.core.model.components.IMultipleComponentItem in project tdi-studio-se by Talend.
the class MultipleComponentManager method addItem.
public IMultipleComponentItem addItem(String name, String component) {
MultipleComponentItem currentItem = new MultipleComponentItem();
if (name.equals(inputName)) {
input = currentItem;
}
if (name.equals(outputName)) {
output = currentItem;
}
currentItem.setName(name);
currentItem.setComponent(component);
itemList.add(currentItem);
return currentItem;
}
use of org.talend.core.model.components.IMultipleComponentItem in project tdi-studio-se by Talend.
the class MultipleComponentManager method validateItems.
public void validateItems() {
for (IMultipleComponentItem mainItem : itemList) {
for (IMultipleComponentConnection connection : mainItem.getOutputConnections()) {
String nameLinkedTo = connection.getNameTarget();
if (nameLinkedTo != null) {
boolean found = false;
for (int i = 0; i < itemList.size() && !found; i++) {
IMultipleComponentItem linkedItem = itemList.get(i);
if (linkedItem.getName().equals(nameLinkedTo)) {
connection.setSource(mainItem);
connection.setTarget(linkedItem);
linkedItem.getInputConnections().add(connection);
found = true;
}
}
}
}
}
}
Aggregations