use of org.talend.core.model.metadata.IMetadataTable in project tdi-studio-se by Talend.
the class ShadowNode method getMetadataList.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.process.INode#getMetaDataList()
*/
@Override
public List<IMetadataTable> getMetadataList() {
List<IMetadataTable> metadataList = super.getMetadataList();
if (metadataList != null) {
return metadataList;
}
List<IMetadataTable> metadatas = new ArrayList<IMetadataTable>();
MetadataTable metadata = new MetadataTable();
metadata.setTableName(this.getUniqueName());
List<IMetadataColumn> columns = new ArrayList<IMetadataColumn>();
for (int i = 0; i < columnNumber; i++) {
MetadataColumn col = new MetadataColumn();
//$NON-NLS-1$
col.setLabel("row" + i);
//$NON-NLS-1$
col.setTalendType("id_String");
//$NON-NLS-1$
col.setType("String");
columns.add(col);
}
metadata.setListColumns(columns);
metadatas.add(metadata);
return metadatas;
}
use of org.talend.core.model.metadata.IMetadataTable in project tdi-studio-se by Talend.
the class InsertNewColumnCommand method createInputMetadataColumn.
private void createInputMetadataColumn(String sourceTreeName, String targetTreeName, TreeNode sourceNode, String targetNodeName, int index) {
String sourceNodeName = sourceNode.getName();
IMetadataTable metadataTarget = null;
List<IODataComponent> inputs = manager.getMapperComponent().getIODataComponents().getInputs();
for (IODataComponent incoming : inputs) {
if (targetTreeName != null && targetTreeName.equals(incoming.getConnection().getName())) {
metadataTarget = incoming.getTable();
}
}
if (metadataTarget != null) {
IMetadataColumn columnSource = null;
if (sourceTreeName != null) {
columnSource = getSourceColumn(sourceTreeName, sourceNodeName);
}
creatMeatadataColumn(columnSource, targetNodeName, sourceNode, metadataTarget, index);
}
}
use of org.talend.core.model.metadata.IMetadataTable in project tdi-studio-se by Talend.
the class InsertNewColumnCommand method createOutputMetadataColumn.
private void createOutputMetadataColumn(String sourceTreeName, String targetTreeName, AbstractNode sourceNode, String targetNodeName, int index) {
String sourceNodeName = sourceNode.getName();
IMetadataTable metadataTarget = null;
List<IMetadataTable> metadataTargets = manager.getMapperComponent().getMetadataList();
if (metadataTargets != null) {
for (IMetadataTable target : metadataTargets) {
if (target.getTableName().equals(targetTreeName)) {
metadataTarget = target;
}
}
}
if (metadataTarget != null) {
IMetadataColumn columnSource = null;
if (sourceTreeName != null) {
columnSource = getSourceColumn(sourceTreeName, sourceNodeName);
}
creatMeatadataColumn(columnSource, targetNodeName, sourceNode, metadataTarget, index);
}
}
use of org.talend.core.model.metadata.IMetadataTable in project tdi-studio-se by Talend.
the class StatsAndLogsManager method createLogsNode.
private static DataNode createLogsNode(boolean useFile, boolean console, String dbOutput) {
JobLogsComponent logsComponent = new JobLogsComponent(useFile, console, dbOutput);
DataNode logsNode = new DataNode(logsComponent, LOG_UNIQUE_NAME);
logsNode.setStart(true);
logsNode.setSubProcessStart(true);
logsNode.setActivate(true);
logsNode.getMetadataList().clear();
// load the tLogCatcher to get the schema.
IComponent tmpComponent = ComponentsFactoryProvider.getInstance().get("tLogCatcher", //$NON-NLS-1$
ComponentCategory.CATEGORY_4_DI.getName());
//$NON-NLS-1$
DataNode tmpNode = new DataNode(tmpComponent, "tmp");
boolean found = false;
for (int k = 0; k < tmpNode.getElementParameters().size() && !found; k++) {
IElementParameter currentParam = tmpNode.getElementParameters().get(k);
if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
Object value = currentParam.getValue();
if (value instanceof IMetadataTable) {
IMetadataTable table = ((IMetadataTable) value).clone();
table.setTableName(LOG_UNIQUE_NAME);
table.setAttachedConnector(currentParam.getContext());
logsNode.getMetadataList().add(table);
}
found = true;
}
}
return logsNode;
}
use of org.talend.core.model.metadata.IMetadataTable in project tdi-studio-se by Talend.
the class StatsAndLogsManager method createStatsNode.
private static DataNode createStatsNode(boolean useFile, boolean console, String dbOutput) {
JobStatsComponent statsComponent = new JobStatsComponent(useFile, console, dbOutput);
DataNode statsNode = new DataNode(statsComponent, STAT_UNIQUE_NAME);
statsNode.setStart(true);
statsNode.setSubProcessStart(true);
statsNode.setActivate(true);
statsNode.getMetadataList().clear();
// load the tStatCatcher to get the schema.
IComponent tmpComponent = ComponentsFactoryProvider.getInstance().get("tStatCatcher", //$NON-NLS-1$
ComponentCategory.CATEGORY_4_DI.getName());
//$NON-NLS-1$
DataNode tmpNode = new DataNode(tmpComponent, "tmp");
boolean found = false;
for (int k = 0; k < tmpNode.getElementParameters().size() && !found; k++) {
IElementParameter currentParam = tmpNode.getElementParameters().get(k);
if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
Object value = currentParam.getValue();
if (value instanceof IMetadataTable) {
IMetadataTable table = ((IMetadataTable) value).clone();
table.setTableName(STAT_UNIQUE_NAME);
table.setAttachedConnector(currentParam.getContext());
statsNode.getMetadataList().add(table);
}
found = true;
}
}
return statsNode;
}
Aggregations