use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.
the class ReportWriter method addDependencies.
/*
* (non-Javadoc)
*
* @see org.talend.dq.writer.AElementPersistance#addDependencies(orgomg.cwm.objectmodel.core.ModelElement)
*/
@Override
public void addDependencies(ModelElement element) {
TdReport report = (TdReport) element;
List<Analysis> analyses = ReportHelper.getAnalyses(report);
for (Analysis ana : analyses) {
// TDQ-7999,filter the proxy.
if (!ana.eIsProxy()) {
AnalysisRepNode recursiveFindAnalysis = RepositoryNodeHelper.recursiveFindAnalysis(ana);
// only do save when the dependency is not reference project node
if (recursiveFindAnalysis != null && recursiveFindAnalysis.getProject().isMainProject()) {
TypedReturnCode<Dependency> dependencyReturn = DependenciesHandler.getInstance().setDependencyOn(report, ana);
if (dependencyReturn.isOk()) {
try {
Property property = PropertyHelper.getProperty(ana);
if (property != null) {
Item item = property.getItem();
if (item instanceof TDQAnalysisItem) {
TDQAnalysisItem anaItem = (TDQAnalysisItem) item;
anaItem.setAnalysis(ana);
}
}
ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().saveResource(ana.eResource());
} catch (PersistenceException e) {
log.error(e, e);
}
}
}
}
}
}
use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.
the class RespositoryDetailView method createFileDetail.
private boolean createFileDetail(boolean is, IRepositoryViewObject reposViewObj) {
// MOD klliu 2001-02-28 bug 19154
if (reposViewObj.getProperty() != null) {
Item item = reposViewObj.getProperty().getItem();
if (item instanceof ConnectionItem) {
Connection conn = ((ConnectionItem) item).getConnection();
createDataProviderDetail(conn);
is = false;
}
if (item instanceof TDQAnalysisItem) {
Analysis analysis = ((TDQAnalysisItem) item).getAnalysis();
createAnaysisDetail(analysis);
is = false;
}
if (item instanceof TDQPatternItem) {
Pattern pattern = ((TDQPatternItem) item).getPattern();
createPatternDetail(pattern);
is = false;
}
if (item instanceof TDQReportItem) {
Report report = ((TDQReportItem) item).getReport();
createReportDetail(report);
is = false;
}
}
return is;
}
use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.
the class IndicatorSettingsPage method modifyAndSaveLimit.
/**
* DOC zshen Comment method "modifyAndSaveLimit".
*
* @param anaNode
* @param isLowCase
*/
private void modifyAndSaveLimit(AnalysisRepNode anaNode, boolean isLowCase) {
Analysis analysis = anaNode.getAnalysis();
for (Indicator indicator : analysis.getResults().getIndicators()) {
if (isLowCase) {
modifyLowFre(indicator);
} else {
// too many frequency type
modifyFre(indicator);
}
}
AnalysisWriter anaWriter = ElementWriterFactory.getInstance().createAnalysisWrite();
anaWriter.save(anaNode.getObject().getProperty().getItem(), false);
((TDQAnalysisItem) anaNode.getObject().getProperty().getItem()).setAnalysis(analysis);
// Resource resource = analysis.eResource();
// EMFUtil.saveSingleResource(resource);
}
use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.
the class UnitTestBuildHelper method createRealAnalysis.
public static Analysis createRealAnalysis(String name, IFolder folder, Boolean isDelete) {
IPath createPath = Path.EMPTY;
if (folder != null) {
createPath = new Path(folder.getFullPath().lastSegment());
}
Analysis analysis1 = AnalysisHelper.createAnalysis(name);
TDQAnalysisItem item1 = PropertiesFactoryImpl.eINSTANCE.createTDQAnalysisItem();
org.talend.core.model.properties.Property property1 = PropertiesFactory.eINSTANCE.createProperty();
property1.setId(EcoreUtil.generateUUID());
property1.setItem(item1);
property1.setLabel(analysis1.getName());
item1.setProperty(property1);
item1.setAnalysis(analysis1);
ItemState itemState = org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createItemState();
itemState.setDeleted(isDelete);
item1.setState(itemState);
AnalysisResult analysisResult1 = AnalysisFactory.eINSTANCE.createAnalysisResult();
analysis1.setResults(analysisResult1);
try {
ProxyRepositoryFactory.getInstance().create(item1, createPath, false);
} catch (PersistenceException e) {
Assert.fail(e.getMessage());
}
return analysis1;
}
use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.
the class AbstractCommonActionProviderTest method createAnalysisNode.
private RepositoryNode createAnalysisNode(String name, IFolder folder, boolean isDelete) {
IPath createPath = Path.EMPTY;
if (folder != null) {
createPath = new Path(folder.getFullPath().lastSegment());
}
// connection
Analysis createAnalysis = AnalysisFactory.eINSTANCE.createAnalysis();
createAnalysis.setName(name);
// ~connection
TDQAnalysisItem createAnalysisItem = org.talend.dataquality.properties.PropertiesFactory.eINSTANCE.createTDQAnalysisItem();
org.talend.core.model.properties.Property createAnaProperty = PropertiesFactory.eINSTANCE.createProperty();
createAnaProperty.setId(EcoreUtil.generateUUID());
createAnaProperty.setItem(createAnalysisItem);
createAnaProperty.setLabel(createAnalysis.getName());
createAnalysisItem.setProperty(createAnaProperty);
createAnalysisItem.setAnalysis(createAnalysis);
ItemState createItemState = PropertiesFactory.eINSTANCE.createItemState();
createItemState.setDeleted(isDelete);
createAnalysisItem.setState(createItemState);
// Indicator
CountsIndicator createCountsIndicator = IndicatorsFactory.eINSTANCE.createCountsIndicator();
List<IRepositoryViewObject> all = null;
IndicatorDefinition createIndicatorDefinition = null;
try {
all = factory.getAll(ERepositoryObjectType.TDQ_SYSTEM_INDICATORS);
for (IRepositoryViewObject indicatorViewObject : all) {
if (indicatorViewObject.getLabel().equalsIgnoreCase("ROW COUNT")) {
// $NON-NLS-1$
createIndicatorDefinition = (IndicatorDefinition) PropertyHelper.getModelElement(indicatorViewObject.getProperty());
break;
}
}
} catch (PersistenceException e1) {
e1.printStackTrace();
Assert.fail(e1.getMessage());
}
createCountsIndicator.setIndicatorDefinition(createIndicatorDefinition);
AnalysisParameters createAnalysisParameters = AnalysisFactory.eINSTANCE.createAnalysisParameters();
AnalysisContext createAnalysisContext = AnalysisFactory.eINSTANCE.createAnalysisContext();
createAnalysis.setContext(createAnalysisContext);
AnalysisResult createAnalysisResult = AnalysisFactory.eINSTANCE.createAnalysisResult();
ExecutionInformations createExecutionInformations = AnalysisFactory.eINSTANCE.createExecutionInformations();
createAnalysisResult.setResultMetadata(createExecutionInformations);
createAnalysisResult.getIndicators().add(createCountsIndicator);
createAnalysis.setResults(createAnalysisResult);
createAnalysis.setParameters(createAnalysisParameters);
IRepositoryViewObject repViewObject = null;
try {
factory.create(createAnalysisItem, createPath, false);
repViewObject = factory.getLastVersion(createAnaProperty.getId());
} catch (PersistenceException e) {
Assert.fail(e.getMessage());
}
RepositoryNode anaRepNode = new AnalysisRepNode(repViewObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
// set the contentType for anaRepNode from its parentNode
setParentNode(anaRepNode, ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT);
// ~
return anaRepNode;
}
Aggregations