use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.
the class UIManager method getNewIndexesList.
private List<Map<String, Object>> getNewIndexesList() {
List<Map<String, Object>> map = new ArrayList<Map<String, Object>>();
MetadataTable table = (MetadataTable) neo4jManager.getNeo4jComponent().getMetadataList().get(0);
neo4jManager.convert(neo4jManager.getNeo4jComponent(), table);
for (IMetadataColumn col : table.getListColumns()) {
MetadataColumnExt ext = (MetadataColumnExt) col;
for (Index index : ext.getData().getIndexes()) {
Map<String, Object> value = new HashMap<String, Object>();
value.put(Neo4jComponent.SCHEMA_COLUMN, ext.getLabel());
value.put(Neo4jComponent.INDEX_NAME, index.getName());
value.put(Neo4jComponent.KEY, index.getKey());
value.put(Neo4jComponent.VALUE, index.getValue());
value.put(Neo4jComponent.UNIQUE, String.valueOf(index.isUnique()));
map.add(value);
}
}
return map;
}
use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.
the class RetrieveConfigurationProcess method getLogRowNode.
private Node getLogRowNode(MetadataTable metadataTable) {
// $NON-NLS-1$
String componentName = "tLogRow";
IComponent component = ComponentsFactoryProvider.getInstance().get(componentName, ComponentCategory.CATEGORY_4_DI.getName());
Node node = new Node(component, this);
// $NON-NLS-1$
node.getElementParameter("UNIQUE_NAME").setValue(logUniqueId);
// $NON-NLS-1$
node.getElementParameter("FIELDSEPARATOR").setValue(getWrapedStringValue(fieldSeparetor));
// $NON-NLS-1$
node.getElementParameter("PRINT_HEADER").setValue(Boolean.TRUE.toString());
// $NON-NLS-1$
node.getElementParameter("PRINT_UNIQUE_NAME").setValue(Boolean.TRUE.toString());
// $NON-NLS-1$
node.getElementParameter("PRINT_CONTENT_WITH_LOG4J").setValue(Boolean.FALSE.toString());
// set the schema
List<IMetadataTable> metadatas = new ArrayList<IMetadataTable>();
MetadataTable metadata = new MetadataTable();
metadata.setTableName(logUniqueId);
metadata.setAttachedConnector(metadataTable.getAttachedConnector());
List<IMetadataColumn> columns = new ArrayList<IMetadataColumn>();
columns.addAll(metadataTable.getListColumns());
metadata.setListColumns(columns);
metadatas.add(metadata);
node.setMetadataList(metadatas);
setActivate(true);
return node;
}
use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.
the class RetrieveConfigurationProcess method initNodesAndConnections.
protected void initNodesAndConnections() {
Node inputNode = getInputNode();
// $NON-NLS-1$
inputNode.getElementParameter("clusterManagerType").setValue(clusterManagerType);
// $NON-NLS-1$
inputNode.getElementParameter("url").setValue(getWrapedStringValue(host));
// $NON-NLS-1$
addPropertyChangeListener(inputNode.getElementParameter("basicAuth.useAuth"));
// $NON-NLS-1$
inputNode.getElementParameter("basicAuth.useAuth").setValue(useAuthentication);
if (useAuthentication) {
// $NON-NLS-1$
inputNode.getElementParameter("basicAuth.userId").setValue(getWrapedStringValue(userId));
// $NON-NLS-1$
inputNode.getElementParameter("basicAuth.password").setValue(getWrapedStringValue(password));
}
// $NON-NLS-1$
addPropertyChangeListener(inputNode.getElementParameter("ssl.useSsl"));
// $NON-NLS-1$
inputNode.getElementParameter("ssl.useSsl").setValue(useSSL);
if (useSSL) {
// $NON-NLS-1$
inputNode.getElementParameter("ssl.trustStoreType").setValue(trustStoreType);
// $NON-NLS-1$
inputNode.getElementParameter("ssl.trustStorePassword").setValue(getWrapedStringValue(trustStorePassword));
// $NON-NLS-1$
inputNode.getElementParameter("ssl.trustStorePath").setValue(getWrapedStringValue(trustStorePath));
}
MetadataTable targetTable = getMetadataTable();
Node outputNode = getLogRowNode(targetTable);
Node javaNode = getTJavaNode();
List<IConnection> inputConns = new ArrayList<IConnection>();
List<IConnection> logConns = new ArrayList<IConnection>();
List<IConnection> javaConns = new ArrayList<IConnection>();
// $NON-NLS-1$
Connection mainConn = new Connection(inputNode, outputNode, EConnectionType.FLOW_MAIN, "MAIN", "MAIN", "row1", "MAIN", false);
// $NON-NLS-1$
Connection subConn = new Connection(inputNode, javaNode, EConnectionType.ON_SUBJOB_OK, "SUBJOB_OK", "HadoopClusterConfigurationInput_1", "SUBJOB_OK", "SUBJOB_OK", false);
inputConns.add(mainConn);
inputConns.add(subConn);
logConns.add(mainConn);
javaConns.add(subConn);
inputNode.setOutgoingConnections(inputConns);
outputNode.setIncomingConnections(logConns);
javaNode.setIncomingConnections(javaConns);
inputNode.setProcess(this);
outputNode.setProcess(this);
javaNode.setProcess(this);
NodeContainer inputContainer = new NodeContainer(inputNode);
this.addNodeContainer(inputContainer);
NodeContainer outputContainer = new NodeContainer(outputNode);
this.addNodeContainer(outputContainer);
NodeContainer javaContainer = new NodeContainer(javaNode);
this.addNodeContainer(javaContainer);
//
initTLibraryLoadNode(inputNode);
}
use of org.talend.core.model.metadata.MetadataTable in project tdi-studio-se by Talend.
the class CreateComponentOnLinkHelper method getTargetArgs.
public static List<Object> getTargetArgs(Connection connection, Node node) {
List<Object> connArgs = new ArrayList<Object>();
IMetadataTable meta = null;
String connectName = null;
INodeConnector connector = node.getConnectorFromType(EConnectionType.FLOW_MAIN);
for (INodeConnector tconnector : node.getConnectorsFromType(EConnectionType.FLOW_MAIN)) {
if (connector.getMaxLinkOutput() != 0) {
connector = tconnector;
break;
}
}
EConnectionType connectType = node.getConnectorFromName(connector.getName()).getDefaultConnectionType();
if (connectType.hasConnectionCategory(EConnectionType.FLOW)) {
// String name = "*New Output*" + " (" + connector.getMenuName() + ")";
if (node.getConnectorFromName(connector.getName()).isMultiSchema()) {
String tableName = connection.getMetaName();
meta = connection.getSource().getMetadataTable(tableName);
if (connector.isMultiSchema()) {
if (connection.getTarget().getConnectorFromName(node.getConnectorFromName(connector.getName()).getName()).isMultiSchema()) {
// Connection conn = (Connection) connection.getTarget().getIncomingConnections().get(0);
// node.getMetadataList().add(conn.getMetadataTable());
} else {
MetadataTable table = (MetadataTable) connection.getTarget().getMetadataList().get(0).clone();
table.setLabel(tableName);
node.getMetadataList().add(table);
}
}
} else {
if (node.getMetadataList().size() == 0) {
meta = null;
} else {
meta = node.getMetadataFromConnector(connector.getName());
}
connectName = node.getProcess().generateUniqueConnectionName(Process.DEFAULT_ROW_CONNECTION_NAME);
}
if (connectType.equals(EConnectionType.FLOW_MAIN) || connectType.equals(EConnectionType.FLOW_REF)) {
if (meta == null) {
connArgs.add(null);
} else {
connArgs.add(meta.getTableName());
}
} else {
connArgs.add(node.getUniqueName());
}
String baseName = node.getConnectionName();
String fromConnectionName = null;
if (node.getProcess().checkValidConnectionName(baseName)) {
fromConnectionName = node.getProcess().generateUniqueConnectionName(baseName);
}
if (fromConnectionName != null && connectType.hasConnectionCategory(IConnectionCategory.FLOW) && node.getProcess().checkValidConnectionName(fromConnectionName, false) && !connector.isMultiSchema()) {
connArgs.add(fromConnectionName);
} else {
connArgs.add(connectName);
}
connArgs.add(null);
}
return connArgs;
}
use of org.talend.core.model.metadata.MetadataTable in project tdi-studio-se by Talend.
the class OracleGenerationManagerTest method createMetadataTable.
private IMetadataTable createMetadataTable(String... columnLabels) {
IMetadataTable metadataTable = new MetadataTable();
// will be error, strange
// List<IMetadataColumn> columns = mock(List.class);
List<IMetadataColumn> columns = new ArrayList<IMetadataColumn>();
if (columnLabels != null) {
for (String columnlabel : columnLabels) {
columns.add(createColumn(columnlabel));
}
}
// when(metadataTable.getListColumns()).thenReturn(columns);
metadataTable.setListColumns(columns);
return metadataTable;
}
Aggregations