use of org.talend.dq.analysis.parameters.PackagesAnalyisParameter in project tdq-studio-se by Talend.
the class AnalyzeColumnSetAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
PackagesAnalyisParameter packaFilterParameter = new PackagesAnalyisParameter();
if (nodeColumns != null) {
DQRepositoryNode tFolder = (DQRepositoryNode) nodeColumns.getParent();
if (tFolder != null) {
IRepositoryNode node = tFolder.getParent();
if (node instanceof DBCatalogRepNode) {
IRepositoryNode connNode = ((DBCatalogRepNode) node).getParent();
packaFilterParameter.setConnectionRepNode(connNode);
catalogs.add(node);
packaFilterParameter.setPackages(catalogs);
} else if (node instanceof DBSchemaRepNode) {
schemaNode = (DBSchemaRepNode) node;
RepositoryNode parent = schemaNode.getParent();
if (parent instanceof DBCatalogRepNode) {
catalogs.add(parent);
packaFilterParameter.setConnectionRepNode(parent);
} else {
catalogs.add(schemaNode);
packaFilterParameter.setConnectionRepNode(schemaNode);
}
packaFilterParameter.setPackages(catalogs);
}
}
}
if (needselection) {
IRepositoryNode firstElement = (RepositoryNode) this.selection.getFirstElement();
IRepositoryViewObject viewObject = firstElement.getObject();
Item item = viewObject.getProperty().getItem();
ConnectionItem connectionItem = (ConnectionItem) item;
Connection connection = connectionItem.getConnection();
IRepositoryNode repositoryNode = RepositoryNodeHelper.recursiveFind(connection);
packaFilterParameter.setConnectionRepNode(repositoryNode);
}
if (opencolumnSetAnalysisDialog(packaFilterParameter) == Window.OK) {
AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (editor != null) {
ColumnSetAnalysisDetailsPage page = (ColumnSetAnalysisDetailsPage) editor.getMasterPage();
if (this.needselection && !this.selection.isEmpty()) {
IRepositoryNode[] nodeArray = new IRepositoryNode[selection.size()];
Iterator it = this.selection.iterator();
int i = 0;
while (it.hasNext()) {
nodeArray[i] = (IRepositoryNode) it.next();
i++;
}
page.setTreeViewInput(nodeArray);
} else if (!this.needselection && null != this.nodeColumns) {
List<IRepositoryNode> column = new ArrayList<IRepositoryNode>();
for (IRepositoryNode columnFolder : nodeColumns.getChildren()) {
if (columnFolder instanceof DBColumnFolderRepNode) {
column.addAll(columnFolder.getChildren());
}
}
page.setTreeViewInput(column.toArray());
}
page.doSave(null);
}
}
}
use of org.talend.dq.analysis.parameters.PackagesAnalyisParameter in project tdq-studio-se by Talend.
the class SchemaAnalysisDPSelectionPage method addListeners.
@Override
protected void addListeners() {
addListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
if (object instanceof Schema) {
advanceToNextPageOrFinish();
}
}
});
addListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
PackagesAnalyisParameter schemaPanameter = (PackagesAnalyisParameter) getConnectionParams();
List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
if (object instanceof DBSchemaRepNode) {
DBSchemaRepNode schemaNode = (DBSchemaRepNode) object;
Schema schema = ((MetadataSchemaRepositoryObject) schemaNode.getObject()).getSchema();
Connection tdProvider = ConnectionHelper.getTdDataProvider(SwitchHelpers.PACKAGE_SWITCH.doSwitch(schema));
RepositoryNode parent = schemaNode.getParent();
if (tdProvider != null && schemaPanameter != null) {
if (parent instanceof DBCatalogRepNode) {
schemaPanameter.setConnectionRepNode((DBConnectionRepNode) parent.getParent());
} else {
schemaPanameter.setConnectionRepNode((DBConnectionRepNode) parent);
}
schemaPanameter.setTdDataProvider(tdProvider);
}
nodes.add(schemaNode);
schemaPanameter.setPackages(nodes);
setPageComplete(true);
} else {
setPageComplete(false);
}
}
});
}
use of org.talend.dq.analysis.parameters.PackagesAnalyisParameter in project tdq-studio-se by Talend.
the class CatalogAnalysisWizard method initCWMResourceBuilder.
@Override
public ModelElement initCWMResourceBuilder() {
Analysis analysis = (Analysis) super.initCWMResourceBuilder();
if (getAnalysisBuilder() != null) {
// DOC klliu 15750 2011-1-05 add the repnode on parameter
PackagesAnalyisParameter packageParameter = getParameter();
IRepositoryNode connectionRepNode = getParameter().getConnectionRepNode();
ConnectionItem item = (ConnectionItem) connectionRepNode.getObject().getProperty().getItem();
Connection tdProvider = item.getConnection();
getAnalysisBuilder().setAnalysisConnection(tdProvider);
Indicator[] indicators = new Indicator[packageParameter.getPackages().size()];
ModelElement[] modelElement = new ModelElement[packageParameter.getPackages().size()];
int i = 0;
for (IRepositoryNode node : packageParameter.getPackages()) {
CatalogIndicator createCatalogIndicator = SchemaFactory.eINSTANCE.createCatalogIndicator();
// MOD xqliu 2009-1-21 feature 4715
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createCatalogIndicator);
Catalog catalog = ((MetadataCatalogRepositoryObject) node.getObject()).getCatalog();
modelElement[i] = catalog;
createCatalogIndicator.setAnalyzedElement(catalog);
indicators[i] = createCatalogIndicator;
i++;
}
getAnalysisBuilder().addElementsToAnalyze(modelElement, indicators);
}
return analysis;
}
Aggregations