use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class AbstractPagePart method updateBindConnection.
/**
* ADD mzhao 2009-05-05 bug:6587.
*/
protected void updateBindConnection(AbstractAnalysisMetadataPage masterPage, List<TableViewer> tableViewerPosStack) {
boolean isEmpty1 = tableViewerPosStack.get(0) == null || tableViewerPosStack.get(0).getInput() == null || ((List) tableViewerPosStack.get(0).getInput()).size() == 0;
boolean isEmpty2 = tableViewerPosStack.get(1) == null || tableViewerPosStack.get(1).getInput() == null || ((List) tableViewerPosStack.get(1).getInput()).size() == 0;
if (isEmpty1 && isEmpty2) {
return;
} else {
TableViewer columnsElementViewer = null;
if (!isEmpty1) {
columnsElementViewer = tableViewerPosStack.get(0);
} else {
columnsElementViewer = tableViewerPosStack.get(1);
}
Connection tdProvider = null;
Object input = columnsElementViewer.getInput();
List<DBColumnRepNode> columnSet = (List<DBColumnRepNode>) input;
if (columnSet != null && columnSet.size() != 0) {
TdColumn column = (TdColumn) ((MetadataColumnRepositoryObject) columnSet.get(0).getObject()).getTdColumn();
if (column != null && column.eIsProxy()) {
column = (TdColumn) EObjectHelper.resolveObject(column);
}
tdProvider = ConnectionHelper.getTdDataProvider(column);
setConnectionState(masterPage, tdProvider);
}
}
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class AnalysisColumnCompareTreeViewer method setColumnABForMatchingIndicator.
/**
* DOC rli Comment method "setColumnAB".
*/
public void setColumnABForMatchingIndicator(RowMatchingIndicator rowMatchingIndicator, List<RepositoryNode> columnsA, List<RepositoryNode> columnsB) {
if (columnsA.size() != 0 && columnsA.get(0).getObject() instanceof MetadataColumnRepositoryObject) {
RepositoryNode node = columnsA.get(0);
MetadataColumnRepositoryObject columnObject = (MetadataColumnRepositoryObject) node.getObject();
TdColumn column = ((TdColumn) columnObject.getTdColumn());
ColumnSet columnSetOwner = ColumnHelper.getColumnOwnerAsColumnSet(column);
rowMatchingIndicator.setAnalyzedElement(columnSetOwner);
}
rowMatchingIndicator.getColumnSetA().clear();
for (RepositoryNode reposNode : columnsA) {
rowMatchingIndicator.getColumnSetA().add((TdColumn) ((MetadataColumnRepositoryObject) reposNode.getObject()).getTdColumn());
}
rowMatchingIndicator.getColumnSetB().clear();
for (RepositoryNode reposNode : columnsB) {
rowMatchingIndicator.getColumnSetB().add((TdColumn) ((MetadataColumnRepositoryObject) reposNode.getObject()).getTdColumn());
}
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class AnalysisColumnNominalIntervalTreeViewer method dropModelElements.
@Override
public void dropModelElements(List<? extends IRepositoryNode> reposObjects, int index) {
List<IRepositoryNode> columns = new ArrayList<IRepositoryNode>();
for (IRepositoryNode element : reposObjects) {
if (element.getObject() instanceof MetadataColumnRepositoryObject) {
columns.add(element);
}
}
this.addElements(columns, index);
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class AnalysisColumnTreeViewer method isExpressionNull.
private String isExpressionNull(TreeItem item) {
String expressContent = null;
ModelElement me = null;
IndicatorUnit indicatorUnit = (IndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
ModelElementIndicator meIndicator = (ModelElementIndicator) item.getData(MODELELEMENT_INDICATOR_KEY);
if (indicatorUnit != null) {
IRepositoryViewObject reposViewObj = meIndicator.getModelElementRepositoryNode().getObject();
// MetadataXmlElementTypeRepositoryObject
if (reposViewObj instanceof MetadataColumnRepositoryObject) {
me = ((MetadataColumnRepositoryObject) reposViewObj).getTdColumn();
}
Connection dataprovider = ModelElementHelper.getTdDataProvider(me);
DbmsLanguage dbmsLang = DbmsLanguageFactory.createDbmsLanguage(dataprovider);
Expression expression = dbmsLang.getInstantiatedExpression(indicatorUnit.getIndicator());
if (expression != null) {
expressContent = expression.getBody();
}
} else {
IRepositoryNode parentNodeForColumnNode = RepositoryNodeHelper.getParentNodeForColumnNode(meIndicator.getModelElementRepositoryNode());
expressContent = DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.columnParent", // $NON-NLS-1$ //;
parentNodeForColumnNode.getObject().getLabel());
}
return expressContent;
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class AnalysisColumnTreeViewer method canDrop.
@Override
public boolean canDrop(IRepositoryNode metadataRepositoryNode) {
IRepositoryViewObject metadataRepObject = metadataRepositoryNode.getObject();
ConnectionItem connItem = (ConnectionItem) metadataRepObject.getProperty().getItem();
// MOD qiongli 2010-8-19,bug 14436:could not come from diffrent connection
Connection tdProvider = connItem.getConnection();
if (tdProvider == null) {
return false;
} else if (this.getAnalysis().getContext().getConnection() != null && !ResourceHelper.areSame(tdProvider, this.getAnalysis().getContext().getConnection())) {
return false;
}
// MOD mzhao, 2010-07-23 bug 14014: If the editor is dirty, save it firstly before drag and drop an elements.
if (masterPage.isDirty()) {
masterPage.doSave(new NullProgressMonitor());
return false;
}
List<ModelElement> existModelElements = new ArrayList<ModelElement>();
for (ModelElementIndicator modelElementIndicator : this.getAllTheElementIndicator()) {
ModelElement me = RepositoryNodeHelper.getModelElementFromRepositoryNode(modelElementIndicator.getModelElementRepositoryNode());
existModelElements.add(me);
}
// MOD mzhao 9848 2010-01-14, allowing to drag and drop table.
if (metadataRepObject instanceof MetadataTableRepositoryObject) {
MetadataTableRepositoryObject tableRepObject = (MetadataTableRepositoryObject) metadataRepObject;
return !existModelElements.containsAll(ColumnSetHelper.getColumns((TdTable) tableRepObject.getTable()));
}
if (metadataRepObject instanceof MetadataColumnRepositoryObject) {
if (existModelElements.contains(((MetadataColumnRepositoryObject) metadataRepObject).getTdColumn())) {
return false;
}
}
if (metadataRepObject instanceof MetadataXmlElementTypeRepositoryObject) {
return !metadataRepositoryNode.hasChildren();
}
return true;
}
Aggregations