use of org.talend.core.model.metadata.builder.connection.MDMConnection in project tdq-studio-se by Talend.
the class TOPRepositoryService method removeAliasInSQLExplorer.
public boolean removeAliasInSQLExplorer(IRepositoryNode children) {
boolean hasDependencyItem = true;
// MOD klliu 2011-04-28 bug 20204 removing connection is synced to the connection view of SQL explore
Item item = children.getObject().getProperty().getItem();
// MOD mzhao filter the connections which is not a type of database.
if (item != null && item instanceof ConnectionItem) {
Connection connection = ((ConnectionItem) item).getConnection();
if (connection instanceof DatabaseConnection || connection instanceof DelimitedFileConnection || connection instanceof MDMConnection) {
CWMPlugin.getDefault().removeAliasInSQLExplorer(connection);
}
}
return hasDependencyItem;
}
use of org.talend.core.model.metadata.builder.connection.MDMConnection in project tdi-studio-se by Talend.
the class MdmConceptMigrationTask method execute.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
*/
@Override
public ExecutionResult execute(Item item) {
if (item instanceof MDMConnectionItem) {
boolean modify = false;
MDMConnectionItem mdmConnItem = (MDMConnectionItem) item;
if (mdmConnItem.getConnection() instanceof MDMConnection) {
MDMConnection mdmConnection = (MDMConnection) mdmConnItem.getConnection();
final EList<Concept> schemas = mdmConnection.getSchemas();
for (Concept concept : schemas) {
if (!concept.isInputModel()) {
concept.setConceptType(MdmConceptType.OUTPUT);
modify = true;
}
}
}
if (modify) {
try {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
factory.save(item, true);
return ExecutionResult.SUCCESS_WITH_ALERT;
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
}
return ExecutionResult.NOTHING_TO_DO;
}
use of org.talend.core.model.metadata.builder.connection.MDMConnection in project tdq-studio-se by Talend.
the class DQRepositoryViewLabelProvider method addWarnIconIfNeeded.
/**
* if it is needed,add a over warning icon..eg., it is empty analysis or report; imported a MDM analysis or report.
*
* @param image
* @param node
* @param originalImageName
* @return
*/
private Image addWarnIconIfNeeded(IRepositoryNode node, String originalImageName) {
ModelElement modEle = RepositoryNodeHelper.getResourceModelElement(node);
ERepositoryObjectType objectType = node.getObjectType();
if (modEle != null) {
if (ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT == objectType) {
Analysis analysis = (Analysis) modEle;
AnalysisContext context = analysis.getContext();
if (context == null) {
return ImageLib.createInvalidIcon(originalImageName);
}
EList<ModelElement> analysedElements = context.getAnalysedElements();
DataManager connection = context.getConnection();
if (analysedElements.isEmpty() || connection instanceof MDMConnection) {
return ImageLib.createInvalidIcon(originalImageName);
}
} else if (ERepositoryObjectType.TDQ_REPORT_ELEMENT == objectType) {
TdReport report = (TdReport) modEle;
EList<AnalysisMap> analysisMap = report.getAnalysisMap();
if (analysisMap.isEmpty()) {
return ImageLib.createInvalidIcon(originalImageName);
}
for (AnalysisMap anaMap : report.getAnalysisMap()) {
Analysis analysis = anaMap.getAnalysis();
if (analysis == null || analysis.getContext() == null) {
continue;
}
DataManager connection = analysis.getContext().getConnection();
if (connection instanceof MDMConnection) {
return ImageLib.createInvalidIcon(originalImageName);
}
}
}
}
return ImageLib.getImage(originalImageName);
}
use of org.talend.core.model.metadata.builder.connection.MDMConnection in project tdq-studio-se by Talend.
the class TOPRepositoryService method fillMetadata.
/**
* Fill MDM connection only.
*/
public void fillMetadata(ConnectionItem connItem) {
MetadataConnectionUtils.fillConnectionInformation(connItem);
// MOD gdbu 2011-7-12 bug : 22598
MDMConnection mdmConnection = (MDMConnection) connItem.getConnection();
mdmConnection.setLabel(connItem.getProperty().getLabel() + "");
mdmConnection.setName(connItem.getProperty().getLabel() + "");
ElementWriterFactory.getInstance().createDataProviderWriter().save(mdmConnection);
// ~22598
}
Aggregations