use of orgomg.cwm.resource.relational.Catalog in project tdq-studio-se by Talend.
the class CatalogComparisonLevel method getLeftResource.
@Override
protected Resource getLeftResource() throws ReloadCompareException {
Package selectedPackage = null;
if (selectedObj instanceof RepositoryNode) {
selectedPackage = (Package) RepositoryNodeHelper.getMetadataElement((RepositoryNode) selectedObj);
} else {
selectedPackage = (Package) selectedObj;
}
Package findMatchPackage = DQStructureComparer.findMatchedPackage(selectedPackage, copyedDataProvider);
List<Schema> schemas = new ArrayList<Schema>();
schemas.addAll(CatalogHelper.getSchemas((Catalog) findMatchPackage));
Resource leftResource = copyedDataProvider.eResource();
leftResource.getContents().clear();
for (Schema schema : schemas) {
DQStructureComparer.clearSubNode(schema);
leftResource.getContents().add(schema);
}
EMFSharedResources.getInstance().saveResource(leftResource);
return upperCaseResource(leftResource);
}
use of orgomg.cwm.resource.relational.Catalog in project tdq-studio-se by Talend.
the class RefreshActionDelegate method selectionChanged.
@Override
public void selectionChanged(IAction action, ISelection selection) {
if (selection != null && selection instanceof TreeSelection) {
TreeSelection ts = (TreeSelection) selection;
TreePath[] treepaths = ts.getPaths();
if (treepaths.length >= 1) {
int count = treepaths[0].getSegmentCount();
for (int i = 0; i < count; i++) {
Object o = treepaths[0].getSegment(i);
if (o instanceof IFile) {
if (((IFile) o).getFileExtension().toLowerCase().equals("prv")) {
// $NON-NLS-1$
selectedFileObject = (IFile) o;
}
} else if (o instanceof Schema) {
selectedSchema = (Schema) o;
} else if (o instanceof Catalog) {
selectedCatalog = (Catalog) o;
} else if (o instanceof Connection) {
selectedDataProvider = (Connection) o;
}
}
}
selectedObject = ts.getFirstElement();
}
}
use of orgomg.cwm.resource.relational.Catalog in project tdq-studio-se by Talend.
the class SubelementCompareAction method getTableOrViewFolder.
private IRepositoryNode getTableOrViewFolder(EObject selectedElement) {
IRepositoryNode folderNode = null;
ModelElement matchedElement = null;
Connection conn = null;
if (selectedOjbect instanceof Catalog) {
conn = ConnectionHelper.getTdDataProvider(((Catalog) selectedOjbect));
} else {
IRepositoryViewObject reposViewObj = (IRepositoryViewObject) selectedOjbect;
ConnectionItem item = (ConnectionItem) reposViewObj.getProperty().getItem();
conn = item.getConnection();
}
matchedElement = findMatchedModelElement(conn, selectedElement);
if (matchedElement != null) {
IRepositoryNode repositoryNode = RepositoryNodeHelper.recursiveFind(matchedElement);
if (repositoryNode != null) {
if (actionType == TABLE_COMPARE) {
folderNode = repositoryNode.getChildren().get(0);
} else if (actionType == VIEW_COMPARE) {
folderNode = repositoryNode.getChildren().get(1);
}
}
}
return folderNode;
}
use of orgomg.cwm.resource.relational.Catalog in project tdq-studio-se by Talend.
the class ConnectionAnalysisDetailsPage method getCatalogIndicators.
@Override
public List<OverviewIndUIElement> getCatalogIndicators() {
ConnectionIndicator conIndicator = (ConnectionIndicator) getCurrentModelElement().getResults().getIndicators().get(0);
Connection analyzedElement = (Connection) conIndicator.getAnalyzedElement();
EList<CatalogIndicator> catalogIndicators = conIndicator.getCatalogIndicators();
List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
RepositoryNode connNode = RepositoryNodeHelper.recursiveFind(analyzedElement);
for (Indicator indicator : catalogIndicators) {
if (connNode != null) {
for (IRepositoryNode catalogNode : connNode.getChildren()) {
Catalog catalog = ((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog();
String connUuid = ResourceHelper.getUUID(catalog);
String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
if (connUuid.equals(anaUuid)) {
OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
cataUIEle.setNode(catalogNode);
cataUIEle.setOverviewIndicator(indicator);
cataUIEleList.add(cataUIEle);
break;
}
}
}
}
return cataUIEleList;
}
use of orgomg.cwm.resource.relational.Catalog in project tdq-studio-se by Talend.
the class AnalyzedColumnSetsSynDialog method reloadInputModel.
@Override
public void reloadInputModel() {
ColumnSet anaColumnSet = null;
modelInput.clear();
synedEleMap.clear();
for (ModelElement element : analyzedElements) {
try {
anaColumnSet = (ColumnSet) element;
synedEleMap.put(anaColumnSet, null);
Package anaPackage = ColumnSetHelper.getParentCatalogOrSchema(anaColumnSet);
if (anaPackage == null) {
return;
}
Package connPackage = null;
// MOD by zshen for bug 16775 on 2010.12.28 for mssql case
for (Package pk : newDataProvider.getDataPackage()) {
if (pk instanceof Catalog && anaPackage instanceof Schema) {
Catalog catl = CatalogHelper.getParentCatalog(anaPackage);
if (null != catl && pk.getName().equalsIgnoreCase(catl.getName())) {
connPackage = pk;
break;
}
} else if (null != anaPackage && pk.getName().equalsIgnoreCase(anaPackage.getName())) {
connPackage = pk;
break;
}
}
if (connPackage == null) {
SynTreeModel synTreeModel = new SynTreeModel(anaColumnSet);
synTreeModel.setOldDataProvElement(anaPackage);
// synTreeModel.setNewDataProvElement(connPackage);
modelInput.add(synTreeModel);
break;
}
List<? extends MetadataTable> connColumnSetList = null;
// MOD by zshen for bug 16775 on 2010.12.28 for mssql case
if (connPackage instanceof Catalog && anaPackage instanceof Schema) {
for (Schema sche : CatalogHelper.getSchemas((Catalog) connPackage)) {
if (sche.getName().equalsIgnoreCase(anaPackage.getName())) {
connPackage = sche;
// if (anaColumnSet instanceof TdTable) {
// connColumnSetList = PackageHelper.getTables(sche);
// } else {
// connColumnSetList = PackageHelper.getViews(sche);
// }
// break;
}
}
}
boolean loadFromDb = connPackage.getOwnedElement().size() == 0;
if (anaColumnSet instanceof TdTable) {
connColumnSetList = DqRepositoryViewService.getTables(newDataProvider, connPackage, null, loadFromDb, false);
// connColumnSetList = PackageHelper.getTables(connPackage);
if (loadFromDb) {
for (MetadataTable table : connColumnSetList) {
PackageHelper.addMetadataTable(table, connPackage);
}
}
} else {
connColumnSetList = DqRepositoryViewService.getViews(newDataProvider, connPackage, null, loadFromDb, false);
// connColumnSetList = PackageHelper.getViews(connPackage);
if (loadFromDb) {
for (MetadataTable table : connColumnSetList) {
PackageHelper.addMetadataTable(table, connPackage);
}
}
}
ColumnSet connColumnSet = null;
for (Object colSet : connColumnSetList) {
if (((ColumnSet) colSet).getName().equalsIgnoreCase(anaColumnSet.getName())) {
connColumnSet = (ColumnSet) colSet;
break;
}
}
if (connColumnSet == null) {
SynTreeModel synTreeModel = new SynTreeModel(anaColumnSet);
synTreeModel.setOldDataProvElement(anaColumnSet);
synTreeModel.setNewDataProvElement(connPackage);
modelInput.add(synTreeModel);
continue;
}
synedEleMap.put(anaColumnSet, connColumnSet);
} catch (Exception e) {
log.error(e, e);
e.printStackTrace();
}
}
}
Aggregations