use of org.talend.core.model.components.IMultipleComponentManager 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.IMultipleComponentManager in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method getSelectedNodeName.
/**
* Move Cursor to Selected Node.
*
* @param processor
*/
/**
* Get the selected Node if any.
*
* @return the component selected name or null if component is not found or is not activated
*/
public String getSelectedNodeName() {
String nodeName = null;
Node node = getSelectedGraphicNode();
if (node != null) {
if (node.isActivate() || node.isDummy()) {
nodeName = node.getUniqueName();
} else {
nodeName = null;
}
if (isVirtualNode(node)) {
// add for feature 13701
for (IMultipleComponentManager mcm : node.getComponent().getMultipleComponentManagers()) {
if (!mcm.isLookupMode()) {
//$NON-NLS-1$
nodeName += "_" + mcm.getInput().getName();
}
}
// for feature 13701
// nodeName += "_" + node.getComponent().getMultipleComponentManagers().get(0).getInput().getName();
// //$NON-NLS-1$
}
if (node.isFileScaleComponent()) {
//$NON-NLS-1$
nodeName += "_fsNode";
}
}
return nodeName;
}
use of org.talend.core.model.components.IMultipleComponentManager in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method isVirtualNode.
/**
*
* DOC YeXiaowei Comment method "isVirtualNode".
*
* @param node
* @return
*/
private boolean isVirtualNode(final INode node) {
boolean isVirtualNode = false;
//$NON-NLS-1$
IElementParameter param = node.getElementParameter("IS_VIRTUAL_COMPONENT");
if (param != null) {
// now only available for tUniqRow.
return (Boolean) param.getValue() && param.isRequired(node.getElementParameters());
}
final String componentName = node.getComponent().getName();
if (componentName.equals("tMap")) {
//$NON-NLS-1$
isVirtualNode = CorePlugin.getDefault().getMapperService().isVirtualComponent(node);
} else if (componentName.equals("tXMLMap")) {
//$NON-NLS-1$
isVirtualNode = CorePlugin.getDefault().getXMLMapperService().isVirtualComponent(node);
} else if (componentName.equals("tAvroMap")) {
//$NON-NLS-1$
isVirtualNode = CorePlugin.getDefault().getSparkMapperService().isVirtualComponent(node);
} else {
List<IMultipleComponentManager> multipleComponentManagers = node.getComponent().getMultipleComponentManagers();
for (IMultipleComponentManager mcm : multipleComponentManagers) {
if (!mcm.isLookupMode()) {
return true;
}
}
}
if (!isVirtualNode) {
if (node.getExternalNode() != null) {
return node.getExternalNode().isGeneratedAsVirtualComponent();
}
}
return isVirtualNode;
}
use of org.talend.core.model.components.IMultipleComponentManager 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.IMultipleComponentManager in project tdi-studio-se by Talend.
the class AbstractStatsLogsComponent method createMultipleComponentsParameters.
protected void createMultipleComponentsParameters() {
// create parameters
if ((multipleComponentManagers != null) && (multipleComponentManagers.size() > 0)) {
IMultipleComponentManager multipleComponentManager = multipleComponentManagers.get(0);
if (useFile) {
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.FILENAME", "FILE.FILENAME");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.ROWSEPARATOR", "FILE.ROWSEPARATOR");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.FIELDSEPARATOR", "FILE.FIELDSEPARATOR");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.APPEND", "FILE.APPEND");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.INCLUDEHEADER", "FILE.INCLUDEHEADER");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.ENCODING", "FILE.ENCODING");
}
if (useDb) {
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.USE_EXISTING_CONNECTION", "DB.USE_EXISTING_CONNECTION");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.CONNECTION", "DB.CONNECTION");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.COMMIT_EVERY", "DB.COMMIT_EVERY");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.HOST", "DB.HOST");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.HOST", "DB.SERVER");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.HOST", "DB.DSN");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.PORT", "DB.PORT");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.DBNAME", "DB.DBNAME");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.DB_VERSION", "DB.DB_VERSION");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.PROPERTIES", "DB.PROPERTIES");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.USER", "DB.USER");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.PASS", "DB.PASS");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.TABLE", "DB.TABLE");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.TABLE_ACTION", "DB.TABLE_ACTION");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.DATA_ACTION", "DB.DATA_ACTION");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.COMMIT_EVERY", "DB.COMMIT_EVERY");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.SCHEMA_DB", "DB.SCHEMA_DB");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.DB_TYPE", "DB.DB_TYPE");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.CONNECTION_TYPE", "DB.CONNECTION_TYPE");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.USE_TRANSACTION", "DB.USE_TRANSACTION");
//$NON-NLS-1$ //$NON-NLS-2$
multipleComponentManager.addParam("self.LOCAL_SERVICE_NAME", "DB.LOCAL_SERVICE_NAME");
}
}
}
Aggregations