use of orgomg.cwm.resource.relational.Catalog in project tdq-studio-se by Talend.
the class ConnectionAnalysisWizard method initCWMResourceBuilder.
@Override
public ModelElement initCWMResourceBuilder() {
Analysis analysis = (Analysis) super.initCWMResourceBuilder();
if (getAnalysisBuilder() != null) {
IRepositoryNode connectionRepNode = getParameter().getConnectionRepNode();
ConnectionItem item = (ConnectionItem) connectionRepNode.getObject().getProperty().getItem();
Connection tdProvider = item.getConnection();
getAnalysisBuilder().setAnalysisConnection(tdProvider);
ConnectionIndicator indicator = SchemaFactory.eINSTANCE.createConnectionIndicator();
// MOD xqliu 2009-1-21 feature 4715
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(indicator);
indicator.setAnalyzedElement(tdProvider);
List<Schema> tdSchemas = ConnectionHelper.getSchema(tdProvider);
if (tdSchemas.size() != 0) {
addSchemaIndicator(tdSchemas, indicator);
}
List<Catalog> tdCatalogs = ConnectionHelper.getCatalogs(tdProvider);
for (Catalog tdCatalog : tdCatalogs) {
CatalogIndicator createCatalogIndicator = SchemaFactory.eINSTANCE.createCatalogIndicator();
// MOD xqliu 2009-1-21 feature 4715
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createCatalogIndicator);
createCatalogIndicator.setAnalyzedElement(tdCatalog);
// MOD xqliu 2009-11-30 bug 9114
indicator.addCatalogIndicator(createCatalogIndicator);
// ~
addSchemaIndicator(CatalogHelper.getSchemas(tdCatalog), indicator);
}
getAnalysisBuilder().addElementToAnalyze(tdProvider, indicator);
}
return analysis;
}
use of orgomg.cwm.resource.relational.Catalog 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;
}
use of orgomg.cwm.resource.relational.Catalog in project tdq-studio-se by Talend.
the class SchemaEvaluator method executeSqlQuery.
@Override
protected ReturnCode executeSqlQuery(String sqlStatement) throws SQLException {
ReturnCode ok = new ReturnCode(true);
// --- preconditions
DataProvider dataProvider = this.getDataManager();
if (this.elementToIndicators.values().isEmpty()) {
// $NON-NLS-1$
String msg = Messages.getString("Evaluator.NoInidcator1");
log.error(msg);
ok.setReturnCode(msg, false);
return ok;
}
Indicator[] indics = this.getAllIndicators();
if (indics.length == 0) {
// $NON-NLS-1$
String msg = Messages.getString("Evaluator.NoInidcator2", dataProvider);
log.error(msg);
ok.setReturnCode(msg, false);
return ok;
}
for (Indicator indicator : indics) {
SchemaIndicator schemaIndicator = DataqualitySwitchHelper.SCHEMA_SWITCH.doSwitch(indicator);
if (schemaIndicator == null) {
continue;
}
Schema schema = (Schema) schemaIndicator.getAnalyzedElement();
String catName = schema.getName();
// MOD yyi 2009-11-30 10187
if (!checkSchema(schema)) {
// $NON-NLS-1$
ok.setReturnCode(Messages.getString("Evaluator.schemaNotExist", catName), false);
return ok;
}
// ~
// ADD xqliu 2010-01-06 bug 10919
EObject container = schema.eContainer();
if (container != null) {
Catalog catalog = SwitchHelpers.CATALOG_SWITCH.doSwitch(container);
if (catalog != null) {
catName = catalog.getName();
// MOD gdbu 2011-4-21 bug : 20578
if (!ConnectionUtils.isOdbcProgress(connection) && !ConnectionUtils.isOdbcOracle(connection) && StringUtils.isNotEmpty(catName) && dbms().supportCatalogSelection()) {
connection.setCatalog(catName);
}
// ~20578
}
}
// ~
evalSchemaIndicLow(null, schemaIndicator, null, schema, ok);
}
return ok;
}
use of orgomg.cwm.resource.relational.Catalog in project tdq-studio-se by Talend.
the class AnalysisSubFolderRepNode method doSwichNode.
/**
* DOC klliu Comment method "doSwichNode".
*
* @param analyzedElement
* @return
*/
private IRepositoryNode doSwichNode(ModelElement analyzedElement, AnalysisSubFolderRepNode childNodeFolder) {
Property anaEleProperty = PropertyHelper.getProperty(analyzedElement);
IRepositoryViewObject medataViewObject = null;
try {
medataViewObject = ProxyRepositoryFactory.getInstance().getLastVersion(anaEleProperty.getId());
} catch (Exception e) {
log.error(e);
}
// }
if (medataViewObject != null) {
if (analyzedElement instanceof DatabaseConnection) {
DBConnectionRepNode connNode = new DBConnectionRepNode(medataViewObject, this, ENodeType.REPOSITORY_ELEMENT, getProject());
connNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CONNECTIONS);
connNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CONNECTIONS);
medataViewObject.setRepositoryNode(connNode);
return connNode;
} else if (analyzedElement instanceof Catalog) {
RepositoryNode catalogNode = DQRepNodeCreateFactory.createDBCatalogRepNode(new MetadataCatalogRepositoryObject(medataViewObject, (Catalog) analyzedElement), this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
catalogNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_CATALOG);
catalogNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_CATALOG);
medataViewObject.setRepositoryNode(catalogNode);
return catalogNode;
} else if (analyzedElement instanceof Schema) {
RepositoryNode schemaNode = new DBSchemaRepNode(new MetadataSchemaRepositoryObject(medataViewObject, (Schema) analyzedElement), this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
schemaNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_SCHEMA);
schemaNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_SCHEMA);
medataViewObject.setRepositoryNode(schemaNode);
return schemaNode;
} else if (analyzedElement instanceof TdTable) {
DBTableRepNode tableNode = new DBTableRepNode(new TdTableRepositoryObject(medataViewObject, (TdTable) analyzedElement), childNodeFolder, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
tableNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_TABLE);
tableNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_TABLE);
medataViewObject.setRepositoryNode(tableNode);
return tableNode;
} else if (analyzedElement instanceof TdView) {
DBViewRepNode viewNode = new DBViewRepNode(new TdViewRepositoryObject(medataViewObject, (TdView) analyzedElement), childNodeFolder, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
viewNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_VIEW);
viewNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_VIEW);
medataViewObject.setRepositoryNode(viewNode);
return viewNode;
} else if (analyzedElement instanceof MetadataColumn) {
RepositoryNode columnNode = null;
if (analyzedElement instanceof TdColumn) {
columnNode = new DBColumnRepNode(new MetadataColumnRepositoryObject(medataViewObject, (MetadataColumn) analyzedElement), childNodeFolder, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
} else {
columnNode = new DFColumnRepNode(new MetadataColumnRepositoryObject(medataViewObject, (MetadataColumn) analyzedElement), this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
}
columnNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_COLUMN);
columnNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_COLUMN);
medataViewObject.setRepositoryNode(columnNode);
return columnNode;
}
}
return null;
}
use of orgomg.cwm.resource.relational.Catalog in project tdq-studio-se by Talend.
the class DBSchemaRepNode method getParentViewObject.
/*
* (non-Javadoc)
*
* @see org.talend.dq.nodes.DQRepositoryNode#getParentViewObject()
*/
@Override
protected IRepositoryViewObject getParentViewObject() {
IRepositoryViewObject packageViewObject = null;
Package parentPackage = PackageHelper.getParentPackage(getSchema());
if (parentPackage == null) {
return metadataSchemaObject.getViewObject();
} else if (parentPackage instanceof Catalog) {
packageViewObject = new MetadataCatalogRepositoryObject(metadataSchemaObject.getViewObject(), (Catalog) parentPackage);
}
return packageViewObject;
}
Aggregations