use of org.talend.core.model.metadata.builder.connection.MetadataTable in project tdq-studio-se by Talend.
the class AnalysisHandler method getColumnSetOwnerNames.
private String[] getColumnSetOwnerNames() {
List<String> existingTables = new ArrayList<String>();
for (ModelElement element : getAnalyzedColumns()) {
if (element instanceof TdColumn && element.eContainer() instanceof Table) {
String tableName = ColumnHelper.getTableFullName((TdColumn) element);
if (!existingTables.contains(tableName)) {
existingTables.add(tableName);
}
} else if (element instanceof Table) {
String tableName = ((Table) element).getName();
if (!existingTables.contains(tableName)) {
existingTables.add(tableName);
}
} else if (element instanceof MetadataColumn) {
// the result page
if (!(element instanceof TdColumn)) {
// MOD qiongli 2011-1-28,for delimited file
try {
MetadataTable table = ColumnHelper.getColumnOwnerAsMetadataTable((MetadataColumn) element);
String tableName = table.getLabel();
if (!existingTables.contains(tableName)) {
existingTables.add(tableName);
}
} catch (java.lang.NullPointerException e) {
// $NON-NLS-1$
log.error(Messages.getString("AnalysisHandler.CanNotFindColumnParent", element.getName()), e);
}
}
}
}
return existingTables.toArray(new String[existingTables.size()]);
}
use of org.talend.core.model.metadata.builder.connection.MetadataTable in project tdq-studio-se by Talend.
the class FileDelimitedReader method findElementPositionByColumn.
/**
* find the position of the analysed elements in the file table's column
*/
private void findElementPositionByColumn(List<ModelElement> analysisElementList) {
MetadataColumn mColumn = (MetadataColumn) analysisElementList.get(0);
MetadataTable metadataTable = ColumnHelper.getColumnOwnerAsMetadataTable(mColumn);
EList<MetadataColumn> columns = metadataTable.getColumns();
List<String> columnLabels = new ArrayList<String>();
for (MetadataColumn column : columns) {
columnLabels.add(column.getLabel());
}
for (int j = 0; j < analysisElementList.size(); j++) {
analysedColumnName[j] = ((MetadataColumn) analysisElementList.get(j)).getLabel();
analysedColumnIndex[j] = columnLabels.indexOf(analysedColumnName[j]);
}
}
use of org.talend.core.model.metadata.builder.connection.MetadataTable in project tdq-studio-se by Talend.
the class DBColumnRepNode method getParentViewObject.
/*
* (non-Javadoc)
*
* @see
* org.talend.dq.nodes.DQRepositoryNode#getParentViewObject(org.talend.core.model.repository.IRepositoryViewObject)
*/
@Override
protected IRepositoryViewObject getParentViewObject() {
IRepositoryViewObject returnViewObject = null;
MetadataTable columnOwnerAsMetadataTable = ColumnHelper.getColumnOwnerAsMetadataTable(getTdColumn());
if (columnOwnerAsMetadataTable instanceof TdTable) {
returnViewObject = new TdTableRepositoryObject(metadataColumnRepositoryObject.getViewObject(), (TdTable) columnOwnerAsMetadataTable);
} else if (columnOwnerAsMetadataTable instanceof TdView) {
returnViewObject = new TdViewRepositoryObject(metadataColumnRepositoryObject.getViewObject(), (TdView) columnOwnerAsMetadataTable);
}
return returnViewObject;
}
use of org.talend.core.model.metadata.builder.connection.MetadataTable in project tdq-studio-se by Talend.
the class DFConnectionRepNode method createRepositoryNodeSchema.
private List<IRepositoryNode> createRepositoryNodeSchema() {
super.getChildren().clear();
IRepositoryViewObject object = this.getObject();
Set<MetadataTable> tables = ConnectionHelper.getTables(((ConnectionItem) getObject().getProperty().getItem()).getConnection());
if (tables != null && tables.size() > 0) {
for (MetadataTable mtable : tables) {
MetadataTableRepositoryObject mtRepObject = new MetadataTableRepositoryObject(object, mtable);
mtRepObject.setTableName(mtable.getLabel());
mtRepObject.setLabel(mtable.getLabel());
mtRepObject.setId(mtable.getLabel());
DFTableRepNode tableNode = new DFTableRepNode(mtRepObject, this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
tableNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_TABLE);
tableNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_TABLE);
mtRepObject.setRepositoryNode(tableNode);
super.getChildren().add(tableNode);
}
}
return super.getChildren();
}
use of org.talend.core.model.metadata.builder.connection.MetadataTable in project tdq-studio-se by Talend.
the class TreeMessageInfoDialog method getLabelProvider.
protected ILabelProvider getLabelProvider() {
if (labelProvider == null) {
labelProvider = new LabelProvider() {
@Override
public String getText(Object obj) {
if (obj == null) {
// $NON-NLS-1$
return "";
}
if (obj instanceof ImpactNode) {
return ((ImpactNode) obj).toString();
} else if (obj instanceof IFile) {
IFile file = (IFile) obj;
ModelElement modelElement = ModelElementFileFactory.getModelElement(file);
// MOD msjian TDQ-5909: modify to displayName
return modelElement != null ? PropertyHelper.getProperty(modelElement).getDisplayName() : file.getName();
} else if (obj instanceof RepositoryViewObject) {
// Added 20130226 TDQ-6899 show the name for Jrxml object (which has no related ModelElement)
return ((IRepositoryViewObject) obj).getLabel();
} else if (obj instanceof MetadataTable) {
// ADD TDQ-7146: for all type's connection table/view node
return ((ModelElement) obj).getName();
}
Property property = PropertyHelper.getProperty((ModelElement) obj);
return property == null ? ((ModelElement) obj).getName() : property.getDisplayName();
}
@Override
public Image getImage(Object obj) {
ModelElement modelElement = null;
if (obj instanceof ModelElement) {
modelElement = (ModelElement) obj;
} else if (obj instanceof ImpactNode) {
modelElement = ((ImpactNode) obj).getNodeElement();
} else if (obj instanceof IFile) {
modelElement = ModelElementFileFactory.getModelElement((IFile) obj);
} else if (obj instanceof RepositoryViewObject) {
// Added 20130226 TDQ-6899 show the name for Jrxml object (which has no related ModelElement)
return ImageLib.getImage(ImageLib.JRXML_ICON);
}
// ~
if (modelElement == null) {
if (((ImpactNode) obj).getNode() != null) {
return ImageLib.getImage(ImageLib.JRXML_ICON);
}
return super.getImage(obj);
}
Image modelElementImage = null;
String imgName = null;
if (modelElement instanceof Analysis) {
imgName = ImageLib.ANALYSIS_OBJECT;
} else if (modelElement instanceof TdReport) {
imgName = ImageLib.REPORT_OBJECT;
} else if (modelElement instanceof DatabaseConnection) {
imgName = ImageLib.CONNECTION;
} else if (modelElement instanceof DelimitedFileConnection) {
imgName = ImageLib.FILE_DELIMITED;
} else if (modelElement instanceof Pattern) {
imgName = ImageLib.PATTERN_REG;
} else if (modelElement instanceof IndicatorDefinition) {
// IndicatorDefinition
if (modelElement instanceof DQRule) {
imgName = ImageLib.DQ_RULE;
} else if (modelElement instanceof MatchRuleDefinition) {
imgName = ImageLib.MATCH_RULE_ICON;
} else {
imgName = ImageLib.IND_DEFINITION;
}
// TDQ-8550~
} else if (modelElement instanceof MetadataTable) {
imgName = ImageLib.TABLE;
}
if (imgName != null) {
modelElementImage = ImageLib.getImage(imgName);
}
// add lock icon on the image
if (modelElementImage != null) {
if (modelElement != null) {
Property property = PropertyHelper.getProperty(modelElement);
if (property != null) {
Item item = property.getItem();
if (item != null) {
if (ProxyRepositoryManager.getInstance().isLockByUserOwn(item)) {
modelElementImage = ImageLib.createLockedByOwnIcon(imgName);
} else if (ProxyRepositoryManager.getInstance().isLockByOthers(item)) {
modelElementImage = ImageLib.createLockedByOtherIcon(imgName);
}
}
}
}
return modelElementImage;
}
return super.getImage(obj);
}
};
}
return labelProvider;
}
Aggregations