use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class FileSystemImportWriter method updatePatternInAnaParams.
/**
* if there is a same name pattern in current workspace,update the pattern in imported analysis IndicatorParameters.
*
* @param systemSupplyModelElement
* @param analysis
*/
private void updatePatternInAnaParams(ModelElement systemSupplyModelElement, Analysis analysis) {
if (analysis.getResults() != null) {
EList<Indicator> indicators = analysis.getResults().getIndicators();
IndicatorParameters parameters = null;
for (Indicator indicator : indicators) {
// AllMatchIndicator is in column set analysis.
if (indicator instanceof AllMatchIndicator) {
EList<RegexpMatchingIndicator> list = ((AllMatchIndicator) indicator).getCompositeRegexMatchingIndicators();
for (RegexpMatchingIndicator regMatchIndicator : list) {
parameters = regMatchIndicator.getParameters();
removOldAddSysPatternInAnaParams(parameters, (Pattern) systemSupplyModelElement, analysis);
}
} else if (indicator instanceof PatternMatchingIndicator) {
parameters = ((PatternMatchingIndicator) indicator).getParameters();
removOldAddSysPatternInAnaParams(parameters, (Pattern) systemSupplyModelElement, analysis);
}
}
}
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class ItemRecord method getSystemIndicaotrOfAnalysis.
/**
* get Analysis Dependency (for indicator only).
*
* @return get the list of indicator which in use by the analysis
*/
private List<File> getSystemIndicaotrOfAnalysis(ModelElement mElement) {
List<File> listFile = new ArrayList<File>();
if (mElement instanceof Analysis) {
Analysis anaElement = (Analysis) mElement;
List<Indicator> indicators = IndicatorHelper.getIndicators(anaElement.getResults());
for (Indicator indicator : indicators) {
if (indicator instanceof UserDefIndicator) {
// whereRuleIndicator or UDIIndicator
continue;
}
boolean isContain = false;
IndicatorDefinition newIndicatorDefinition = indicator.getIndicatorDefinition();
// MOD qiongli 2012-5-11 TDQ-5256
if (newIndicatorDefinition == null) {
continue;
}
for (File lf : listFile) {
ModelElement me = getElement(lf);
if (me != null && me instanceof IndicatorDefinition) {
IndicatorDefinition oldIndicatorDefinition = (IndicatorDefinition) me;
if (ModelElementHelper.compareUUID(oldIndicatorDefinition, newIndicatorDefinition)) {
isContain = true;
break;
}
}
}
if (!isContain) {
File depFile = EObjectHelper.modelElement2File(newIndicatorDefinition);
if (depFile != null) {
FILE_ELEMENT_MAP.put(depFile, newIndicatorDefinition);
listFile.add(depFile);
}
}
}
}
return listFile;
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class AnalysisUtils method createDynamicBAWChartEventReceiver.
/**
* DOC yyin Comment method "createDynamicBAWChartEventReceiver".
*
* @param oneCategoryIndicatorModel
* @param categoryDataset
* @return
*/
public static DynamicBAWChartEventReceiver createDynamicBAWChartEventReceiver(DynamicIndicatorModel oneCategoryIndicatorModel, Map<Indicator, EventReceiver> eventReceivers) {
DynamicBAWChartEventReceiver bawReceiver = new DynamicBAWChartEventReceiver();
Object categoryDataset = oneCategoryIndicatorModel.getDataset();
if (categoryDataset instanceof CustomerDefaultBAWDataset) {
// all summary selected
bawReceiver.setBawDataset((CustomerDefaultBAWDataset) categoryDataset);
} else {
// not-all summary selected
bawReceiver.setDataset(categoryDataset);
}
bawReceiver.setBAWparentComposite(oneCategoryIndicatorModel.getBawParentChartComp());
bawReceiver.setTableViewer(oneCategoryIndicatorModel.getTableViewer());
int index = 0;
int length = oneCategoryIndicatorModel.getSummaryIndicators().size();
for (Indicator oneIndicator : oneCategoryIndicatorModel.getSummaryIndicators()) {
DynamicChartEventReceiver eReceiver = bawReceiver.createEventReceiver(IndicatorEnum.findIndicatorEnum(oneIndicator.eClass()), oneIndicator);
eReceiver.setTableViewer(oneCategoryIndicatorModel.getTableViewer());
eReceiver.setEntityIndex(index++);
if (SummaryStatisticsState.FULL_FLAG != length) {
eReceiver.setDataset(categoryDataset);
}
eReceiver.clearValue();
eventReceivers.put(oneIndicator, eReceiver);
EventManager.getInstance().register(oneIndicator, EventEnum.DQ_DYMANIC_CHART, eReceiver);
}
bawReceiver.clearValue();
return bawReceiver;
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class FileSystemImportWriter method updateAnalysisClientDependence.
/**
* remove the old client dependency add a new one in Anlaysis.
*
* @param supplierItem
* @param modelElement
* @throws PersistenceException
*/
private void updateAnalysisClientDependence(TDQItem supplierItem, Property property) throws PersistenceException {
ModelElement anaModelElement = PropertyHelper.getModelElement(property);
if (anaModelElement != null) {
Analysis analysis = (Analysis) anaModelElement;
EList<Dependency> clientDependency = anaModelElement.getClientDependency();
Iterator<Dependency> it = clientDependency.iterator();
ModelElement supplierModelElement = RepositoryNodeHelper.getResourceModelElement(supplierItem);
Resource supModeResource = supplierModelElement.eResource();
while (it.hasNext()) {
Dependency clientDep = it.next();
// systemSupplyModelElement,remove it.
if (clientDep.eResource() == null) {
URI clientDepURI = ((InternalEObject) clientDep).eProxyURI();
boolean isUDI = clientDepURI.path().contains(ResourceManager.getUDIFolder().getProjectRelativePath().toString());
boolean isPattern = clientDepURI.path().contains(ResourceManager.getPatternFolder().getProjectRelativePath().toString());
if (supModeResource != null && (isUDI || isPattern) && clientDepURI.lastSegment().equals(supModeResource.getURI().lastSegment())) {
it.remove();
break;
}
}
}
DependenciesHandler.getInstance().setUsageDependencyOn(anaModelElement, supplierModelElement);
// TDQ-8436 remove the old pattern and add the new pattern in analysis Indicator Parameters.
if (isPattern(supplierModelElement)) {
updatePatternInAnaParams(supplierModelElement, analysis);
ElementWriterFactory.getInstance().createPatternWriter().save(supplierItem, true);
}
// remove old udi and set a new one in the analysis indicators.
if (supplierModelElement instanceof UDIndicatorDefinition) {
if (analysis.getResults() != null) {
EList<Indicator> indicators = analysis.getResults().getIndicators();
Iterator<Indicator> itIndicators = indicators.iterator();
while (itIndicators.hasNext()) {
Indicator indicator = itIndicators.next();
IndicatorDefinition indicatorDefinition = indicator.getIndicatorDefinition();
if (indicatorDefinition.eResource() == null) {
URI indicatorDefURI = ((InternalEObject) indicatorDefinition).eProxyURI();
if (supModeResource != null && UDIHelper.isUDI(indicator) && indicatorDefURI.lastSegment().equals(supModeResource.getURI().lastSegment())) {
indicator.setIndicatorDefinition((UDIndicatorDefinition) supplierModelElement);
break;
}
}
}
ElementWriterFactory.getInstance().createIndicatorDefinitionWriter().save(supplierItem, true);
}
}
// only save analysis item at here.
ProxyRepositoryFactory.getInstance().save(property.getItem(), true);
}
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class DrillDownUtils method createDrillDownMenuForMapDB.
public static void createDrillDownMenuForMapDB(final ChartDataEntity dataEntity, Menu menu, MenuItemEntity[] itemEntities, final Analysis analysis) {
final Indicator indicator = dataEntity != null ? dataEntity.getIndicator() : null;
if (dataEntity == null || indicator == null) {
return;
}
createDrillDownMenu(dataEntity, menu, itemEntities, analysis);
}
Aggregations