use of org.talend.dataprofiler.core.manager.DQStructureManager in project tdq-studio-se by Talend.
the class SplitSysIndicatorTask method doExecute.
@Override
protected boolean doExecute() throws Exception {
boolean ok = true;
// Copy system indicators.
DQStructureManager manager = DQStructureManager.getInstance();
IFolder systemIndicatorFolder = ResourceManager.getSystemIndicatorFolder();
if (!systemIndicatorFolder.exists()) {
systemIndicatorFolder = manager.createNewFolder(ResourceManager.getIndicatorFolder(), EResourceConstant.SYSTEM_INDICATORS);
}
manager.copyFilesToFolder(CorePlugin.getDefault(), DQStructureManager.SYSTEM_INDICATOR_PATH, true, systemIndicatorFolder, null, true);
DefinitionHandler.getInstance().reloadIndicatorsDefinitions();
// Migration for analyses (indicator definition)
Collection<Analysis> analyses = (Collection<Analysis>) AnaResourceFileHelper.getInstance().getAllElement();
for (Analysis ana : analyses) {
try {
for (Indicator ind : ana.getResults().getIndicators()) {
updateIndDefinition(ind);
if (ind instanceof CompositeIndicator) {
for (Indicator indLeave : IndicatorHelper.getIndicatorLeavesBySingleNode(ind)) {
updateIndDefinition(indLeave);
}
}
}
EMFSharedResources.getInstance().saveResource(ana.eResource());
} catch (Exception e) {
log.warn(e, e);
ok = false;
}
}
// MOD qiongli 2011-11-16 TDQ-3694,should relaod definitions and all categories after changing the definition
// file.
// Copy system indicator categories.
IFile file = ResourceManager.getLibrariesFolder().getFile(DefinitionHandler.FILENAME);
file.delete(true, new NullProgressMonitor());
DefinitionHandler.getInstance().copyDefinitionsIntoFolder(ResourceManager.getLibrariesFolder());
URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), false);
EMFSharedResources.getInstance().reloadResource(uri);
DefinitionHandler.getInstance().reloadIndicatorsDefinitions();
return ok;
}
Aggregations